Lzma2Enc.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Lzma2Enc.h -- LZMA2 Encoder
  2. 2017-07-27 : Igor Pavlov : Public domain */
  3. #ifndef __LZMA2_ENC_H
  4. #define __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. } CLzma2EncProps;
  17. void Lzma2EncProps_Init(CLzma2EncProps *p);
  18. void Lzma2EncProps_Normalize(CLzma2EncProps *p);
  19. /* ---------- CLzmaEnc2Handle Interface ---------- */
  20. /* Lzma2Enc_* functions can return the following exit codes:
  21. SRes:
  22. SZ_OK - OK
  23. SZ_ERROR_MEM - Memory allocation error
  24. SZ_ERROR_PARAM - Incorrect paramater in props
  25. SZ_ERROR_WRITE - ISeqOutStream write callback error
  26. SZ_ERROR_OUTPUT_EOF - output buffer overflow - version with (Byte *) output
  27. SZ_ERROR_PROGRESS - some break from progress callback
  28. SZ_ERROR_THREAD - error in multithreading functions (only for Mt version)
  29. */
  30. typedef void * CLzma2EncHandle;
  31. CLzma2EncHandle Lzma2Enc_Create(ISzAllocPtr alloc, ISzAllocPtr allocBig);
  32. void Lzma2Enc_Destroy(CLzma2EncHandle p);
  33. SRes Lzma2Enc_SetProps(CLzma2EncHandle p, const CLzma2EncProps *props);
  34. void Lzma2Enc_SetDataSize(CLzma2EncHandle p, UInt64 expectedDataSiize);
  35. Byte Lzma2Enc_WriteProperties(CLzma2EncHandle p);
  36. SRes Lzma2Enc_Encode2(CLzma2EncHandle p,
  37. ISeqOutStream *outStream,
  38. Byte *outBuf, size_t *outBufSize,
  39. ISeqInStream *inStream,
  40. const Byte *inData, size_t inDataSize,
  41. ICompressProgress *progress);
  42. EXTERN_C_END
  43. #endif