1
- #include < AvTranscoder/option/OptionLoader.hpp>
1
+ #include < AvTranscoder/util.hpp>
2
+ #include < AvTranscoder/option/Context.hpp>
3
+ #include < AvTranscoder/option/CodecContext.hpp>
2
4
#include < AvTranscoder/option/Option.hpp>
5
+ #include < AvTranscoder/file/InputFile.hpp>
3
6
4
7
#include < string>
5
8
#include < iostream>
6
9
#include < map>
7
10
#include < vector>
8
- #include < utility> // pair
11
+ #include < utility>
9
12
10
- void displayOptions ( avtranscoder::OptionLoader::OptionArray & options )
13
+ void displayOptions ( const std::vector<avtranscoder::Option> & options )
11
14
{
12
15
for ( auto option : options )
13
16
{
@@ -20,74 +23,89 @@ void displayOptions( avtranscoder::OptionLoader::OptionArray& options )
20
23
21
24
// get default value
22
25
23
- if ( option.getType () == avtranscoder::TypeInt )
26
+ if ( option.getType () == avtranscoder::eOptionBaseTypeInt )
24
27
{
25
- std::cout << " DefaultValue: " << option.getDefaultValueInt () << std::endl;
28
+ std::cout << " DefaultValue: " << option.getDefaultInt () << std::endl;
26
29
}
27
- else if ( option.getType () == avtranscoder::TypeBool )
30
+ else if ( option.getType () == avtranscoder::eOptionBaseTypeBool )
28
31
{
29
- std::cout << " DefaultValue: " << option.getDefaultValueBool () << std::endl;
32
+ std::cout << " DefaultValue: " << option.getDefaultBool () << std::endl;
30
33
}
31
- else if ( option.getType () == avtranscoder::TypeDouble )
34
+ else if ( option.getType () == avtranscoder::eOptionBaseTypeDouble )
32
35
{
33
- std::cout << " DefaultValue: " << option.getDefaultValueDouble () << std::endl;
36
+ std::cout << " DefaultValue: " << option.getDefaultDouble () << std::endl;
34
37
}
35
- else if ( option.getType () == avtranscoder::TypeRatio )
38
+ else if ( option.getType () == avtranscoder::eOptionBaseTypeRatio )
36
39
{
37
- std::cout << " DefaultValue: " << option.getDefaultValueRatio ().first << " , " << option.getDefaultValueRatio ().second << std::endl;
40
+ std::cout << " DefaultValue: " << option.getDefaultRatio ().first << " , " << option.getDefaultRatio ().second << std::endl;
38
41
}
39
- else if ( option.getType () == avtranscoder::TypeString )
42
+ else if ( option.getType () == avtranscoder::eOptionBaseTypeString )
40
43
{
41
- std::cout << " DefaultValue: " << option.getDefaultValueString () << std::endl;
44
+ std::cout << " DefaultValue: " << option.getDefaultString () << std::endl;
42
45
}
43
- else if ( option.getType () == avtranscoder::TypeChoice )
46
+ else if ( option.getType () == avtranscoder::eOptionBaseTypeChoice )
44
47
{
45
- std::cout << " Nb choices: " << option.getNbChilds () << std::endl;
48
+ std::cout << " Nb choices: " << option.getChilds (). size () << std::endl;
46
49
std::cout << " Default choice index: " << option.getDefaultChildIndex () << std::endl;
47
- for (size_t i = 0 ; i < option.getNbChilds (); ++i )
50
+ for (size_t i = 0 ; i < option.getChilds (). size (); ++i )
48
51
std::cout << " Choice " << i << " : " <<
49
- option.getChild ( i ).getName () << " // " <<
50
- option.getChild ( i ).getHelp () << std::endl;
52
+ option.getChildAtIndex ( i ).getName () << " // " <<
53
+ option.getChildAtIndex ( i ).getHelp () << std::endl;
51
54
}
52
- else if ( option.getType () == avtranscoder::TypeGroup )
55
+ else if ( option.getType () == avtranscoder::eOptionBaseTypeGroup )
53
56
{
54
- std::cout << " Nb choices: " << option.getNbChilds () << std::endl;
55
- for (size_t i = 0 ; i < option.getNbChilds (); ++i )
57
+ std::cout << " Nb choices: " << option.getChilds (). size () << std::endl;
58
+ for (size_t i = 0 ; i < option.getChilds (). size (); ++i )
56
59
std::cout << " Element " << i << " : " <<
57
- option.getChild ( i ).getName () << " // " <<
58
- option.getChild ( i ).getDefaultValueBool () << std::endl;
60
+ option.getChildAtIndex ( i ).getName () << " // " <<
61
+ option.getChildAtIndex ( i ).getDefaultBool () << std::endl;
59
62
}
60
63
}
61
64
}
62
65
63
66
void optionChecker ( const std::string& inputfilename )
64
- {
65
- avtranscoder::OptionLoader optionLoader;
66
-
67
- // avtranscoder::OptionLoader::OptionArray optionsArray = optionLoader.loadOptions( AV_OPT_FLAG_AUDIO_PARAM );
68
- avtranscoder::OptionLoader::OptionMap optionsMap = optionLoader.loadOutputFormatOptions ();
69
-
70
- // displayOptions( optionsArray );
71
- for ( avtranscoder::OptionLoader::OptionMap::iterator it = optionsMap.begin ();
72
- it != optionsMap.end ();
73
- ++it )
74
- {
75
- std::cout << " ----- " << it->first << " -----" << std::endl;
76
- displayOptions ( it->second );
77
- }
67
+ {
68
+ avtranscoder::InputFile file ( inputfilename );
69
+
70
+ // format options
71
+ avtranscoder::Context formatContext ( &file.getFormatContext () );
72
+ std::vector<avtranscoder::Option> formatOptions = formatContext.getOptions ();
73
+ displayOptions ( formatOptions );
74
+
75
+ // codec options
76
+ avtranscoder::CodecContext codecContext ( AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM );
77
+ std::vector<avtranscoder::Option> codecOptions = codecContext.getOptions ();
78
+ displayOptions ( codecOptions );
79
+
80
+ // pixel formats
81
+ // std::vector<std::string> pixelFormats = avtranscoder::getPixelFormats();
82
+ // for( size_t i = 0; i < pixelFormats.size(); ++i )
83
+ // {
84
+ // std::cout << "----- " << pixelFormats[i] << " -----" << std::endl;
85
+ // }
86
+
87
+ // options per format
88
+ // std::map< std::string, std::vector<avtranscoder::Option> > optionsPerFormat = avtranscoder::getOutputFormatOptions();
89
+ // for( std::map< std::string, std::vector<avtranscoder::Option> >::iterator it = optionsPerFormat.begin();
90
+ // it != optionsPerFormat.end();
91
+ // ++it )
92
+ // {
93
+ // std::cout << "----- " << it->first << " -----" << std::endl;
94
+ // displayOptions( it->second );
95
+ // }
78
96
}
79
97
80
98
int main ( int argc, char ** argv )
81
99
{
100
+ std::cout << " start ..." << std::endl;
101
+
82
102
if ( argc <= 1 )
83
103
{
84
104
std::cout << " audiorewrapper require a media filename" << std::endl;
85
105
std::cout << " example: audioWrap file.ext" << std::endl;
86
106
return ( -1 );
87
107
}
88
108
89
- std::cout << " start ..." << std::endl;
90
-
91
109
try
92
110
{
93
111
optionChecker ( argv[1 ] );
0 commit comments