mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 20:06:58 -06:00
- using the recommended buffersizes from zstd lib - compile also an codec dll with support for legacy versions
64 lines
1.4 KiB
C++
64 lines
1.4 KiB
C++
// ZstdEncoder.h
|
|
// (C) 2016 Tino Reichardt
|
|
|
|
#define ZSTD_STATIC_LINKING_ONLY
|
|
#include "../../../C/Alloc.h"
|
|
#include "../../../C/ZStd/zstd.h"
|
|
|
|
#include "../../Common/Common.h"
|
|
#include "../../Common/MyCom.h"
|
|
#include "../ICoder.h"
|
|
#include "../Common/StreamUtils.h"
|
|
|
|
#ifndef EXTRACT_ONLY
|
|
namespace NCompress {
|
|
namespace NZSTD {
|
|
|
|
struct CProps
|
|
{
|
|
CProps() { clear (); }
|
|
void clear ()
|
|
{
|
|
memset(this, 0, sizeof (*this));
|
|
_ver_major = ZSTD_VERSION_MAJOR;
|
|
_ver_minor = ZSTD_VERSION_MINOR;
|
|
_level = 3;
|
|
}
|
|
|
|
Byte _ver_major;
|
|
Byte _ver_minor;
|
|
Byte _level;
|
|
Byte _reserved[2];
|
|
};
|
|
|
|
class CEncoder:
|
|
public ICompressCoder,
|
|
public ICompressSetCoderProperties,
|
|
public ICompressWriteCoderProperties,
|
|
public CMyUnknownImp
|
|
{
|
|
CProps _props;
|
|
|
|
ZSTD_CStream *_cstream;
|
|
void *_buffIn;
|
|
void *_buffOut;
|
|
size_t _buffInSize;
|
|
size_t _buffOutSize;
|
|
UInt64 _processedIn;
|
|
UInt64 _processedOut;
|
|
|
|
HRESULT CreateCompressor();
|
|
|
|
public:
|
|
MY_UNKNOWN_IMP2 (ICompressSetCoderProperties, ICompressWriteCoderProperties)
|
|
STDMETHOD (Code) (ISequentialInStream *inStream, ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
|
|
STDMETHOD (SetCoderProperties) (const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
|
|
STDMETHOD (WriteCoderProperties) (ISequentialOutStream *outStream);
|
|
|
|
CEncoder();
|
|
virtual ~CEncoder();
|
|
};
|
|
|
|
}}
|
|
#endif
|