1370b324cSopenharmony_ci// 7zEncode.h
2370b324cSopenharmony_ci
3370b324cSopenharmony_ci#ifndef ZIP7_INC_7Z_ENCODE_H
4370b324cSopenharmony_ci#define ZIP7_INC_7Z_ENCODE_H
5370b324cSopenharmony_ci
6370b324cSopenharmony_ci#include "7zCompressionMode.h"
7370b324cSopenharmony_ci
8370b324cSopenharmony_ci#include "../Common/CoderMixer2.h"
9370b324cSopenharmony_ci
10370b324cSopenharmony_ci#include "7zItem.h"
11370b324cSopenharmony_ci
12370b324cSopenharmony_cinamespace NArchive {
13370b324cSopenharmony_cinamespace N7z {
14370b324cSopenharmony_ci
15370b324cSopenharmony_ciZ7_CLASS_IMP_COM_1(
16370b324cSopenharmony_ci  CMtEncMultiProgress,
17370b324cSopenharmony_ci  ICompressProgressInfo
18370b324cSopenharmony_ci)
19370b324cSopenharmony_ci  CMyComPtr<ICompressProgressInfo> _progress;
20370b324cSopenharmony_ci  #ifndef Z7_ST
21370b324cSopenharmony_ci  NWindows::NSynchronization::CCriticalSection CriticalSection;
22370b324cSopenharmony_ci  #endif
23370b324cSopenharmony_ci
24370b324cSopenharmony_cipublic:
25370b324cSopenharmony_ci  UInt64 OutSize;
26370b324cSopenharmony_ci
27370b324cSopenharmony_ci  CMtEncMultiProgress(): OutSize(0) {}
28370b324cSopenharmony_ci
29370b324cSopenharmony_ci  void Init(ICompressProgressInfo *progress);
30370b324cSopenharmony_ci
31370b324cSopenharmony_ci  void AddOutSize(UInt64 addOutSize)
32370b324cSopenharmony_ci  {
33370b324cSopenharmony_ci    #ifndef Z7_ST
34370b324cSopenharmony_ci    NWindows::NSynchronization::CCriticalSectionLock lock(CriticalSection);
35370b324cSopenharmony_ci    #endif
36370b324cSopenharmony_ci    OutSize += addOutSize;
37370b324cSopenharmony_ci  }
38370b324cSopenharmony_ci};
39370b324cSopenharmony_ci
40370b324cSopenharmony_ci
41370b324cSopenharmony_ciclass CEncoder Z7_final MY_UNCOPYABLE
42370b324cSopenharmony_ci{
43370b324cSopenharmony_ci  #ifdef USE_MIXER_ST
44370b324cSopenharmony_ci    NCoderMixer2::CMixerST *_mixerST;
45370b324cSopenharmony_ci  #endif
46370b324cSopenharmony_ci  #ifdef USE_MIXER_MT
47370b324cSopenharmony_ci    NCoderMixer2::CMixerMT *_mixerMT;
48370b324cSopenharmony_ci  #endif
49370b324cSopenharmony_ci
50370b324cSopenharmony_ci  NCoderMixer2::CMixer *_mixer;
51370b324cSopenharmony_ci  CMyComPtr<IUnknown> _mixerRef;
52370b324cSopenharmony_ci
53370b324cSopenharmony_ci  CCompressionMethodMode _options;
54370b324cSopenharmony_ci  NCoderMixer2::CBindInfo _bindInfo;
55370b324cSopenharmony_ci  CRecordVector<CMethodId> _decompressionMethods;
56370b324cSopenharmony_ci
57370b324cSopenharmony_ci  CRecordVector<UInt32> SrcIn_to_DestOut;
58370b324cSopenharmony_ci  CRecordVector<UInt32> SrcOut_to_DestIn;
59370b324cSopenharmony_ci  // CRecordVector<UInt32> DestIn_to_SrcOut;
60370b324cSopenharmony_ci  CRecordVector<UInt32> DestOut_to_SrcIn;
61370b324cSopenharmony_ci
62370b324cSopenharmony_ci  void InitBindConv();
63370b324cSopenharmony_ci  void SetFolder(CFolder &folder);
64370b324cSopenharmony_ci
65370b324cSopenharmony_ci  HRESULT CreateMixerCoder(DECL_EXTERNAL_CODECS_LOC_VARS
66370b324cSopenharmony_ci      const UInt64 *inSizeForReduce);
67370b324cSopenharmony_ci
68370b324cSopenharmony_ci  bool _constructed;
69370b324cSopenharmony_cipublic:
70370b324cSopenharmony_ci
71370b324cSopenharmony_ci  CEncoder(const CCompressionMethodMode &options);
72370b324cSopenharmony_ci  ~CEncoder();
73370b324cSopenharmony_ci  HRESULT EncoderConstr();
74370b324cSopenharmony_ci  HRESULT Encode1(
75370b324cSopenharmony_ci      DECL_EXTERNAL_CODECS_LOC_VARS
76370b324cSopenharmony_ci      ISequentialInStream *inStream,
77370b324cSopenharmony_ci      // const UInt64 *inStreamSize,
78370b324cSopenharmony_ci      const UInt64 *inSizeForReduce,
79370b324cSopenharmony_ci      UInt64 expectedDataSize,
80370b324cSopenharmony_ci      CFolder &folderItem,
81370b324cSopenharmony_ci      // CRecordVector<UInt64> &coderUnpackSizes,
82370b324cSopenharmony_ci      // UInt64 &unpackSize,
83370b324cSopenharmony_ci      ISequentialOutStream *outStream,
84370b324cSopenharmony_ci      CRecordVector<UInt64> &packSizes,
85370b324cSopenharmony_ci      ICompressProgressInfo *compressProgress);
86370b324cSopenharmony_ci
87370b324cSopenharmony_ci  void Encode_Post(
88370b324cSopenharmony_ci      UInt64 unpackSize,
89370b324cSopenharmony_ci      CRecordVector<UInt64> &coderUnpackSizes);
90370b324cSopenharmony_ci
91370b324cSopenharmony_ci};
92370b324cSopenharmony_ci
93370b324cSopenharmony_ci}}
94370b324cSopenharmony_ci
95370b324cSopenharmony_ci#endif
96