Audacity 3.2.0
Public Member Functions | Protected Attributes | List of all members
AVDictionaryWrapper Class Reference

#include <AVDictionaryWrapper.h>

Collaboration diagram for AVDictionaryWrapper:
[legend]

Public Member Functions

 AVDictionaryWrapper (const AVDictionaryWrapper &rhs) noexcept
 Unlike the other FFmpeg wrapper classes, this one is copyable. More...
 
 AVDictionaryWrapper (AVDictionaryWrapper &&rhs) noexcept
 
AVDictionaryWrapperoperator= (const AVDictionaryWrapper &rhs) noexcept
 
AVDictionaryWrapperoperator= (AVDictionaryWrapper &&rhs) noexcept
 
 AVDictionaryWrapper (const FFmpegFunctions &ffmpeg) noexcept
 
 AVDictionaryWrapper (const FFmpegFunctions &ffmpeg, AVDictionary *rhs) noexcept
 
AVDictionaryGetWrappedValue () noexcept
 
const AVDictionaryGetWrappedValue () const noexcept
 
virtual ~AVDictionaryWrapper ()
 
void Set (const std::string_view &key, const std::string &value, int flags=0) noexcept
 
void Set (const std::string_view &key, const wxString &value, int flags=0) noexcept
 
void Set (const std::string_view &key, const char *value, int flags=0) noexcept
 
template<typename T >
void Set (const std::string_view &key, const T &value, int flags=0) noexcept
 
std::string_view Get (const std::string_view &key, const std::string_view &defaultValue, int flags=0) const
 
bool HasValue (const std::string_view &key, int flags=0) const noexcept
 
AVDictionaryRelease () noexcept
 

Protected Attributes

const FFmpegFunctionsmFFmpeg
 
AVDictionarymAVDictionary { nullptr }
 

Detailed Description

Definition at line 23 of file AVDictionaryWrapper.h.

Constructor & Destructor Documentation

◆ AVDictionaryWrapper() [1/4]

AVDictionaryWrapper::AVDictionaryWrapper ( const AVDictionaryWrapper rhs)
noexcept

Unlike the other FFmpeg wrapper classes, this one is copyable.

Definition at line 32 of file AVDictionaryWrapper.cpp.

35{
36}
const FFmpegFunctions & mFFmpeg
AVDictionaryWrapper(const AVDictionaryWrapper &rhs) noexcept
Unlike the other FFmpeg wrapper classes, this one is copyable.
AVDictionary * mAVDictionary

◆ AVDictionaryWrapper() [2/4]

AVDictionaryWrapper::AVDictionaryWrapper ( AVDictionaryWrapper &&  rhs)
noexcept

Definition at line 38 of file AVDictionaryWrapper.cpp.

40 : mFFmpeg(rhs.mFFmpeg)
41{
42 *this = std::move(rhs);
43}

◆ AVDictionaryWrapper() [3/4]

AVDictionaryWrapper::AVDictionaryWrapper ( const FFmpegFunctions ffmpeg)
explicitnoexcept

Definition at line 18 of file AVDictionaryWrapper.cpp.

20 : mFFmpeg(ffmpeg)
21{
22}

◆ AVDictionaryWrapper() [4/4]

AVDictionaryWrapper::AVDictionaryWrapper ( const FFmpegFunctions ffmpeg,
AVDictionary rhs 
)
explicitnoexcept

Definition at line 24 of file AVDictionaryWrapper.cpp.

26 : mFFmpeg(ffmpeg)
27{
28 if (rhs != nullptr)
30}
void(* av_dict_copy)(AVDictionary **dst, const AVDictionary *src, int flags)

◆ ~AVDictionaryWrapper()

AVDictionaryWrapper::~AVDictionaryWrapper ( )
virtual

Definition at line 76 of file AVDictionaryWrapper.cpp.

77{
79}
void(* av_dict_free)(AVDictionary **m)

References AVUtilFunctions::av_dict_free, mAVDictionary, and mFFmpeg.

Member Function Documentation

◆ Get()

std::string_view AVDictionaryWrapper::Get ( const std::string_view &  key,
const std::string_view &  defaultValue,
int  flags = 0 
) const

Definition at line 101 of file AVDictionaryWrapper.cpp.

104{
105 if (mAVDictionary == nullptr)
106 return defaultValue;
107
109 mFFmpeg.av_dict_get(mAVDictionary, key.data(), nullptr, flags);
110
111 if (entry != nullptr)
112 return entry->value;
113
114 return defaultValue;
115}
static ProjectFileIORegistry::AttributeWriterEntry entry
static const AudacityProject::AttachedObjects::RegisteredFactory key
AudacityAVDictionaryEntry *(* av_dict_get)(const AVDictionary *m, const char *key, const AudacityAVDictionaryEntry *prev, int flags)
Simply an overlay of AVDictionaryEntry, but we avoid including that type.
Definition: FFmpegTypes.h:143

References AVUtilFunctions::av_dict_get, entry, key, mAVDictionary, and mFFmpeg.

Referenced by FFmpegImportFileHandle::InitCodecs().

Here is the caller graph for this function:

◆ GetWrappedValue() [1/2]

const AVDictionary * AVDictionaryWrapper::GetWrappedValue ( ) const
noexcept

Definition at line 71 of file AVDictionaryWrapper.cpp.

72{
73 return mAVDictionary;
74}

References mAVDictionary.

◆ GetWrappedValue() [2/2]

AVDictionary * AVDictionaryWrapper::GetWrappedValue ( )
noexcept

Definition at line 66 of file AVDictionaryWrapper.cpp.

67{
68 return mAVDictionary;
69}

References mAVDictionary.

◆ HasValue()

bool AVDictionaryWrapper::HasValue ( const std::string_view &  key,
int  flags = 0 
) const
noexcept

Definition at line 117 of file AVDictionaryWrapper.cpp.

119{
120 if (mAVDictionary == nullptr)
121 return false;
122
124 mFFmpeg.av_dict_get(mAVDictionary, key.data(), nullptr, flags);
125
126 return entry != nullptr;
127}

References entry, and key.

◆ operator=() [1/2]

AVDictionaryWrapper & AVDictionaryWrapper::operator= ( AVDictionaryWrapper &&  rhs)
noexcept

Definition at line 57 of file AVDictionaryWrapper.cpp.

58{
59 assert(&mFFmpeg == &rhs.mFFmpeg);
60
62
63 return *this;
64}
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:628

References anonymous_namespace{NoteTrack.cpp}::swap().

Here is the call graph for this function:

◆ operator=() [2/2]

AVDictionaryWrapper & AVDictionaryWrapper::operator= ( const AVDictionaryWrapper rhs)
noexcept

Definition at line 46 of file AVDictionaryWrapper.cpp.

47{
48 assert(&mFFmpeg == &rhs.mFFmpeg);
49
50 if (rhs.mAVDictionary != nullptr)
52
53 return *this;
54}

◆ Release()

AVDictionary * AVDictionaryWrapper::Release ( )
noexcept

Definition at line 129 of file AVDictionaryWrapper.cpp.

130{
131 auto temp = mAVDictionary;
132 mAVDictionary = nullptr;
133
134 return temp;
135}

References mAVDictionary.

Referenced by AVFormatContextWrapper::OpenInputContext().

Here is the caller graph for this function:

◆ Set() [1/4]

void AVDictionaryWrapper::Set ( const std::string_view &  key,
const char *  value,
int  flags = 0 
)
noexcept

Definition at line 94 of file AVDictionaryWrapper.cpp.

96{
98 &mAVDictionary, key.data(), value, flags);
99}
int(* av_dict_set)(AVDictionary **pm, const char *key, const char *value, int flags)

References key.

◆ Set() [2/4]

void AVDictionaryWrapper::Set ( const std::string_view &  key,
const std::string &  value,
int  flags = 0 
)
noexcept

Definition at line 81 of file AVDictionaryWrapper.cpp.

84{
85 mFFmpeg.av_dict_set(&mAVDictionary, key.data(), value.data(), flags);
86}

References key.

Referenced by FFmpegExporter::InitCodecs(), and FFmpegExporter::SetMetadata().

Here is the caller graph for this function:

◆ Set() [3/4]

template<typename T >
void AVDictionaryWrapper::Set ( const std::string_view &  key,
const T &  value,
int  flags = 0 
)
inlinenoexcept

Definition at line 47 of file AVDictionaryWrapper.h.

48 {
49 Set(key, std::to_string(value), flags);
50 }
void Set(const std::string_view &key, const std::string &value, int flags=0) noexcept

References key.

◆ Set() [4/4]

void AVDictionaryWrapper::Set ( const std::string_view &  key,
const wxString &  value,
int  flags = 0 
)
noexcept

Definition at line 88 of file AVDictionaryWrapper.cpp.

90{
91 mFFmpeg.av_dict_set(&mAVDictionary, key.data(), value.ToUTF8().data(), flags);
92}

References key.

Member Data Documentation

◆ mAVDictionary

AVDictionary* AVDictionaryWrapper::mAVDictionary { nullptr }
protected

Definition at line 58 of file AVDictionaryWrapper.h.

Referenced by Get(), GetWrappedValue(), Release(), and ~AVDictionaryWrapper().

◆ mFFmpeg

const FFmpegFunctions& AVDictionaryWrapper::mFFmpeg
protected

Definition at line 57 of file AVDictionaryWrapper.h.

Referenced by Get(), and ~AVDictionaryWrapper().


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