File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ OptionLoader::OptionLoader()
20
20
, m_avCodecContext( NULL )
21
21
, m_outputFormat( NULL )
22
22
, m_codec( NULL )
23
+ , m_formatsLongNames()
24
+ , m_formatsShortNames()
23
25
{
24
26
// Alloc format context
25
27
m_avFormatContext = avformat_alloc_context ();
@@ -33,6 +35,21 @@ OptionLoader::OptionLoader()
33
35
AVCodec* avCodec = NULL ;
34
36
m_avCodecContext = avcodec_alloc_context3 ( avCodec );
35
37
#endif
38
+
39
+ // fill format short and long names
40
+ AVOutputFormat* fmt = NULL ;
41
+ while ( ( fmt = av_oformat_next ( fmt ) ) )
42
+ {
43
+ // add only format with video track
44
+ if ( fmt->video_codec != AV_CODEC_ID_NONE )
45
+ {
46
+ if ( fmt->long_name )
47
+ {
48
+ m_formatsLongNames.push_back ( std::string ( fmt->long_name ) + std::string ( " (" ) + std::string ( fmt->name ) + std::string ( " )" ) );
49
+ m_formatsShortNames.push_back ( std::string ( fmt->name ) );
50
+ }
51
+ }
52
+ }
36
53
}
37
54
38
55
OptionLoader::~OptionLoader ()
Original file line number Diff line number Diff line change @@ -51,6 +51,9 @@ class OptionLoader
51
51
OptionMap loadOutputFormatOptions ();
52
52
OptionMap loadVideoCodecOptions ();
53
53
OptionMap loadAudioCodecOptions ();
54
+
55
+ std::vector<std::string>& getFormatsLongNames () { return m_formatsLongNames; }
56
+ std::vector<std::string>& getFormatsShortNames () { return m_formatsShortNames; }
54
57
private:
55
58
/* *
56
59
* @brief: load array of Option depending on the flags.
@@ -63,6 +66,9 @@ class OptionLoader
63
66
64
67
AVOutputFormat* m_outputFormat;
65
68
AVCodec* m_codec;
69
+
70
+ std::vector<std::string> m_formatsLongNames;
71
+ std::vector<std::string> m_formatsShortNames;
66
72
67
73
};
68
74
You can’t perform that action at this time.
0 commit comments