Template Class Codec

Nested Relationships

Nested Types

Class Documentation

template<MediaType media>
class Codec

Codec information wrapper.

This class encapsulates codec parameters and provides a media-type-aware interface for accessing codec properties. It abstracts away AVCodecParameters so that SPDL public headers do not require FFmpeg headers.

This class is primarily intended to carry information about codecs for decoding operations, as AVCodecParameters is required when creating decoders. Codec objects are created by libspdl_ffmpeg (for example by demuxers), which also manages the underlying codec parameters.

Public Functions

Codec() = default

Default constructor.

~Codec()

Destructor.

explicit Codec(const Codec<media>&)

Copy constructor.

Codec(Codec<media>&&) noexcept

Move constructor.

Codec<media> &operator=(const Codec<media>&)

Copy assignment operator.

Codec<media> &operator=(Codec<media>&&) noexcept

Move assignment operator.

std::string get_name() const

Get the codec name.

Returns:

Codec name as a string.

CodecID get_codec_id() const

Get the codec ID.

Returns:

Codec identifier.

int64_t get_bit_rate() const

Get the bit rate.

Returns:

Bit rate in bits per second.

int get_bits_per_sample() const

Get bits per sample.

Returns:

Number of bits per sample.

Rational get_time_base() const

Get the time base.

Returns:

Time base as a rational number.

Rational get_frame_rate() const

Get the frame rate.

Returns:

Frame rate as a rational number.

int get_sample_rate() const

Get the audio sample rate.

Returns:

Sample rate in Hz.

int get_num_channels() const

Get the number of audio channels.

Returns:

Number of channels.

std::string get_sample_fmt() const

Get the audio sample format.

Returns:

Sample format as a string.

std::string get_channel_layout() const

Get the audio channel layout.

Returns:

Channel layout as a string.

int get_width() const

Get the video/image width.

Returns:

Width in pixels.

int get_height() const

Get the video/image height.

Returns:

Height in pixels.

std::string get_pix_fmt() const

Get the pixel format.

Returns:

Pixel format as a string.

Rational get_sample_aspect_ratio() const

Get the sample aspect ratio.

Returns:

Sample aspect ratio as a rational number.

Friends

friend struct detail::ContainerAccess