File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ OptionLoader::OptionLoader()
22
22
, m_codec( NULL )
23
23
, m_formatsLongNames()
24
24
, m_formatsShortNames()
25
+ , m_videoCodecsLongNames()
26
+ , m_videoCodecsShortNames()
27
+ , m_audioCodecsLongNames()
28
+ , m_audioCodecsShortNames()
25
29
{
26
30
// Alloc format context
27
31
m_avFormatContext = avformat_alloc_context ();
@@ -50,6 +54,42 @@ OptionLoader::OptionLoader()
50
54
}
51
55
}
52
56
}
57
+
58
+ // fill video and audio codec short and long names
59
+ AVCodec* c = NULL ;
60
+ while ( ( c = av_codec_next ( c ) ) )
61
+ {
62
+ #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 53, 34, 0 )
63
+ if ( c->encode2 )
64
+ #else
65
+ if ( c->encode )
66
+ #endif
67
+ {
68
+ switch ( c->type )
69
+ {
70
+ case AVMEDIA_TYPE_VIDEO:
71
+ {
72
+ if ( c->long_name )
73
+ {
74
+ m_videoCodecsLongNames.push_back ( std::string ( c->long_name ) );
75
+ m_videoCodecsShortNames.push_back ( std::string ( c->name ) );
76
+ }
77
+ break ;
78
+ }
79
+ case AVMEDIA_TYPE_AUDIO:
80
+ {
81
+ if ( c->long_name )
82
+ {
83
+ m_audioCodecsLongNames.push_back ( std::string ( c->long_name ) );
84
+ m_audioCodecsShortNames.push_back ( std::string ( c->name ) );
85
+ }
86
+ break ;
87
+ }
88
+ default :
89
+ break ;
90
+ }
91
+ }
92
+ }
53
93
}
54
94
55
95
OptionLoader::~OptionLoader ()
Original file line number Diff line number Diff line change @@ -54,6 +54,13 @@ class OptionLoader
54
54
55
55
std::vector<std::string>& getFormatsLongNames () { return m_formatsLongNames; }
56
56
std::vector<std::string>& getFormatsShortNames () { return m_formatsShortNames; }
57
+
58
+ std::vector<std::string>& getVideoCodecsLongNames () { return m_videoCodecsLongNames; }
59
+ std::vector<std::string>& getVideoCodecsShortNames () { return m_videoCodecsShortNames; }
60
+
61
+ std::vector<std::string>& getAudioCodecsLongNames () { return m_audioCodecsLongNames; }
62
+ std::vector<std::string>& getAudioCodecsShortNames () { return m_audioCodecsShortNames; }
63
+
57
64
private:
58
65
/* *
59
66
* @brief: load array of Option depending on the flags.
@@ -69,6 +76,12 @@ class OptionLoader
69
76
70
77
std::vector<std::string> m_formatsLongNames;
71
78
std::vector<std::string> m_formatsShortNames;
79
+
80
+ std::vector<std::string> m_videoCodecsLongNames;
81
+ std::vector<std::string> m_videoCodecsShortNames;
82
+
83
+ std::vector<std::string> m_audioCodecsLongNames;
84
+ std::vector<std::string> m_audioCodecsShortNames;
72
85
73
86
};
74
87
You can’t perform that action at this time.
0 commit comments