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 }

◆ 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 }

◆ ~AVDictionaryWrapper()

AVDictionaryWrapper::~AVDictionaryWrapper ( )
virtual

Definition at line 76 of file AVDictionaryWrapper.cpp.

77 {
79 }

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 }

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 }

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 }

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 ExportFFmpeg::InitCodecs(), and ExportFFmpeg::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  }

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:
AudacityAVDictionaryEntry
Simply an overlay of AVDictionaryEntry, but we avoid including that type.
Definition: FFmpegTypes.h:138
AVUtilFunctions::av_dict_free
void(* av_dict_free)(AVDictionary **m)
Definition: AVUtilFunctions.h:24
AVUtilFunctions::av_dict_copy
void(* av_dict_copy)(AVDictionary **dst, const AVDictionary *src, int flags)
Definition: AVUtilFunctions.h:28
AVDictionaryWrapper::mAVDictionary
AVDictionary * mAVDictionary
Definition: AVDictionaryWrapper.h:58
entry
static ProjectFileIORegistry::AttributeWriterEntry entry
Definition: ProjectSettings.cpp:198
AVDictionaryWrapper::mFFmpeg
const FFmpegFunctions & mFFmpeg
Definition: AVDictionaryWrapper.h:57
AVDictionaryWrapper::AVDictionaryWrapper
AVDictionaryWrapper(const AVDictionaryWrapper &rhs) noexcept
Unlike the other FFmpeg wrapper classes, this one is copyable.
Definition: AVDictionaryWrapper.cpp:32
AVUtilFunctions::av_dict_set
int(* av_dict_set)(AVDictionary **pm, const char *key, const char *value, int flags)
Definition: AVUtilFunctions.h:27
anonymous_namespace{NoteTrack.cpp}::swap
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:753
AVDictionaryWrapper::Set
void Set(const std::string_view &key, const std::string &value, int flags=0) noexcept
Definition: AVDictionaryWrapper.cpp:81
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: CommandManager.cpp:201
AVUtilFunctions::av_dict_get
AudacityAVDictionaryEntry *(* av_dict_get)(const AVDictionary *m, const char *key, const AudacityAVDictionaryEntry *prev, int flags)
Definition: AVUtilFunctions.h:26