AV module

Codec

[Codec]({#ref structicy_1_1av_1_1Codec #}) for encoding/decoding media.

Codec

#include <icy/av/codec.h>

Subclassed by: AudioCodec, VideoCodec

Codec for encoding/decoding media.

Public Attributes

ReturnNameDescription
std::stringnameThe display name for this codec.
std::stringencoderThe encoder name for FFmpeg.
intsampleRateThe sampling rate or RTP clock rate.
intbitRateThe bit rate to encode at.
intqualityOptional quality value, variable range depending on codec.
intcomplianceFFmpeg strict_std_compliance level (default: FF_COMPLIANCE_EXPERIMENTAL).
boolenabledWeather or not the codec is available for use.
std::map< std::string, std::string >optionsArbitrary encoder options passed to FFmpeg via av_opt_set(). Keys are FFmpeg option names (e.g. "preset", "tune", "profile"). Applied after codec-specific defaults, so they override everything.

name

std::string name

The display name for this codec.


encoder

std::string encoder

The encoder name for FFmpeg.


sampleRate

int sampleRate

The sampling rate or RTP clock rate.


bitRate

int bitRate

The bit rate to encode at.


quality

int quality

Optional quality value, variable range depending on codec.


compliance

int compliance

FFmpeg strict_std_compliance level (default: FF_COMPLIANCE_EXPERIMENTAL).


enabled

bool enabled

Weather or not the codec is available for use.


options

std::map< std::string, std::string > options

Arbitrary encoder options passed to FFmpeg via av_opt_set(). Keys are FFmpeg option names (e.g. "preset", "tune", "profile"). Applied after codec-specific defaults, so they override everything.

Public Methods

ReturnNameDescription
CodecConstruct a disabled codec with zeroed parameters.
CodecConstruct a codec with a display name, sample rate, bit rate, and enabled flag.
CodecConstruct a codec with an explicit FFmpeg encoder name.
~Codec virtualCodec(const Codec& r);.
std::stringtoString virtual constReturn a compact string representation of this codec.
boolspecified constReturns true when this codec explicitly names either an RTP/media codec or an FFmpeg encoder and is enabled for use.
voidprint virtualPrint a multi-line human-readable description to the given stream.

Codec

Codec()

Construct a disabled codec with zeroed parameters.


Codec

Codec(const std::string & name, int sampleRate, int bitRate, bool enabled)

Construct a codec with a display name, sample rate, bit rate, and enabled flag.

Parameters

  • name The codec display name.

  • sampleRate The sampling rate or RTP clock rate in Hz.

  • bitRate The target bit rate in bits per second.

  • enabled Whether the codec is available for use.


Codec

Codec(const std::string & name, const std::string & encoder, int sampleRate, int bitRate, bool enabled)

Construct a codec with an explicit FFmpeg encoder name.

Parameters

  • name The codec display name.

  • encoder The FFmpeg encoder name (e.g. "libx264").

  • sampleRate The sampling rate or RTP clock rate in Hz.

  • bitRate The target bit rate in bits per second.

  • enabled Whether the codec is available for use.


~Codec

virtual

virtual ~Codec() noexcept

Codec(const Codec& r);.


toString

virtual const

virtual std::string toString() const

Return a compact string representation of this codec.

Returns

A string in the form "Codec[name:encoder:sampleRate:enabled]".


specified

const

bool specified() const

Returns true when this codec explicitly names either an RTP/media codec or an FFmpeg encoder and is enabled for use.


print

virtual

virtual void print(std::ostream & ost)

Print a multi-line human-readable description to the given stream.

Parameters

  • ost The output stream to write to.