TSDuck v3.46-4930
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches

#include <tsZlib.h>

Static Public Member Functions

static bool Compress (ByteBlock &out, const ByteBlock &in, int level, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
static bool Compress (ByteBlock &out, const void *in, size_t in_size, int level, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
static bool CompressAppend (ByteBlock &out, const ByteBlock &in, int level, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
static bool CompressAppend (ByteBlock &out, const void *in, size_t in_size, int level, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
static bool Decompress (ByteBlock &out, const ByteBlock &in, size_t out_size=NPOS, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
static bool Decompress (ByteBlock &out, const void *in, size_t in_size, size_t out_size=NPOS, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
static bool DecompressAppend (ByteBlock &out, const ByteBlock &in, size_t out_size=NPOS, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
static bool DecompressAppend (ByteBlock &out, const void *in, size_t in_size, size_t out_size=NPOS, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
static bool DefaultSdefl ()
static UString GetLibraryVersion ()
static bool SdeflSupported ()

Detailed Description

Implementation of RFC 1951 data compression, a.k.a. zlib format, a.k.a. DEFLATE.

This interface is a proxy to the zlib library on UNIX systems (Linux, macOS, BSD). On Windows systems, the source code of TSDuck embeds the header-only implementation called "Small Deflate" or "sdefl". The sdefl implementation is also used when the macro TS_NO_ZLIB is defined on any system.

See also
RFC 1950 ZLIB Compressed Data Format Specification version 3.3
RFC 1951 DEFLATE Compressed Data Format Specification version 1.3
https://www.zlib.net
https://github.com/vurtun/lib

Member Function Documentation

◆ GetLibraryVersion()

UString ts::Zlib::GetLibraryVersion ( )
static

Get the Zlib library version.

Returns
The Zlib library version.

◆ DefaultSdefl()

bool ts::Zlib::DefaultSdefl ( )
static

Check if "Small Deflate" or "sdefl" is the default compression library.

Returns
True if "Small Deflate" is the default, false if "zlib" is available and the default.

◆ SdeflSupported()

bool ts::Zlib::SdeflSupported ( )
static

Check if "Small Deflate" or "sdefl" is supported.

Returns
True if "Small Deflate" is supported, false if "zlib" is the only available option.

◆ Compress() [1/2]

bool ts::Zlib::Compress ( ByteBlock & out,
const void * in,
size_t in_size,
int level,
Report & report = (ts::NullReport::Instance()),
bool use_sdefl = false )
inlinestatic

Compress data according to the DEFLATE algorithm.

Parameters
[out]outOutput compressed data.
[in]inAddress of input data.
[in]in_sizeSize in bytes of input data.
[in]levelRequested compression level, from 0 to 9.
[in,out]reportWhere to report errors.
[in]use_sdeflIf true, force the usage of "sdefl" library. By default, use "zlib" on UNIX systems and "sdefl" on Windows.
Returns
True on success, false on error.

◆ Compress() [2/2]

bool ts::Zlib::Compress ( ByteBlock & out,
const ByteBlock & in,
int level,
Report & report = (ts::NullReport::Instance()),
bool use_sdefl = false )
inlinestatic

Compress data according to the DEFLATE algorithm.

Parameters
[out]outOutput compressed data.
[in]inInput data.
[in]levelRequested compression level, from 0 to 9.
[in,out]reportWhere to report errors.
[in]use_sdeflIf true, force the usage of "sdefl" library. By default, use "zlib" on UNIX systems and "sdefl" on Windows.
Returns
True on success, false on error.

◆ CompressAppend() [1/2]

bool ts::Zlib::CompressAppend ( ByteBlock & out,
const void * in,
size_t in_size,
int level,
Report & report = (ts::NullReport::Instance()),
bool use_sdefl = false )
static

Compress data according to the DEFLATE algorithm.

Parameters
[in,out]outOutput compressed data are appended at the end of the existing content.
[in]inAddress of input data.
[in]in_sizeSize in bytes of input data.
[in]levelRequested compression level, from 0 to 9.
[in,out]reportWhere to report errors.
[in]use_sdeflIf true, force the usage of "sdefl" library. By default, use "zlib" on UNIX systems and "sdefl" on Windows.
Returns
True on success, false on error.

◆ CompressAppend() [2/2]

bool ts::Zlib::CompressAppend ( ByteBlock & out,
const ByteBlock & in,
int level,
Report & report = (ts::NullReport::Instance()),
bool use_sdefl = false )
inlinestatic

Compress data according to the DEFLATE algorithm.

Parameters
[in,out]outOutput compressed data are appended at the end of the existing content.
[in]inInput data.
[in]levelRequested compression level, from 0 to 9.
[in,out]reportWhere to report errors.
[in]use_sdeflIf true, force the usage of "sdefl" library. By default, use "zlib" on UNIX systems and "sdefl" on Windows.
Returns
True on success, false on error.

◆ Decompress() [1/2]

bool ts::Zlib::Decompress ( ByteBlock & out,
const void * in,
size_t in_size,
size_t out_size = NPOS,
Report & report = (ts::NullReport::Instance()),
bool use_sdefl = false )
inlinestatic

Decompress data according to the DEFLATE algorithm.

Parameters
[out]outOutput decompressed data.
[in]inAddress of input data.
[in]in_sizeSize in bytes of input data.
[in]out_sizeExpected size of decompressed output data if known. Use NPOS (the default) if unknown.
[in,out]reportWhere to report errors.
[in]use_sdeflIf true, force the usage of "sdefl" library. By default, use "zlib" on UNIX systems and "sdefl" on Windows.
Returns
True on success, false on error.

◆ Decompress() [2/2]

bool ts::Zlib::Decompress ( ByteBlock & out,
const ByteBlock & in,
size_t out_size = NPOS,
Report & report = (ts::NullReport::Instance()),
bool use_sdefl = false )
inlinestatic

Decompress data according to the DEFLATE algorithm.

Parameters
[out]outOutput decompressed data.
[in]inInput data.
[in]out_sizeExpected size of decompressed output data if known. Use NPOS (the default) if unknown.
[in,out]reportWhere to report errors.
[in]use_sdeflIf true, force the usage of "sdefl" library. By default, use "zlib" on UNIX systems and "sdefl" on Windows.
Returns
True on success, false on error.

◆ DecompressAppend() [1/2]

bool ts::Zlib::DecompressAppend ( ByteBlock & out,
const void * in,
size_t in_size,
size_t out_size = NPOS,
Report & report = (ts::NullReport::Instance()),
bool use_sdefl = false )
static

Decompress data according to the DEFLATE algorithm.

Parameters
[out]outOutput decompressed data are appended at the end of the existing content.
[in]inAddress of input data.
[in]in_sizeSize in bytes of input data.
[in]out_sizeExpected size of decompressed output data if known. Use NPOS (the default) if unknown.
[in,out]reportWhere to report errors.
[in]use_sdeflIf true, force the usage of "sdefl" library. By default, use "zlib" on UNIX systems and "sdefl" on Windows.
Returns
True on success, false on error.

◆ DecompressAppend() [2/2]

bool ts::Zlib::DecompressAppend ( ByteBlock & out,
const ByteBlock & in,
size_t out_size = NPOS,
Report & report = (ts::NullReport::Instance()),
bool use_sdefl = false )
inlinestatic

Decompress data according to the DEFLATE algorithm.

Parameters
[out]outOutput decompressed data are appended at the end of the existing content.
[in]inInput data.
[in]out_sizeExpected size of decompressed output data if known. Use NPOS (the default) if unknown.
[in,out]reportWhere to report errors.
[in]use_sdeflIf true, force the usage of "sdefl" library. By default, use "zlib" on UNIX systems and "sdefl" on Windows.
Returns
True on success, false on error.

The documentation for this class was generated from the following file: