xref: /freebsd/contrib/xz/src/liblzma/lzma/lzma_encoder.h (revision 98e0ffaefb0f241cda3a72395d3be04192ae0d47)
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file       lzma_encoder.h
4 /// \brief      LZMA encoder API
5 ///
6 //  Authors:    Igor Pavlov
7 //              Lasse Collin
8 //
9 //  This file has been put into the public domain.
10 //  You can do whatever you want with this file.
11 //
12 ///////////////////////////////////////////////////////////////////////////////
13 
14 #ifndef LZMA_LZMA_ENCODER_H
15 #define LZMA_LZMA_ENCODER_H
16 
17 #include "common.h"
18 
19 
20 extern lzma_ret lzma_lzma_encoder_init(lzma_next_coder *next,
21 		const lzma_allocator *allocator,
22 		const lzma_filter_info *filters);
23 
24 
25 extern uint64_t lzma_lzma_encoder_memusage(const void *options);
26 
27 extern lzma_ret lzma_lzma_props_encode(const void *options, uint8_t *out);
28 
29 
30 /// Encodes lc/lp/pb into one byte. Returns false on success and true on error.
31 extern bool lzma_lzma_lclppb_encode(
32 		const lzma_options_lzma *options, uint8_t *byte);
33 
34 
35 #ifdef LZMA_LZ_ENCODER_H
36 
37 /// Initializes raw LZMA encoder; this is used by LZMA2.
38 extern lzma_ret lzma_lzma_encoder_create(
39 		lzma_coder **coder_ptr, const lzma_allocator *allocator,
40 		const lzma_options_lzma *options, lzma_lz_options *lz_options);
41 
42 
43 /// Resets an already initialized LZMA encoder; this is used by LZMA2.
44 extern lzma_ret lzma_lzma_encoder_reset(
45 		lzma_coder *coder, const lzma_options_lzma *options);
46 
47 
48 extern lzma_ret lzma_lzma_encode(lzma_coder *restrict coder,
49 		lzma_mf *restrict mf, uint8_t *restrict out,
50 		size_t *restrict out_pos, size_t out_size,
51 		uint32_t read_limit);
52 
53 #endif
54 
55 #endif
56