Template Class Codec¶
Defined in File codec.h
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.
Public Functions
-
Codec() = default¶
Default constructor.
-
Codec(const AVCodecParameters *codecpar, Rational time_base, Rational frame_rate) noexcept¶
Construct codec from decoding/demuxing context.
- Parameters:
codecpar – Codec parameters from FFmpeg.
time_base – Time base of the stream.
frame_rate – Frame rate of the stream.
-
~Codec()¶
Destructor.
-
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.
-
const AVCodecParameters *get_parameters() const¶
Get the underlying codec parameters.
- Returns:
Pointer to AVCodecParameters. The returned pointer must not outlive the Codec object.
-
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.
-
Codec() = default¶