]> icculus.org git repositories - icculus/xz.git/blob - src/liblzma/common/filter_common.h
Sort of garbage collection commit. :-| Many things are still
[icculus/xz.git] / src / liblzma / common / filter_common.h
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file       filter_common.c
4 /// \brief      Filter-specific stuff common for both encoder and decoder
5 //
6 //  Copyright (C) 2008 Lasse Collin
7 //
8 //  This library is free software; you can redistribute it and/or
9 //  modify it under the terms of the GNU Lesser General Public
10 //  License as published by the Free Software Foundation; either
11 //  version 2.1 of the License, or (at your option) any later version.
12 //
13 //  This library is distributed in the hope that it will be useful,
14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 //  Lesser General Public License for more details.
17 //
18 ///////////////////////////////////////////////////////////////////////////////
19
20 #ifndef LZMA_FILTER_COMMON_H
21 #define LZMA_FILTER_COMMON_H
22
23 #include "common.h"
24
25
26 /// Both lzma_filter_encoder and lzma_filter_decoder begin with these members.
27 typedef struct {
28         /// Initializes the filter encoder and calls lzma_next_filter_init()
29         /// for filters + 1.
30         lzma_init_function init;
31
32         /// Calculates memory usage of the encoder. If the options are
33         /// invalid, UINT64_MAX is returned.
34         uint64_t (*memusage)(const void *options);
35
36 } lzma_filter_coder;
37
38
39 typedef const lzma_filter_coder *(*lzma_filter_find)(lzma_vli id);
40
41
42 extern lzma_ret lzma_raw_coder_init(
43                 lzma_next_coder *next, lzma_allocator *allocator,
44                 const lzma_filter *filters,
45                 lzma_filter_find coder_find, bool is_encoder);
46
47
48 extern uint64_t lzma_memusage_coder(lzma_filter_find coder_find,
49                 const lzma_filter *filters);
50
51
52 #endif