1 // 7zEncode.h 2 3 #ifndef ZIP7_INC_7Z_ENCODE_H 4 #define ZIP7_INC_7Z_ENCODE_H 5 6 #include "7zCompressionMode.h" 7 8 #include "../Common/CoderMixer2.h" 9 10 #include "7zItem.h" 11 12 namespace NArchive { 13 namespace N7z { 14 15 Z7_CLASS_IMP_COM_1( 16 CMtEncMultiProgress, 17 ICompressProgressInfo 18 ) 19 CMyComPtr<ICompressProgressInfo> _progress; 20 #ifndef Z7_ST 21 NWindows::NSynchronization::CCriticalSection CriticalSection; 22 #endif 23 24 public: 25 UInt64 OutSize; 26 CMtEncMultiProgress()27 CMtEncMultiProgress(): OutSize(0) {} 28 29 void Init(ICompressProgressInfo *progress); 30 AddOutSize(UInt64 addOutSize)31 void AddOutSize(UInt64 addOutSize) 32 { 33 #ifndef Z7_ST 34 NWindows::NSynchronization::CCriticalSectionLock lock(CriticalSection); 35 #endif 36 OutSize += addOutSize; 37 } 38 }; 39 40 41 class CEncoder Z7_final MY_UNCOPYABLE 42 { 43 #ifdef USE_MIXER_ST 44 NCoderMixer2::CMixerST *_mixerST; 45 #endif 46 #ifdef USE_MIXER_MT 47 NCoderMixer2::CMixerMT *_mixerMT; 48 #endif 49 50 NCoderMixer2::CMixer *_mixer; 51 CMyComPtr<IUnknown> _mixerRef; 52 53 CCompressionMethodMode _options; 54 NCoderMixer2::CBindInfo _bindInfo; 55 CRecordVector<CMethodId> _decompressionMethods; 56 57 CRecordVector<UInt32> SrcIn_to_DestOut; 58 CRecordVector<UInt32> SrcOut_to_DestIn; 59 // CRecordVector<UInt32> DestIn_to_SrcOut; 60 CRecordVector<UInt32> DestOut_to_SrcIn; 61 62 void InitBindConv(); 63 void SetFolder(CFolder &folder); 64 65 HRESULT CreateMixerCoder(DECL_EXTERNAL_CODECS_LOC_VARS 66 const UInt64 *inSizeForReduce); 67 68 bool _constructed; 69 public: 70 71 CEncoder(const CCompressionMethodMode &options); 72 ~CEncoder(); 73 HRESULT EncoderConstr(); 74 HRESULT Encode1( 75 DECL_EXTERNAL_CODECS_LOC_VARS 76 ISequentialInStream *inStream, 77 // const UInt64 *inStreamSize, 78 const UInt64 *inSizeForReduce, 79 UInt64 expectedDataSize, 80 CFolder &folderItem, 81 // CRecordVector<UInt64> &coderUnpackSizes, 82 // UInt64 &unpackSize, 83 ISequentialOutStream *outStream, 84 CRecordVector<UInt64> &packSizes, 85 ICompressProgressInfo *compressProgress); 86 87 void Encode_Post( 88 UInt64 unpackSize, 89 CRecordVector<UInt64> &coderUnpackSizes); 90 91 }; 92 93 }} 94 95 #endif 96