Audacity 3.2.0
FFmpegAPIResolver.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 FFmpegAPIResolver.cpp
6
7 Dmitry Vedenko
8
9**********************************************************************/
10
11#include "FFmpegAPIResolver.h"
12
14{
15 static FFmpegAPIResolver instance;
16 return instance;
17}
18
19bool FFmpegAPIResolver::GetAVCodecIDResolver(int avCodecVersion, AVCodecIDResolver& resolver) const
20{
21 const auto it = mAVCodecIDResolvers.find(avCodecVersion);
22
23 if (it == mAVCodecIDResolvers.end())
24 return false;
25
26 resolver = it->second;
27
28 return true;
29}
30
31bool FFmpegAPIResolver::GetAVCodecFactories(int avCodecVersion, AVCodecFactories& factories) const
32{
33 const auto it = mAVCodecFactories.find(avCodecVersion);
34
35 if (it == mAVCodecFactories.end())
36 return false;
37
38 factories = it->second;
39
40 return true;
41}
42
43bool FFmpegAPIResolver::GetAVFormatFactories(int avFormatVersion, AVFormatFactories& factories) const
44{
45 const auto it = mAVFormatFactories.find(avFormatVersion);
46
47 if (it == mAVFormatFactories.end())
48 return false;
49
50 factories = it->second;
51
52 return true;
53}
54
55bool FFmpegAPIResolver::GetAVUtilFactories(int avUtilVersion, AVUtilFactories& factories) const
56{
57 const auto it = mAVUtilFactories.find(avUtilVersion);
58
59 if (it == mAVUtilFactories.end())
60 return false;
61
62 factories = it->second;
63
64 return true;
65}
66
67void FFmpegAPIResolver::AddAVCodecIDResolver(int avCodecVersion, const AVCodecIDResolver& resolver)
68{
69 mAVCodecIDResolvers.emplace(avCodecVersion, resolver);
70}
71
72void FFmpegAPIResolver::AddAVCodecFactories(int avCodecVersion, const AVCodecFactories& factories)
73{
74 mAVCodecFactories.emplace(avCodecVersion, factories);
75}
76
77void FFmpegAPIResolver::AddAVFormatFactories(int avFormatVersion, const AVFormatFactories& factories)
78{
79 mAVFormatFactories.emplace(avFormatVersion, factories);
80}
81
82void FFmpegAPIResolver::AddAVUtilFactories(int avUtilVersion, const AVUtilFactories& factories)
83{
84 mAVUtilFactories.emplace(avUtilVersion, factories);
85}
86
88{
89 std::vector<int> result;
90 result.reserve(mAVFormatFactories.size());
91
92 for (auto it = mAVFormatFactories.rbegin(), end = mAVFormatFactories.rend();
93 it != end; ++it)
94 {
95 result.emplace_back(it->first);
96 }
97
98 return result;
99}
void AddAVCodecIDResolver(int avCodecVersion, const AVCodecIDResolver &resolver)
void AddAVFormatFactories(int avFormatVersion, const AVFormatFactories &factories)
bool GetAVCodecFactories(int avCodecVersion, AVCodecFactories &factories) const
bool GetAVFormatFactories(int avFormatVersion, AVFormatFactories &factories) const
bool GetAVUtilFactories(int avUtilVersion, AVUtilFactories &factories) const
std::vector< int > GetSuportedAVFormatVersions() const
std::map< int, AVUtilFactories > mAVUtilFactories
std::map< int, AVCodecFactories > mAVCodecFactories
void AddAVCodecFactories(int avCodecVersion, const AVCodecFactories &factories)
bool GetAVCodecIDResolver(int avCodecVersion, AVCodecIDResolver &resolver) const
void AddAVUtilFactories(int avUtilVersion, const AVUtilFactories &factories)
static FFmpegAPIResolver & Get()
std::map< int, AVFormatFactories > mAVFormatFactories
std::map< int, AVCodecIDResolver > mAVCodecIDResolvers
const char * end(const char *str) noexcept
Definition: StringUtils.h:106