1 /* Lzma2Enc.h -- LZMA2 Encoder 2 2013-01-18 : Igor Pavlov : Public domain */ 3 4 #ifndef __LZMA2_ENC_H 5 #define __LZMA2_ENC_H 6 7 #include "LzmaEnc.h" 8 9 EXTERN_C_BEGIN 10 11 typedef struct 12 { 13 CLzmaEncProps lzmaProps; 14 size_t blockSize; 15 int numBlockThreads; 16 int numTotalThreads; 17 } CLzma2EncProps; 18 19 void Lzma2EncProps_Init(CLzma2EncProps *p); 20 void Lzma2EncProps_Normalize(CLzma2EncProps *p); 21 22 /* ---------- CLzmaEnc2Handle Interface ---------- */ 23 24 /* Lzma2Enc_* functions can return the following exit codes: 25 Returns: 26 SZ_OK - OK 27 SZ_ERROR_MEM - Memory allocation error 28 SZ_ERROR_PARAM - Incorrect paramater in props 29 SZ_ERROR_WRITE - Write callback error 30 SZ_ERROR_PROGRESS - some break from progress callback 31 SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) 32 */ 33 34 typedef void * CLzma2EncHandle; 35 36 CLzma2EncHandle Lzma2Enc_Create(ISzAlloc *alloc, ISzAlloc *allocBig); 37 void Lzma2Enc_Destroy(CLzma2EncHandle p); 38 SRes Lzma2Enc_SetProps(CLzma2EncHandle p, const CLzma2EncProps *props); 39 Byte Lzma2Enc_WriteProperties(CLzma2EncHandle p); 40 SRes Lzma2Enc_Encode(CLzma2EncHandle p, 41 ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress); 42 43 /* ---------- One Call Interface ---------- */ 44 45 /* Lzma2Encode 46 Return code: 47 SZ_OK - OK 48 SZ_ERROR_MEM - Memory allocation error 49 SZ_ERROR_PARAM - Incorrect paramater 50 SZ_ERROR_OUTPUT_EOF - output buffer overflow 51 SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) 52 */ 53 54 /* 55 SRes Lzma2Encode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, 56 const CLzmaEncProps *props, Byte *propsEncoded, int writeEndMark, 57 ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); 58 */ 59 60 EXTERN_C_END 61 62 #endif 63