1 // Lzma2Decoder.h 2 3 #ifndef __LZMA2_DECODER_H 4 #define __LZMA2_DECODER_H 5 6 #include "../../../C/Lzma2DecMt.h" 7 8 #include "../Common/CWrappers.h" 9 10 namespace NCompress { 11 namespace NLzma2 { 12 13 class CDecoder: 14 public ICompressCoder, 15 public ICompressSetDecoderProperties2, 16 public ICompressSetFinishMode, 17 public ICompressGetInStreamProcessedSize, 18 public ICompressSetBufSize, 19 20 #ifndef NO_READ_FROM_CODER 21 public ICompressSetInStream, 22 public ICompressSetOutStreamSize, 23 public ISequentialInStream, 24 #endif 25 26 #ifndef _7ZIP_ST 27 public ICompressSetCoderMt, 28 public ICompressSetMemLimit, 29 #endif 30 31 public CMyUnknownImp 32 { 33 CLzma2DecMtHandle _dec; 34 UInt64 _inProcessed; 35 Byte _prop; 36 int _finishMode; 37 UInt32 _inBufSize; 38 UInt32 _outStep; 39 40 public: 41 MY_QUERYINTERFACE_BEGIN2(ICompressCoder) 42 MY_QUERYINTERFACE_ENTRY(ICompressSetDecoderProperties2) 43 MY_QUERYINTERFACE_ENTRY(ICompressSetFinishMode) 44 MY_QUERYINTERFACE_ENTRY(ICompressGetInStreamProcessedSize) 45 MY_QUERYINTERFACE_ENTRY(ICompressSetBufSize) 46 47 #ifndef NO_READ_FROM_CODER 48 MY_QUERYINTERFACE_ENTRY(ICompressSetInStream) 49 MY_QUERYINTERFACE_ENTRY(ICompressSetOutStreamSize) 50 MY_QUERYINTERFACE_ENTRY(ISequentialInStream) 51 #endif 52 53 #ifndef _7ZIP_ST 54 MY_QUERYINTERFACE_ENTRY(ICompressSetCoderMt) 55 MY_QUERYINTERFACE_ENTRY(ICompressSetMemLimit) 56 #endif 57 58 MY_QUERYINTERFACE_END 59 MY_ADDREF_RELEASE 60 61 STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, 62 const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress); 63 STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size); 64 STDMETHOD(SetFinishMode)(UInt32 finishMode); 65 STDMETHOD(GetInStreamProcessedSize)(UInt64 *value); 66 STDMETHOD(SetInBufSize)(UInt32 streamIndex, UInt32 size); 67 STDMETHOD(SetOutBufSize)(UInt32 streamIndex, UInt32 size); 68 69 #ifndef _7ZIP_ST 70 private: 71 int _tryMt; 72 UInt32 _numThreads; 73 UInt64 _memUsage; 74 public: 75 STDMETHOD(SetNumberOfThreads)(UInt32 numThreads); 76 STDMETHOD(SetMemLimit)(UInt64 memUsage); 77 #endif 78 79 #ifndef NO_READ_FROM_CODER 80 private: 81 CMyComPtr<ISequentialInStream> _inStream; 82 CSeqInStreamWrap _inWrap; 83 public: 84 STDMETHOD(SetOutStreamSize)(const UInt64 *outSize); 85 STDMETHOD(SetInStream)(ISequentialInStream *inStream); 86 STDMETHOD(ReleaseInStream)(); 87 STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); 88 #endif 89 90 CDecoder(); 91 virtual ~CDecoder(); 92 }; 93 94 }} 95 96 #endif 97