Audacity 3.2.0
AVDictionaryWrapper.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 AVDictionaryWrapper.h
6
7 Dmitry Vedenko
8
9**********************************************************************/
10
11#pragma once
12
13#include <string_view>
14#include <string>
15#include <wx/string.h>
16
17struct FFmpegFunctions;
19
20#define DICT_MATCH_CASE 1
21#define DICT_IGNORE_SUFFIX 2
22
23class FFMPEG_SUPPORT_API AVDictionaryWrapper
24{
25public:
27 AVDictionaryWrapper(const AVDictionaryWrapper& rhs) noexcept;
29
30 // We expect that &mFFmpeg == rhs.mFFmpeg
31 AVDictionaryWrapper& operator=(const AVDictionaryWrapper& rhs) noexcept;
32 AVDictionaryWrapper& operator=(AVDictionaryWrapper&& rhs) noexcept;
33
34 explicit AVDictionaryWrapper(const FFmpegFunctions& ffmpeg) noexcept;
35 explicit AVDictionaryWrapper(const FFmpegFunctions& ffmpeg, AVDictionary* rhs) noexcept;
36
37 AVDictionary* GetWrappedValue() noexcept;
38 const AVDictionary* GetWrappedValue() const noexcept;
39
40 virtual ~AVDictionaryWrapper();
41
42 void Set(const std::string_view& key, const std::string& value, int flags = 0) noexcept;
43 void Set(const std::string_view& key, const wxString& value, int flags = 0) noexcept;
44 void Set(const std::string_view& key, const char* value, int flags = 0) noexcept;
45
46 template<typename T>
47 void Set(const std::string_view& key, const T& value, int flags = 0) noexcept
48 {
49 Set(key, std::to_string(value), flags);
50 }
51
52 std::string_view Get(const std::string_view& key, const std::string_view& defaultValue, int flags = 0) const;
53 bool HasValue(const std::string_view& key, int flags = 0) const noexcept;
54
55 AVDictionary* Release() noexcept;
56protected:
57 const FFmpegFunctions& mFFmpeg;
58 AVDictionary* mAVDictionary { nullptr };
59};
struct AVDictionary AVDictionary
Definition: FFmpegTypes.h:117
static const AudacityProject::AttachedObjects::RegisteredFactory key
void Set(const std::string_view &key, const T &value, int flags=0) noexcept
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:202
void Release(wxWindow *handler)