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

The CodecParametersView class. More...

#include <codecparameters.h>

Inheritance diagram for av::CodecParametersView:

Public Member Functions

 CodecParametersView (AVCodecParameters *codecpar=nullptr)
 Wrap FFmpeg codec parameters.
bool isValid () const
 Whether the view refers to parameters.
void copyFrom (CodecParametersView src, OptionalErrorCode ec=throws())
 Copy parameters into this view from another view.
void copyTo (CodecParametersView dst, OptionalErrorCode ec=throws()) const
 Copy these parameters into another view.
void copyFrom (const class CodecContext2 &src, OptionalErrorCode ec=throws())
 Copy parameters from a codec context.
void copyTo (class CodecContext2 &dst, OptionalErrorCode ec=throws()) const
 Copy these parameters into a codec context.
int getAudioFrameDuration (int frame_bytes) const
 Duration of one audio frame of the given size.
AVMediaType codecType () const
 Media type the codec handles.
void codecType (AVMediaType codec_type)
 Set the media type.
AVMediaType mediaType () const
 Media type of the parameters.
void mediaType (AVMediaType media_type)
 Set the media type.
AVCodecID codecId () const
 Identifier of the codec.
void codecId (AVCodecID codec_id)
 Set the codec identifier.
Codec encodingCodec () const
 Encoder for this codec identifier.
Codec decodingCodec () const
 Decoder for this codec identifier.
uint32_t codecTag () const
 Four-character code of the codec inside the container.
void codecTag (uint32_t codec_tag)
 Set the container codec tag.
Public Member Functions inherited from FFWrapperPtr< AVCodecParameters >
 FFWrapperPtr ()=default
 Create an empty wrapper; isNull() is true.
const AVCodecParameters * raw () const
 Read access to the wrapped object.
void reset (AVCodecParameters *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< AVCodecParameters >
AVCodecParameters * m_raw
 The wrapped pointer; owned by the derived class, not by this template.

Detailed Description

Not-owned wrapper for AVCodecParameters. Do not keep for a long time.

Constructor & Destructor Documentation

◆ CodecParametersView()

av::CodecParametersView::CodecParametersView ( AVCodecParameters * codecpar = nullptr)
Parameters
codecparthe parameters to view; null produces an invalid view
Note
Non-owning: the parameters must outlive the view.

Member Function Documentation

◆ codecId() [1/2]

AVCodecID av::CodecParametersView::codecId ( ) const
Returns
the AV_CODEC_ID_* value
Examples
api2-hw-decode.cpp, api2-hw-scale.cpp, and api2-hw-transcode.cpp.

◆ codecId() [2/2]

void av::CodecParametersView::codecId ( AVCodecID codec_id)
Parameters
codec_idthe AV_CODEC_ID_* value

◆ codecTag() [1/2]

uint32_t av::CodecParametersView::codecTag ( ) const
Returns
the tag, or zero when it is not set

◆ codecTag() [2/2]

void av::CodecParametersView::codecTag ( uint32_t codec_tag)
Parameters
codec_tagthe tag to store; zero clears it, which lets the muxer choose a tag for its own container

◆ codecType() [1/2]

AVMediaType av::CodecParametersView::codecType ( ) const
Returns
the AVMEDIA_TYPE_* value

◆ codecType() [2/2]

void av::CodecParametersView::codecType ( AVMediaType codec_type)
Parameters
codec_typethe AVMEDIA_TYPE_* value

◆ copyFrom() [1/2]

void av::CodecParametersView::copyFrom ( CodecParametersView src,
OptionalErrorCode ec = throws() )
Parameters
srcthe parameters to copy
echolder for the error code
Examples
api2-generate-subtitles.cpp.

◆ copyFrom() [2/2]

void av::CodecParametersView::copyFrom ( const class CodecContext2 & src,
OptionalErrorCode ec = throws() )
Parameters
srcthe context to copy from
echolder for the error code

◆ copyTo() [1/2]

void av::CodecParametersView::copyTo ( class CodecContext2 & dst,
OptionalErrorCode ec = throws() ) const
Parameters
dstthe context to fill
echolder for the error code

◆ copyTo() [2/2]

void av::CodecParametersView::copyTo ( CodecParametersView dst,
OptionalErrorCode ec = throws() ) const
Parameters
dstthe parameters to fill
echolder for the error code

◆ decodingCodec()

Codec av::CodecParametersView::decodingCodec ( ) const
Returns
the codec descriptor, or an invalid one when no decoder exists
Examples
api2-remux.cpp.

◆ encodingCodec()

Codec av::CodecParametersView::encodingCodec ( ) const
Returns
the codec descriptor, or an invalid one when no encoder exists

◆ getAudioFrameDuration()

int av::CodecParametersView::getAudioFrameDuration ( int frame_bytes) const
Parameters
frame_bytessize of the frame in bytes
Returns
the duration in the stream time base, or a negative value when the parameters do not describe audio

◆ isValid()

bool av::CodecParametersView::isValid ( ) const
Returns
true when the underlying AVCodecParameters exists

◆ mediaType() [1/2]

AVMediaType av::CodecParametersView::mediaType ( ) const

Kept for symmetry with codecType(); FFmpeg stores one value for both.

Returns
the AVMEDIA_TYPE_* value

◆ mediaType() [2/2]

void av::CodecParametersView::mediaType ( AVMediaType media_type)
Parameters
media_typethe AVMEDIA_TYPE_* value

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