| 1 | /* LzmaEnc.h -- LZMA Encoder\r |
| 2 | 2013-01-18 : Igor Pavlov : Public domain */\r |
| 3 | \r |
| 4 | #ifndef __LZMA_ENC_H\r |
| 5 | #define __LZMA_ENC_H\r |
| 6 | \r |
| 7 | #include "7zTypes.h"\r |
| 8 | \r |
| 9 | EXTERN_C_BEGIN\r |
| 10 | \r |
| 11 | #define LZMA_PROPS_SIZE 5\r |
| 12 | \r |
| 13 | typedef struct _CLzmaEncProps\r |
| 14 | {\r |
| 15 | int level; /* 0 <= level <= 9 */\r |
| 16 | UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version\r |
| 17 | (1 << 12) <= dictSize <= (1 << 30) for 64-bit version\r |
| 18 | default = (1 << 24) */\r |
| 19 | UInt64 reduceSize; /* estimated size of data that will be compressed. default = 0xFFFFFFFF.\r |
| 20 | Encoder uses this value to reduce dictionary size */\r |
| 21 | int lc; /* 0 <= lc <= 8, default = 3 */\r |
| 22 | int lp; /* 0 <= lp <= 4, default = 0 */\r |
| 23 | int pb; /* 0 <= pb <= 4, default = 2 */\r |
| 24 | int algo; /* 0 - fast, 1 - normal, default = 1 */\r |
| 25 | int fb; /* 5 <= fb <= 273, default = 32 */\r |
| 26 | int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */\r |
| 27 | int numHashBytes; /* 2, 3 or 4, default = 4 */\r |
| 28 | UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */\r |
| 29 | unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */\r |
| 30 | int numThreads; /* 1 or 2, default = 2 */\r |
| 31 | } CLzmaEncProps;\r |
| 32 | \r |
| 33 | void LzmaEncProps_Init(CLzmaEncProps *p);\r |
| 34 | void LzmaEncProps_Normalize(CLzmaEncProps *p);\r |
| 35 | UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);\r |
| 36 | \r |
| 37 | \r |
| 38 | /* ---------- CLzmaEncHandle Interface ---------- */\r |
| 39 | \r |
| 40 | /* LzmaEnc_* functions can return the following exit codes:\r |
| 41 | Returns:\r |
| 42 | SZ_OK - OK\r |
| 43 | SZ_ERROR_MEM - Memory allocation error\r |
| 44 | SZ_ERROR_PARAM - Incorrect paramater in props\r |
| 45 | SZ_ERROR_WRITE - Write callback error.\r |
| 46 | SZ_ERROR_PROGRESS - some break from progress callback\r |
| 47 | SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)\r |
| 48 | */\r |
| 49 | \r |
| 50 | typedef void * CLzmaEncHandle;\r |
| 51 | \r |
| 52 | CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc);\r |
| 53 | void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);\r |
| 54 | SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);\r |
| 55 | SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);\r |
| 56 | SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,\r |
| 57 | ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);\r |
| 58 | SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,\r |
| 59 | int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);\r |
| 60 | \r |
| 61 | /* ---------- One Call Interface ---------- */\r |
| 62 | \r |
| 63 | /* LzmaEncode\r |
| 64 | Return code:\r |
| 65 | SZ_OK - OK\r |
| 66 | SZ_ERROR_MEM - Memory allocation error\r |
| 67 | SZ_ERROR_PARAM - Incorrect paramater\r |
| 68 | SZ_ERROR_OUTPUT_EOF - output buffer overflow\r |
| 69 | SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)\r |
| 70 | */\r |
| 71 | \r |
| 72 | SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,\r |
| 73 | const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,\r |
| 74 | ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);\r |
| 75 | \r |
| 76 | EXTERN_C_END\r |
| 77 | \r |
| 78 | #endif\r |