TSDuck v3.41-4217
MPEG Transport Stream Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages Concepts

Implementation of RFC 1951 data compression, a.k.a. More...

#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)
 Compress data according to the DEFLATE algorithm.
 
static bool Compress (ByteBlock &out, const void *in, size_t in_size, int level, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
 Compress data according to the DEFLATE algorithm.
 
static bool CompressAppend (ByteBlock &out, const ByteBlock &in, int level, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
 Compress data according to the DEFLATE algorithm.
 
static bool CompressAppend (ByteBlock &out, const void *in, size_t in_size, int level, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
 Compress data according to the DEFLATE algorithm.
 
static bool Decompress (ByteBlock &out, const ByteBlock &in, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
 Decompress data according to the DEFLATE algorithm.
 
static bool Decompress (ByteBlock &out, const void *in, size_t in_size, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
 Decompress data according to the DEFLATE algorithm.
 
static bool DecompressAppend (ByteBlock &out, const ByteBlock &in, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
 Decompress data according to the DEFLATE algorithm.
 
static bool DecompressAppend (ByteBlock &out, const void *in, size_t in_size, Report &report=(ts::NullReport::Instance()), bool use_sdefl=false)
 Decompress data according to the DEFLATE algorithm.
 
static bool DefaultSdefl ()
 Check if "Small Deflate" or "sdefl" is the default compression library.
 
static UString GetLibraryVersion ()
 Get the Zlib library version.
 

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()

static UString ts::Zlib::GetLibraryVersion ( )
static

Get the Zlib library version.

Returns
The Zlib library version.

◆ DefaultSdefl()

static 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.

◆ Compress() [1/2]

static 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]

static 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]

static 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]

static 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]

static bool ts::Zlib::Decompress ( ByteBlock out,
const void *  in,
size_t  in_size,
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]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]

static bool ts::Zlib::Decompress ( ByteBlock out,
const ByteBlock in,
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]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]

static bool ts::Zlib::DecompressAppend ( ByteBlock out,
const void *  in,
size_t  in_size,
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]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]

static bool ts::Zlib::DecompressAppend ( ByteBlock out,
const ByteBlock in,
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]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: