Filter ID mapping to filter-specific functions. More...
#include "filter_encoder.h"
#include "filter_common.h"
#include "lzma_encoder.h"
#include "lzma2_encoder.h"
#include "simple_encoder.h"
#include "delta_encoder.h"
Data Structures | |
struct | lzma_filter_encoder |
Functions | |
static const lzma_filter_encoder * | encoder_find (lzma_vli id) |
lzma_bool | lzma_filter_encoder_is_supported (lzma_vli id) |
Test if the given Filter ID is supported for encoding. | |
lzma_ret | lzma_filters_update (lzma_stream *strm, const lzma_filter *filters) |
Update the filter chain in the encoder. | |
lzma_ret | lzma_raw_encoder_init (lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter *options) |
lzma_ret | lzma_raw_encoder (lzma_stream *strm, const lzma_filter *options) |
Initialize raw encoder. | |
uint64_t | lzma_raw_encoder_memusage (const lzma_filter *filters) |
Calculate approximate memory requirements for raw encoder. | |
lzma_vli | lzma_chunk_size (const lzma_filter *filters) |
lzma_ret | lzma_properties_size (uint32_t *size, const lzma_filter *filter) |
Get the size of the Filter Properties field. | |
lzma_ret | lzma_properties_encode (const lzma_filter *filter, uint8_t *props) |
Encode the Filter Properties field. | |
Variables | |
static const lzma_filter_encoder | encoders [] |
Filter ID mapping to filter-specific functions.
Test if the given Filter ID is supported for encoding.
Return true if the give Filter ID is supported for encoding by this liblzma build. Otherwise false is returned.
There is no way to list which filters are available in this particular liblzma version and build. It would be useless, because the application couldn't know what kind of options the filter would need.
lzma_ret lzma_filters_update | ( | lzma_stream * | strm, | |
const lzma_filter * | filters | |||
) |
Update the filter chain in the encoder.
This function is for advanced users only. This function has two slightly different purposes:
While rarely useful, this function may be called also when no data has been compressed yet. In that case, this function will behave as if LZMA_FULL_FLUSH (Stream encoder) or LZMA_SYNC_FLUSH (Raw or Block encoder) had been used right before calling this function.
References lzma_filter::id, LZMA_FILTERS_MAX, lzma_raw_encoder_memusage(), and LZMA_VLI_UNKNOWN.
lzma_ret lzma_raw_encoder | ( | lzma_stream * | strm, | |
const lzma_filter * | filters | |||
) |
Initialize raw encoder.
This function may be useful when implementing custom file formats.
strm | Pointer to properly prepared lzma_stream | |
filters | Array of lzma_filter structures. The end of the array must be marked with .id = LZMA_VLI_UNKNOWN. |
The `action' with lzma_code() can be LZMA_RUN, LZMA_SYNC_FLUSH (if the filter chain supports it), or LZMA_FINISH.
References lzma_next_strm_init.
Referenced by coder_init().
uint64_t lzma_raw_encoder_memusage | ( | const lzma_filter * | filters | ) |
Calculate approximate memory requirements for raw encoder.
This function can be used to calculate the memory requirements for Block and Stream encoders too because Block and Stream encoders don't need significantly more memory than raw encoder.
filters | Array of filters terminated with .id == LZMA_VLI_UNKNOWN. |
Referenced by lzma_easy_encoder_memusage(), and lzma_filters_update().
lzma_ret lzma_properties_size | ( | uint32_t * | size, | |
const lzma_filter * | filter | |||
) |
Get the size of the Filter Properties field.
This function may be useful when implementing custom file formats using the raw encoder and decoder.
size | Pointer to uint32_t to hold the size of the properties | |
filter | Filter ID and options (the size of the properties may vary depending on the options) |
References LZMA_OPTIONS_ERROR, LZMA_VLI_MAX, and lzma_filter_encoder::props_size_get.
Referenced by lzma_filter_flags_encode(), and lzma_filter_flags_size().
lzma_ret lzma_properties_encode | ( | const lzma_filter * | filter, | |
uint8_t * | props | |||
) |
Encode the Filter Properties field.
filter | Filter ID and options | |
props | Buffer to hold the encoded options. The size of buffer must have been already determined with lzma_properties_size(). |
References lzma_filter_encoder::props_encode.
Referenced by lzma_filter_flags_encode().