1 ///////////////////////////////////////////////////////////////////////////////
3 /// \file simple_private.h
4 /// \brief Private definitions for so called simple filters
6 // Copyright (C) 2007 Lasse Collin
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.
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.
18 ///////////////////////////////////////////////////////////////////////////////
20 #ifndef LZMA_SIMPLE_PRIVATE_H
21 #define LZMA_SIMPLE_PRIVATE_H
23 #include "simple_coder.h"
26 typedef struct lzma_simple_s lzma_simple;
29 /// Next filter in the chain
32 /// True if the next coder in the chain has returned LZMA_STREAM_END
33 /// or if we have processed uncompressed_size bytes.
36 /// True if filter() should encode the data; false to decode.
37 /// Currently all simple filters use the same function for encoding
38 /// and decoding, because the difference between encoders and decoders
42 /// Size of the data *left* to be processed, or LZMA_VLI_VALUE_UNKNOWN
44 lzma_vli uncompressed_size;
46 /// Pointer to filter-specific function, which does
47 /// the actual filtering.
48 size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
49 bool is_encoder, uint8_t *buffer, size_t size);
51 /// Pointer to filter-specific data, or NULL if filter doesn't need
55 /// The lowest 32 bits of the current position in the data. Most
56 /// filters need this to do conversions between absolute and relative
60 /// Size of the memory allocated for the buffer.
63 /// Flushing position in the temporary buffer. buffer[pos] is the
64 /// next byte to be copied to out[].
67 /// buffer[filtered] is the first unfiltered byte. When pos is smaller
68 /// than filtered, there is unflushed filtered data in the buffer.
71 /// Total number of bytes (both filtered and unfiltered) currently
72 /// in the temporary buffer.
80 extern lzma_ret lzma_simple_coder_init(lzma_next_coder *next,
81 lzma_allocator *allocator, const lzma_filter_info *filters,
82 size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
83 bool is_encoder, uint8_t *buffer, size_t size),
84 size_t simple_size, size_t unfiltered_max, bool is_encoder);