avcpp 3.2.1
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
av::Codec Class Reference

Codec descriptor. More...

#include <codec.h>

Inheritance diagram for av::Codec:

Public Member Functions

const char * name () const
 Short name of the codec, as FFmpeg knows it.
const char * longName () const
 Human-readable name of the codec.
bool canEncode () const
 Whether the codec can be used for encoding.
bool canDecode () const
 Whether the codec can be used for decoding.
bool isEncoder () const
 Whether this descriptor is an encoder.
bool isDecoder () const
 Whether this descriptor is a decoder.
AVMediaType type () const
 Media type the codec handles.
std::deque< Rational > supportedFramerates () const
 Frame rates the encoder supports.
std::deque< PixelFormat > supportedPixelFormats () const
 Pixel formats the codec supports.
std::deque< int > supportedSamplerates () const
 Sample rates the codec supports.
std::deque< SampleFormat > supportedSampleFormats () const
 Sample formats the codec supports.
std::deque< uint64_t > supportedChannelLayouts () const
 Channel layouts the codec supports, as masks.
std::deque< ChannelLayoutView > supportedChannelLayouts2 () const
 Channel layouts the codec supports, as structured views.
AVCodecID id () const
 Identifier of the codec.
Public Member Functions inherited from FFWrapperPtr< const AVCodec >
 FFWrapperPtr ()=default
 Create an empty wrapper; isNull() is true.
const const AVCodec * raw () const
 Read access to the wrapped object.
void reset (const AVCodec *raw=nullptr)
 Replace the stored pointer.
bool isNull () const
 Whether the wrapper is empty.
void _log (int level, const char *fmt) const
 Log through the FFmpeg log system, using this wrapper as the context.

Additional Inherited Members

Protected Attributes inherited from FFWrapperPtr< const AVCodec >
const AVCodec * m_raw
 The wrapped pointer; owned by the derived class, not by this template.

Detailed Description

Points at the static description FFmpeg registers for a codec: its name, what it can do, and which formats it accepts. The library owns the descriptor, the wrapper only points at it, so copying a Codec copies a pointer.

Examples
api2-decode-audio.cpp, api2-decode-encode-audio.cpp, api2-decode-encode-video.cpp, api2-decode-filter-encode.cpp, api2-decode-overlay-encode.cpp, api2-decode-rasample-audio.cpp, api2-decode.cpp, api2-hw-decode.cpp, api2-hw-encode.cpp, api2-hw-probe.cpp, api2-hw-scale.cpp, api2-hw-transcode.cpp, and api2-scale-video.cpp.

Member Function Documentation

◆ canDecode()

bool av::Codec::canDecode ( ) const
Returns
true when FFmpeg registers a decoder with this name

◆ canEncode()

bool av::Codec::canEncode ( ) const
Returns
true when FFmpeg registers an encoder with this name

◆ id()

AVCodecID av::Codec::id ( ) const
Returns
the AV_CODEC_ID_* value

◆ isDecoder()

bool av::Codec::isDecoder ( ) const
Returns
true for decoder registrations

◆ isEncoder()

bool av::Codec::isEncoder ( ) const
Returns
true for encoder registrations, which is how h264_qsv and h264 are told apart

◆ longName()

const char * av::Codec::longName ( ) const
Returns
a static description, or nullptr for an invalid codec
Examples
api2-decode-encode-audio.cpp.

◆ name()

const char * av::Codec::name ( ) const

◆ supportedChannelLayouts()

std::deque< uint64_t > av::Codec::supportedChannelLayouts ( ) const
Returns
the layouts; empty when the codec accepts any layout
Examples
api2-decode-encode-audio.cpp.

◆ supportedChannelLayouts2()

std::deque< ChannelLayoutView > av::Codec::supportedChannelLayouts2 ( ) const

Available with the modern FFmpeg channel layout API.

Returns
non-owning views of the layouts; empty when any layout is accepted

◆ supportedFramerates()

std::deque< Rational > av::Codec::supportedFramerates ( ) const
Returns
the supported rates; empty when the codec does not restrict them

◆ supportedPixelFormats()

std::deque< PixelFormat > av::Codec::supportedPixelFormats ( ) const
Returns
the formats; empty when they are not known before opening

◆ supportedSampleFormats()

std::deque< SampleFormat > av::Codec::supportedSampleFormats ( ) const
Returns
the formats; empty when they are not known before opening
Examples
api2-decode-encode-audio.cpp.

◆ supportedSamplerates()

std::deque< int > av::Codec::supportedSamplerates ( ) const
Returns
the rates; empty when the codec accepts any rate
Examples
api2-decode-encode-audio.cpp.

◆ type()

AVMediaType av::Codec::type ( ) const
Returns
the AVMEDIA_TYPE_* value
Examples
api2-decode-encode-audio.cpp.

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