src/third-party/lzma/Lzma2DecMt.h (view raw)
1/* Lzma2DecMt.h -- LZMA2 Decoder Multi-thread
22018-02-17 : Igor Pavlov : Public domain */
3
4#ifndef __LZMA2_DEC_MT_H
5#define __LZMA2_DEC_MT_H
6
7#include "7zTypes.h"
8
9EXTERN_C_BEGIN
10
11typedef struct
12{
13 size_t inBufSize_ST;
14 size_t outStep_ST;
15
16 #ifndef _7ZIP_ST
17 unsigned numThreads;
18 size_t inBufSize_MT;
19 size_t outBlockMax;
20 size_t inBlockMax;
21 #endif
22} CLzma2DecMtProps;
23
24/* init to single-thread mode */
25void Lzma2DecMtProps_Init(CLzma2DecMtProps *p);
26
27
28/* ---------- CLzma2DecMtHandle Interface ---------- */
29
30/* Lzma2DecMt_ * functions can return the following exit codes:
31SRes:
32 SZ_OK - OK
33 SZ_ERROR_MEM - Memory allocation error
34 SZ_ERROR_PARAM - Incorrect paramater in props
35 SZ_ERROR_WRITE - ISeqOutStream write callback error
36 // SZ_ERROR_OUTPUT_EOF - output buffer overflow - version with (Byte *) output
37 SZ_ERROR_PROGRESS - some break from progress callback
38 SZ_ERROR_THREAD - error in multithreading functions (only for Mt version)
39*/
40
41typedef void * CLzma2DecMtHandle;
42
43CLzma2DecMtHandle Lzma2DecMt_Create(ISzAllocPtr alloc, ISzAllocPtr allocMid);
44void Lzma2DecMt_Destroy(CLzma2DecMtHandle p);
45
46SRes Lzma2DecMt_Decode(CLzma2DecMtHandle p,
47 Byte prop,
48 const CLzma2DecMtProps *props,
49 ISeqOutStream *outStream,
50 const UInt64 *outDataSize, // NULL means undefined
51 int finishMode, // 0 - partial unpacking is allowed, 1 - if lzma2 stream must be finished
52 // Byte *outBuf, size_t *outBufSize,
53 ISeqInStream *inStream,
54 // const Byte *inData, size_t inDataSize,
55
56 // out variables:
57 UInt64 *inProcessed,
58 int *isMT, /* out: (*isMT == 0), if single thread decoding was used */
59
60 // UInt64 *outProcessed,
61 ICompressProgress *progress);
62
63
64/* ---------- Read from CLzma2DecMtHandle Interface ---------- */
65
66SRes Lzma2DecMt_Init(CLzma2DecMtHandle pp,
67 Byte prop,
68 const CLzma2DecMtProps *props,
69 const UInt64 *outDataSize, int finishMode,
70 ISeqInStream *inStream);
71
72SRes Lzma2DecMt_Read(CLzma2DecMtHandle pp,
73 Byte *data, size_t *outSize,
74 UInt64 *inStreamProcessed);
75
76
77EXTERN_C_END
78
79#endif