CVB++ 14.1
CodecConfig Class Referencefinal

A configuration defining a codec. More...

#include <cvb/codec_bridge/codec_config.hpp>

Public Member Functions

Cvb::String Name () const
 Get the name of the codec. More...
 
Cvb::String ToJson () const
 Create a JSON string that defines this configuration. More...
 
int64_t BitRate () const
 Get the bit rate. More...
 
void SetBitRate (int64_t bitRate)
 Set the bit rate. More...
 
Size2D< int > Size () const
 Get the size of the frames. More...
 
int ID () const
 Get the codec ID. More...
 
void SetSize (Size2D< int > size)
 Set the size of the frames. More...
 
Rational TimeBase () const
 The time base used by the codec. More...
 
void SetTimeBase (Rational timeBase)
 Set the time base used by the codec. More...
 
int GOPSize () const
 Get the GOP size. More...
 
void SetGOPSize (int gopSize)
 Set the GOP size. More...
 
int MaxBFrames () const
 Get the maximum B frames. More...
 
void SetMaxBFrames (int maxBFrames)
 Set the maximum B frames. More...
 
CodecBridge::PixelFormat PixelFormat () const
 Get the pixel format used by this codec. More...
 
void SetPixelFormat (CodecBridge::PixelFormat pixelFormat)
 Set the pixel format used by this codec. More...
 
template<class T >
Option (const Cvb::String &name) const
 Get a generic option from the codec. More...
 
template<class T >
void AddOption (const Cvb::String &name, const T &value)
 Add a generic option from the codec. More...
 
Cvb::String SessionDescription (const Cvb::String &url)
 Get the contend of the session description protocol. More...
 

Static Public Member Functions

static std::unique_ptr< CodecConfigCreate (const Cvb::String &provider)
 Creates a codec config from given provider. More...
 

Detailed Description

A configuration defining a codec.

CodecConfig to set up an encoder and/or to create a session description file for decoding.

Member Function Documentation

◆ AddOption()

void AddOption ( const Cvb::String name,
const T &  value 
)

Add a generic option from the codec.

Parameters
[in]nameThe name of the option.
[in]valueThe value of the option.
Exceptions
Anyexception derived from std::exception including CvbException.

See FFmpeg for details on the options. E.g use: ffmpeg.exe -h encoder=libx265

◆ BitRate()

int64_t BitRate ( ) const
inline

Get the bit rate.

Returns
The bit rate.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Create()

static std::unique_ptr< CodecConfig > Create ( const Cvb::String provider)
inlinestatic

Creates a codec config from given provider.

Parameters
[in]providerThe name of the codec (e.g libx265) or a JSON file with a complete set of options and properties.
Returns
A pointer to a configuration object.
Exceptions
Anyexception derived from std::exception including CvbException.

A JSON file can be used to restore a previously saved configuration.

◆ GOPSize()

int GOPSize ( ) const
inline

Get the GOP size.

Returns
The group of pictures size.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ ID()

int ID ( ) const
inline

Get the codec ID.

Returns
The ID.
Exceptions
Anyexception derived from std::exception including CvbException.

This ID does refer to the codec method not the codec itself, so all h265 encoders will have the same ID. See FFmpeg to match the IDs.

◆ MaxBFrames()

int MaxBFrames ( ) const
inline

Get the maximum B frames.

Returns
The maximum number of bidirectional frames.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Name()

Cvb::String Name ( ) const
inline

Get the name of the codec.

Returns
Unique name of the codex.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Option()

T Option ( const Cvb::String name) const

Get a generic option from the codec.

Returns
The value of the option.
Exceptions
Anyexception derived from std::exception including CvbException.

See FFmpeg for details on the options. E.g use: ffmpeg.exe -h encoder=libx265

◆ PixelFormat()

Get the pixel format used by this codec.

Returns
The pixel format.
Exceptions
Anyexception derived from std::exception including CvbException.

The pixel formats match those used by FFmpeg.

◆ SessionDescription()

Cvb::String SessionDescription ( const Cvb::String url)
inline

Get the contend of the session description protocol.

Returns
The SDP string.
Exceptions
Anyexception derived from std::exception including CvbException.

The session description protocol can be used to decode the raw packet stream, as it contains all the information that would go into an mp4 file for example.

◆ SetBitRate()

void SetBitRate ( int64_t  bitRate)
inline

Set the bit rate.

Parameters
[in]bitRateThe bit rate.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ SetGOPSize()

void SetGOPSize ( int  gopSize)
inline

Set the GOP size.

Parameters
[in]gopSizeThe group of pictures size.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ SetMaxBFrames()

void SetMaxBFrames ( int  maxBFrames)
inline

Set the maximum B frames.

Parameters
[in]maxBFramesThe maximum number of bidirectional frames.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ SetPixelFormat()

void SetPixelFormat ( CodecBridge::PixelFormat  pixelFormat)
inline

Set the pixel format used by this codec.

Parameters
[in]pixelFormatThe pixel format.
Exceptions
Anyexception derived from std::exception including CvbException.

The pixel formats match those used by FFmpeg.

◆ SetSize()

void SetSize ( Size2D< int >  size)
inline

Set the size of the frames.

Parameters
[in]sizeThe frame size.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ SetTimeBase()

void SetTimeBase ( Rational  timeBase)
inline

Set the time base used by the codec.

Parameters
[in]timeBaseThe time base (Numerator should be 1).
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Size()

Size2D< int > Size ( ) const
inline

Get the size of the frames.

Returns
The frame size.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ TimeBase()

Rational TimeBase ( ) const
inline

The time base used by the codec.

Returns
The fraction that represents the time base.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ ToJson()

Cvb::String ToJson ( ) const
inline

Create a JSON string that defines this configuration.

Returns
The JSON string.
Exceptions
Anyexception derived from std::exception including CvbException.