FFmpegfs Fuse Multi Media Filesystem 2.19
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
FFmpeg_Dictionary Class Reference

RAII wrapper for AVDictionary. More...

#include <ffmpeg_dictionary.h>

Public Member Functions

 FFmpeg_Dictionary ()
 Construct an empty dictionary wrapper.
 
 ~FFmpeg_Dictionary ()
 Release the owned dictionary, if any.
 
 FFmpeg_Dictionary (const FFmpeg_Dictionary &)=delete
 
FFmpeg_Dictionaryoperator= (const FFmpeg_Dictionary &)=delete
 
 FFmpeg_Dictionary (FFmpeg_Dictionary &&dict) noexcept
 Move-construct a dictionary wrapper.
 
FFmpeg_Dictionaryoperator= (FFmpeg_Dictionary &&dict) noexcept
 Move-assign a dictionary wrapper.
 
void reset ()
 Free the owned dictionary and reset the wrapper to empty.
 
bool empty () const
 Check whether the wrapper currently owns a dictionary.
 
AVDictionary * get ()
 Get the owned FFmpeg dictionary pointer.
 
const AVDictionary * get () const
 Get the owned FFmpeg dictionary pointer.
 
AVDictionary ** address ()
 Get a writable pointer-to-pointer for FFmpeg APIs.
 
AVDictionary * release ()
 Release ownership without freeing the dictionary.
 
 operator AVDictionary * ()
 Convert to the underlying mutable dictionary pointer.
 
 operator const AVDictionary * () const
 Convert to the underlying const dictionary pointer.
 

Private Attributes

AVDictionary * m_dict
 Pointer to underlying AVDictionary.
 

Detailed Description

RAII wrapper for AVDictionary.

Owns an AVDictionary created by av_dict_set() / FFmpeg APIs and releases it with av_dict_free(). The wrapper is movable but not copyable.

Definition at line 30 of file ffmpeg_dictionary.h.

Constructor & Destructor Documentation

◆ FFmpeg_Dictionary() [1/2]

FFmpeg_Dictionary::FFmpeg_Dictionary ( )

Construct an empty dictionary wrapper.

Definition at line 32 of file ffmpeg_dictionary.cc.

◆ ~FFmpeg_Dictionary()

FFmpeg_Dictionary::~FFmpeg_Dictionary ( )

Release the owned dictionary, if any.

Definition at line 37 of file ffmpeg_dictionary.cc.

References reset().

◆ FFmpeg_Dictionary() [2/2]

FFmpeg_Dictionary::FFmpeg_Dictionary ( FFmpeg_Dictionary &&  dict)
noexcept

Move-construct a dictionary wrapper.

Parameters
[in,out]dictSource wrapper whose dictionary ownership is transferred.

Definition at line 42 of file ffmpeg_dictionary.cc.

Member Function Documentation

◆ address()

AVDictionary ** FFmpeg_Dictionary::address ( )

Get a writable pointer-to-pointer for FFmpeg APIs.

Any currently owned dictionary is freed first so that FFmpeg can write a fresh dictionary pointer without leaking the previous one.

Returns
Address of the managed dictionary pointer.

Definition at line 83 of file ffmpeg_dictionary.cc.

References m_dict.

Referenced by FFmpeg_Transcoder::add_albumart_stream(), FFmpeg_Transcoder::add_stream(), FFmpeg_Transcoder::add_subtitle_stream(), FFmpeg_Transcoder::open_decoder(), FFmpeg_Transcoder::open_input_file(), FFmpeg_Transcoder::open_output_frame_set(), and FFmpeg_Transcoder::write_output_file_header().

◆ empty()

bool FFmpeg_Dictionary::empty ( ) const

Check whether the wrapper currently owns a dictionary.

Returns
true if no dictionary is owned, false otherwise.

Definition at line 68 of file ffmpeg_dictionary.cc.

References m_dict.

◆ get() [1/2]

AVDictionary * FFmpeg_Dictionary::get ( )

Get the owned FFmpeg dictionary pointer.

Returns
Mutable AVDictionary pointer, or nullptr if empty.

Definition at line 73 of file ffmpeg_dictionary.cc.

References m_dict.

◆ get() [2/2]

const AVDictionary * FFmpeg_Dictionary::get ( ) const

Get the owned FFmpeg dictionary pointer.

Returns
Const AVDictionary pointer, or nullptr if empty.

Definition at line 78 of file ffmpeg_dictionary.cc.

References m_dict.

◆ operator AVDictionary *()

FFmpeg_Dictionary::operator AVDictionary * ( )

Convert to the underlying mutable dictionary pointer.

Definition at line 95 of file ffmpeg_dictionary.cc.

◆ operator const AVDictionary *()

FFmpeg_Dictionary::operator const AVDictionary * ( ) const

Convert to the underlying const dictionary pointer.

Definition at line 100 of file ffmpeg_dictionary.cc.

◆ operator=()

FFmpeg_Dictionary & FFmpeg_Dictionary::operator= ( FFmpeg_Dictionary &&  dict)
noexcept

Move-assign a dictionary wrapper.

Parameters
[in,out]dictSource wrapper whose dictionary ownership is transferred.
Returns
Reference to this wrapper.

Definition at line 48 of file ffmpeg_dictionary.cc.

◆ release()

AVDictionary * FFmpeg_Dictionary::release ( )

Release ownership without freeing the dictionary.

Returns
Previously owned AVDictionary pointer, or nullptr if empty.

Definition at line 88 of file ffmpeg_dictionary.cc.

References m_dict.

◆ reset()

void FFmpeg_Dictionary::reset ( )

Free the owned dictionary and reset the wrapper to empty.

Definition at line 60 of file ffmpeg_dictionary.cc.

References m_dict.

Referenced by ~FFmpeg_Dictionary().

Member Data Documentation

◆ m_dict

AVDictionary* FFmpeg_Dictionary::m_dict
private

Pointer to underlying AVDictionary.

Definition at line 109 of file ffmpeg_dictionary.h.

Referenced by address(), empty(), get(), get(), release(), and reset().


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