Lzma2Enc.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Lzma2Enc.h -- LZMA2 Encoder
  2. 2023-04-13 : Igor Pavlov : Public domain */
  3. #ifndef ZIP7_INC_LZMA2_ENC_H
  4. #define ZIP7_INC_LZMA2_ENC_H
  5. #include "LzmaEnc.h"
  6. EXTERN_C_BEGIN
  7. #define LZMA2_ENC_PROPS_BLOCK_SIZE_AUTO 0
  8. #define LZMA2_ENC_PROPS_BLOCK_SIZE_SOLID ((UInt64)(Int64)-1)
  9. typedef struct
  10. {
  11. CLzmaEncProps lzmaProps;
  12. UInt64 blockSize;
  13. int numBlockThreads_Reduced;
  14. int numBlockThreads_Max;
  15. int numTotalThreads;
  16. unsigned numThreadGroups; // 0 : no groups
  17. } CLzma2EncProps;
  18. void Lzma2EncProps_Init(CLzma2EncProps *p);
  19. void Lzma2EncProps_Normalize(CLzma2EncProps *p);
  20. /* ---------- CLzmaEnc2Handle Interface ---------- */
  21. /* Lzma2Enc_* functions can return the following exit codes:
  22. SRes:
  23. SZ_OK - OK
  24. SZ_ERROR_MEM - Memory allocation error
  25. SZ_ERROR_PARAM - Incorrect paramater in props
  26. SZ_ERROR_WRITE - ISeqOutStream write callback error
  27. SZ_ERROR_OUTPUT_EOF - output buffer overflow - version with (Byte *) output
  28. SZ_ERROR_PROGRESS - some break from progress callback
  29. SZ_ERROR_THREAD - error in multithreading functions (only for Mt version)
  30. */
  31. typedef struct CLzma2Enc CLzma2Enc;
  32. typedef CLzma2Enc * CLzma2EncHandle;
  33. // Z7_DECLARE_HANDLE(CLzma2EncHandle)
  34. CLzma2EncHandle Lzma2Enc_Create(ISzAllocPtr alloc, ISzAllocPtr allocBig);
  35. void Lzma2Enc_Destroy(CLzma2EncHandle p);
  36. SRes Lzma2Enc_SetProps(CLzma2EncHandle p, const CLzma2EncProps *props);
  37. void Lzma2Enc_SetDataSize(CLzma2EncHandle p, UInt64 expectedDataSiize);
  38. Byte Lzma2Enc_WriteProperties(CLzma2EncHandle p);
  39. SRes Lzma2Enc_Encode2(CLzma2EncHandle p,
  40. ISeqOutStreamPtr outStream,
  41. Byte *outBuf, size_t *outBufSize,
  42. ISeqInStreamPtr inStream,
  43. const Byte *inData, size_t inDataSize,
  44. ICompressProgressPtr progress);
  45. EXTERN_C_END
  46. #endif