Home | History | Annotate | Download | only in 7zip
      1 // ICoder.h
      2 
      3 #ifndef __ICODER_H
      4 #define __ICODER_H
      5 
      6 #include "IStream.h"
      7 
      8 #define CODER_INTERFACE(i, x) DECL_INTERFACE(i, 4, x)
      9 
     10 CODER_INTERFACE(ICompressProgressInfo, 0x04)
     11 {
     12   STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize) PURE;
     13 };
     14 
     15 CODER_INTERFACE(ICompressCoder, 0x05)
     16 {
     17   STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
     18       const UInt64 *inSize, const UInt64 *outSize,
     19       ICompressProgressInfo *progress) PURE;
     20 };
     21 
     22 CODER_INTERFACE(ICompressCoder2, 0x18)
     23 {
     24   STDMETHOD(Code)(ISequentialInStream **inStreams, const UInt64 **inSizes, UInt32 numInStreams,
     25       ISequentialOutStream **outStreams, const UInt64 **outSizes, UInt32 numOutStreams,
     26       ICompressProgressInfo *progress) PURE;
     27 };
     28 
     29 namespace NCoderPropID
     30 {
     31   enum EEnum
     32   {
     33     kDefaultProp = 0,
     34     kDictionarySize,
     35     kUsedMemorySize,
     36     kOrder,
     37     kBlockSize,
     38     kPosStateBits,
     39     kLitContextBits,
     40     kLitPosBits,
     41     kNumFastBytes,
     42     kMatchFinder,
     43     kMatchFinderCycles,
     44     kNumPasses,
     45     kAlgorithm,
     46     kNumThreads,
     47     kEndMarker
     48   };
     49 }
     50 
     51 CODER_INTERFACE(ICompressSetCoderProperties, 0x20)
     52 {
     53   STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps) PURE;
     54 };
     55 
     56 /*
     57 CODER_INTERFACE(ICompressSetCoderProperties, 0x21)
     58 {
     59   STDMETHOD(SetDecoderProperties)(ISequentialInStream *inStream) PURE;
     60 };
     61 */
     62 
     63 CODER_INTERFACE(ICompressSetDecoderProperties2, 0x22)
     64 {
     65   STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size) PURE;
     66 };
     67 
     68 CODER_INTERFACE(ICompressWriteCoderProperties, 0x23)
     69 {
     70   STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream) PURE;
     71 };
     72 
     73 CODER_INTERFACE(ICompressGetInStreamProcessedSize, 0x24)
     74 {
     75   STDMETHOD(GetInStreamProcessedSize)(UInt64 *value) PURE;
     76 };
     77 
     78 CODER_INTERFACE(ICompressSetCoderMt, 0x25)
     79 {
     80   STDMETHOD(SetNumberOfThreads)(UInt32 numThreads) PURE;
     81 };
     82 
     83 CODER_INTERFACE(ICompressGetSubStreamSize, 0x30)
     84 {
     85   STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value) PURE;
     86 };
     87 
     88 CODER_INTERFACE(ICompressSetInStream, 0x31)
     89 {
     90   STDMETHOD(SetInStream)(ISequentialInStream *inStream) PURE;
     91   STDMETHOD(ReleaseInStream)() PURE;
     92 };
     93 
     94 CODER_INTERFACE(ICompressSetOutStream, 0x32)
     95 {
     96   STDMETHOD(SetOutStream)(ISequentialOutStream *outStream) PURE;
     97   STDMETHOD(ReleaseOutStream)() PURE;
     98 };
     99 
    100 CODER_INTERFACE(ICompressSetInStreamSize, 0x33)
    101 {
    102   STDMETHOD(SetInStreamSize)(const UInt64 *inSize) PURE;
    103 };
    104 
    105 CODER_INTERFACE(ICompressSetOutStreamSize, 0x34)
    106 {
    107   STDMETHOD(SetOutStreamSize)(const UInt64 *outSize) PURE;
    108 };
    109 
    110 CODER_INTERFACE(ICompressSetBufSize, 0x35)
    111 {
    112   STDMETHOD(SetInBufSize)(UInt32 streamIndex, UInt32 size) PURE;
    113   STDMETHOD(SetOutBufSize)(UInt32 streamIndex, UInt32 size) PURE;
    114 };
    115 
    116 CODER_INTERFACE(ICompressFilter, 0x40)
    117 {
    118   STDMETHOD(Init)() PURE;
    119   STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size) PURE;
    120   // Filter converts as most as possible bytes
    121   // Filter return outSize (UInt32)
    122   // if (outSize <= size): Filter have converted outSize bytes
    123   // if (outSize > size): Filter have not converted anything.
    124   //      and it needs at least outSize bytes to convert one block
    125   //      (it's for crypto block algorithms).
    126 };
    127 
    128 CODER_INTERFACE(ICompressCodecsInfo, 0x60)
    129 {
    130   STDMETHOD(GetNumberOfMethods)(UInt32 *numMethods) PURE;
    131   STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) PURE;
    132   STDMETHOD(CreateDecoder)(UInt32 index, const GUID *iid, void **coder) PURE;
    133   STDMETHOD(CreateEncoder)(UInt32 index, const GUID *iid, void **coder) PURE;
    134 };
    135 CODER_INTERFACE(ISetCompressCodecsInfo, 0x61)
    136 {
    137   STDMETHOD(SetCompressCodecsInfo)(ICompressCodecsInfo *compressCodecsInfo) PURE;
    138 };
    139 
    140 CODER_INTERFACE(ICryptoProperties, 0x80)
    141 {
    142   STDMETHOD(SetKey)(const Byte *data, UInt32 size) PURE;
    143   STDMETHOD(SetInitVector)(const Byte *data, UInt32 size) PURE;
    144 };
    145 
    146 /*
    147 CODER_INTERFACE(ICryptoResetSalt, 0x88)
    148 {
    149   STDMETHOD(ResetSalt)() PURE;
    150 };
    151 */
    152 
    153 CODER_INTERFACE(ICryptoResetInitVector, 0x8C)
    154 {
    155   STDMETHOD(ResetInitVector)() PURE;
    156 };
    157 
    158 CODER_INTERFACE(ICryptoSetPassword, 0x90)
    159 {
    160   STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size) PURE;
    161 };
    162 
    163 CODER_INTERFACE(ICryptoSetCRC, 0xA0)
    164 {
    165   STDMETHOD(CryptoSetCRC)(UInt32 crc) PURE;
    166 };
    167 
    168 //////////////////////
    169 // It's for DLL file
    170 namespace NMethodPropID
    171 {
    172   enum EEnum
    173   {
    174     kID,
    175     kName,
    176     kDecoder,
    177     kEncoder,
    178     kInStreams,
    179     kOutStreams,
    180     kDescription,
    181     kDecoderIsAssigned,
    182     kEncoderIsAssigned
    183   };
    184 }
    185 
    186 #endif
    187