File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -68,8 +68,40 @@ std::vector<std::string> getInputExtensions()
68
68
69
69
std::vector<std::string> getOutputExtensions ()
70
70
{
71
+ av_register_all ();
71
72
std::vector<std::string> extensions;
73
+ AVOutputFormat* oFormat = NULL ;
72
74
75
+ while ( ( oFormat = av_oformat_next ( oFormat ) ) )
76
+ {
77
+ if ( oFormat->extensions != NULL )
78
+ {
79
+ // parse extensions
80
+ std::string exts = std::string ( oFormat->extensions );
81
+ char * ext = strtok ( const_cast <char *>( exts.c_str () ), " ," );
82
+ while ( ext != NULL )
83
+ {
84
+ extensions.push_back ( std::string ( ext ) );
85
+ ext = strtok ( NULL , " ," );
86
+ }
87
+
88
+ // parse name (name's format defines (in general) extensions )
89
+ // don't need to do it in recent LibAV/FFMpeg versions
90
+ exts = std::string ( oFormat->name );
91
+ ext = strtok ( const_cast <char *>( exts.c_str () ), " ," );
92
+ while ( ext != NULL )
93
+ {
94
+ extensions.push_back ( std::string ( ext ) );
95
+ ext = strtok ( NULL , " ," );
96
+ }
97
+ }
98
+ }
99
+ // sort
100
+ std::sort ( extensions.begin (), extensions.end () );
101
+ // suppress duplicates
102
+ std::vector<std::string>::iterator last = std::unique ( extensions.begin (), extensions.end () );
103
+ extensions.erase ( last, extensions.end () );
104
+
73
105
return extensions;
74
106
}
75
107
You can’t perform that action at this time.
0 commit comments