@@ -8,9 +8,9 @@ int main( int argc, char** argv )
8
8
{
9
9
std::string help;
10
10
help += " Usage\n " ;
11
- help += " \t avthumbnail INPUT_FILE_NAME TIME [OUTPUT_FILE_NAME] [--frame] [--help]\n " ;
11
+ help += " \t avthumbnail INPUT_FILE_NAME TIME [--output OUTPUT_FILE_NAME] [--frame] [--help]\n " ;
12
12
help += " Command line options\n " ;
13
- help += " \t OUTPUT_FILE_NAME : name of the output file (thumbnail.jpg by default)\n " ;
13
+ help += " \t --output OUTPUT_FILE_NAME : name of the output file (thumbnail.jpg by default)\n " ;
14
14
help += " \t --frame: express TIME of where to seek in frame (in seconds by default)\n " ;
15
15
help += " \t --help: display this help\n " ;
16
16
@@ -31,10 +31,19 @@ int main( int argc, char** argv )
31
31
{
32
32
seekInFrame = true ;
33
33
}
34
- }
35
- if ( argc > 3 )
36
- {
37
- outputFileName = arguments.at ( 2 );
34
+ if ( arguments.at ( argument ) == " --output" )
35
+ {
36
+ try
37
+ {
38
+ outputFileName = arguments.at ( argument + 1 );
39
+ }
40
+ catch ( const std::exception& e )
41
+ {
42
+ std::cout << " Error: need to indicate an output filename if you use option --output" << std::endl << std::endl;
43
+ std::cout << help << std::endl;
44
+ return 0 ;
45
+ }
46
+ }
38
47
}
39
48
40
49
// Check required arguments
@@ -49,12 +58,12 @@ int main( int argc, char** argv )
49
58
avtranscoder::preloadCodecsAndFormats ();
50
59
51
60
// input file
52
- std::string inputFileName ( argv[ 1 ] );
61
+ std::string inputFileName ( arguments. at ( 0 ) );
53
62
avtranscoder::InputFile intputFile ( inputFileName );
54
63
if ( seekInFrame )
55
- intputFile.seekAtFrame ( atoi ( argv[ 2 ] ) );
64
+ intputFile.seekAtFrame ( atoi ( arguments. at ( 1 ). c_str () ) );
56
65
else
57
- intputFile.seekAtTime ( atof ( argv[ 2 ] ) );
66
+ intputFile.seekAtTime ( atof ( arguments. at ( 1 ). c_str () ) );
58
67
59
68
// output file
60
69
avtranscoder::ProfileLoader::Profile formatProfile;
0 commit comments