ifm3d
ifm3d::DecoderManager Class Reference

Lists and selects the video decoder implementations that are compiled into the RTSP module. More...

#include <ifm3d/rtsp/decoder_manager.h>

Classes

struct  DecoderInfo
 Describes a registered decoder implementation and whether it can be used on the current system. More...
 

Public Member Functions

 DecoderManager (std::optional< std::string > preferred_decoder={})
 
 DecoderManager (const DecoderManager &)=delete
 
DecoderManageroperator= (const DecoderManager &)=delete
 
 DecoderManager (DecoderManager &&)=delete
 
DecoderManageroperator= (DecoderManager &&)=delete
 
void LoadDecoders ()
 Resolve which decoder serves each codec, honouring preferred_decoder and falling back to the null decoder. More...
 
std::unique_ptr< ifm3d::rtsp::VideoDecoderCreateDecoder (ifm3d::rtsp::VideoCodec codec)
 Create a decoder for the given codec using the selected implementation. More...
 
std::string SelectedDecoderName (ifm3d::rtsp::VideoCodec codec) const
 

Static Public Member Functions

static std::vector< DecoderInfoDiscoverDecoders ()
 List the decoder implementations and report whether each is usable on the current system. More...
 

Detailed Description

Lists and selects the video decoder implementations that are compiled into the RTSP module.

Each implementation (e.g. the ffmpeg decoder and the always-available "null" decoder) is registered here. Implementations that depend on optional runtime libraries report their own availability – the ffmpeg decoder, for example, resolves libavcodec/libavutil at runtime and is unavailable when no compatible FFmpeg is installed.

Selection for a codec (deterministic):

  • If preferred_decoder is the "null" name, the null decoder is used (frames are discarded, NAL-only).
  • Else if preferred_decoder is set and an available decoder whose name contains that string supports the codec, it is used.
  • Otherwise the first available decoder (excluding "null") that supports the codec is used.
  • If none is available, the "null" decoder is used as a fallback. A warning is logged whenever the null decoder is selected.

Constructor & Destructor Documentation

◆ DecoderManager()

ifm3d::DecoderManager::DecoderManager ( std::optional< std::string >  preferred_decoder = {})
explicit
Parameters
preferred_decoderOptional decoder name substring (e.g. "ffmpeg"), or the "null" decoder name.

Member Function Documentation

◆ CreateDecoder()

std::unique_ptr<ifm3d::rtsp::VideoDecoder> ifm3d::DecoderManager::CreateDecoder ( ifm3d::rtsp::VideoCodec  codec)

Create a decoder for the given codec using the selected implementation.

Returns nullptr if LoadDecoders() has not run or no decoder is available.

◆ DiscoverDecoders()

static std::vector<DecoderInfo> ifm3d::DecoderManager::DiscoverDecoders ( )
static

List the decoder implementations and report whether each is usable on the current system.

This is a diagnostic helper: it does not affect the state of any DecoderManager instance.

◆ LoadDecoders()

void ifm3d::DecoderManager::LoadDecoders ( )

Resolve which decoder serves each codec, honouring preferred_decoder and falling back to the null decoder.

Should be called once after construction.

◆ SelectedDecoderName()

std::string ifm3d::DecoderManager::SelectedDecoderName ( ifm3d::rtsp::VideoCodec  codec) const
Returns
the name of the decoder selected for codec, or an empty string if none has been selected. Intended for diagnostics/tests.

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