1
1
#include < AvTranscoder/InputFile.hpp>
2
2
#include < AvTranscoder/DatasStructures/AudioDesc.hpp>
3
3
4
- #include < AvTranscoder/Options/OptionGroup.hpp>
5
- #include < AvTranscoder/Options/OptionChoice.hpp>
6
4
#include < AvTranscoder/OptionLoader.hpp>
7
5
8
- extern " C" {
9
- #ifndef __STDC_CONSTANT_MACROS
10
- #define __STDC_CONSTANT_MACROS
11
- #endif
12
- #include < libavutil/opt.h>
13
- }
14
-
15
6
#include < string>
16
7
#include < iostream>
17
8
#include < iomanip>
@@ -32,58 +23,48 @@ int optionChecker( const std::string& inputfilename )
32
23
{
33
24
std::cout << std::left;
34
25
std::cout << " ****************************" << std::endl;
35
- std::cout << std::setw (30 ) << option-> getName ();
36
- std::cout << " : " << option-> getHelp () << std::endl;
37
- std::cout << " Type: " << option-> getType () << std::endl;
26
+ std::cout << std::setw (30 ) << option. getName ();
27
+ std::cout << " : " << option. getHelp () << std::endl;
28
+ std::cout << " Type: " << option. getType () << std::endl;
38
29
39
30
// get default value
40
- int valueInt;
41
- double valueDouble;
42
- std::string valueStr;
43
- bool valueBool;
44
- std::pair<int , int > value2D;
45
31
46
- if ( option-> getType () == " OptionInt " )
32
+ if ( option. getType () == avtranscoder::TypeInt )
47
33
{
48
- std::cout << " DefaultValue: " << option-> getDefaultValue ( valueInt ) << std::endl;
34
+ std::cout << " DefaultValue: " << option. getDefaultValueInt ( ) << std::endl;
49
35
}
50
- else if ( option-> getType () == " OptionBoolean " )
36
+ else if ( option. getType () == avtranscoder::TypeBool )
51
37
{
52
- std::cout << " DefaultValue: " << option-> getDefaultValue ( valueBool ) << std::endl;
38
+ std::cout << " DefaultValue: " << option. getDefaultValueBool ( ) << std::endl;
53
39
}
54
- else if ( option-> getType () == " OptionDouble " )
40
+ else if ( option. getType () == avtranscoder::TypeDouble )
55
41
{
56
- std::cout << " DefaultValue: " << option-> getDefaultValue ( valueDouble ) << std::endl;
42
+ std::cout << " DefaultValue: " << option. getDefaultValueDouble ( ) << std::endl;
57
43
}
58
- else if ( option-> getType () == " OptionRatio " )
44
+ else if ( option. getType () == avtranscoder::TypeRatio )
59
45
{
60
- option->getDefaultValue ( value2D );
61
- std::cout << " DefaultValue: " << value2D.first << " , " << value2D.second << std::endl;
46
+ std::cout << " DefaultValue: " << option.getDefaultValueRatio ().first << " , " << option.getDefaultValueRatio ().second << std::endl;
62
47
}
63
- else if ( option-> getType () == " OptionString " )
48
+ else if ( option. getType () == avtranscoder::TypeString )
64
49
{
65
- std::cout << " DefaultValue: " << option-> getDefaultValue ( valueStr ) << std::endl;
50
+ std::cout << " DefaultValue: " << option. getDefaultValueString ( ) << std::endl;
66
51
}
67
- else if ( option-> getType () == " OptionChoice " )
52
+ else if ( option. getType () == avtranscoder::TypeChoice )
68
53
{
69
- std::cout << " DefaultValue: " << option->getDefaultValue ( valueDouble ) << std::endl;
70
-
71
- avtranscoder::OptionChoice* choice = dynamic_cast <avtranscoder::OptionChoice*>( option );
72
- std::cout << " Nb choices: " << choice->getNbChoices () << std::endl;
73
- std::cout << " Default choice index: " << choice->getDefaultChoiceIndex () << std::endl;
74
- for (size_t i = 0 ; i < choice->getNbChoices (); ++i )
75
- std::cout << " Choice " << i << " : " << choice->getChoice ( i ).first << " // " << choice->getChoice ( i ).second << std::endl;
54
+ std::cout << " Nb choices: " << option.getNbChilds () << std::endl;
55
+ std::cout << " Default choice index: " << option.getDefaultChildIndex () << std::endl;
56
+ for (size_t i = 0 ; i < option.getNbChilds (); ++i )
57
+ std::cout << " Choice " << i << " : " <<
58
+ option.getChild ( i ).getName () << " // " <<
59
+ option.getChild ( i ).getHelp () << std::endl;
76
60
}
77
- else if ( option-> getType () == " OptionGroup " )
61
+ else if ( option. getType () == avtranscoder::TypeGroup )
78
62
{
79
- std::cout << " DefaultValue: " << option->getDefaultValue ( valueInt ) << std::endl;
80
-
81
- avtranscoder::OptionGroup* group = dynamic_cast <avtranscoder::OptionGroup*>( option );
82
- std::cout << " Nb choices: " << group->getNbElements () << std::endl;
83
- for (size_t i = 0 ; i < group->getNbElements (); ++i )
63
+ std::cout << " Nb choices: " << option.getNbChilds () << std::endl;
64
+ for (size_t i = 0 ; i < option.getNbChilds (); ++i )
84
65
std::cout << " Element " << i << " : " <<
85
- group-> getElement ( i ).getName () << " // " <<
86
- group-> getElement ( i ).getDefaultValue ( valueBool ) << std::endl;
66
+ option. getChild ( i ).getName () << " // " <<
67
+ option. getChild ( i ).getDefaultValueBool ( ) << std::endl;
87
68
}
88
69
}
89
70
}
@@ -109,4 +90,4 @@ int main( int argc, char** argv )
109
90
}
110
91
111
92
std::cout << " end ..." << std::endl;
112
- }
93
+ }
0 commit comments