Improve handling of help switch in enc test app

welsenc.exe -h is now a valid command which returns success.

No longer prints help text twice in the case when the -h switch
is given along with a wrong cfg.
This commit is contained in:
Varun B Patil 2013-12-16 08:41:54 +05:30
parent e307cbb6a1
commit e65525d7b4

View File

@ -451,11 +451,11 @@ int ParseCommandLine (int argc, char** argv, SVCEncodingParam& sParam) {
void PrintHelp() {
printf ("\n Wels SVC Encoder Usage:\n\n");
printf (" Syntax: welsenc.exe -h\n");
printf (" Syntax: welsenc.exe welsenc.cfg\n");
printf (" Syntax: welsenc.exe welsenc.cfg [options]\n");
printf ("\n Supported Options:\n");
printf (" -h Print Help\n");
printf (" -bf Bit Stream File\n");
printf (" -frms Number of total frames to be encoded\n");
printf (" -gop GOPSize - GOP size (2,4,8,16,32,64, default: 1)\n");
@ -497,10 +497,6 @@ int ParseCommandLine (int argc, char** argv, SWelsSvcCodingParam& pSvcParam, SFi
while (n < argc) {
pCommand = argv[n++];
if (!strcmp (pCommand, "-h")) { // confirmed_safe_unsafe_usage
PrintHelp();
continue;
}
if (!strcmp (pCommand, "-bf")) { // confirmed_safe_unsafe_usage
sFileSet.strBsFile.assign (argv[n]);
++ n;
@ -1420,14 +1416,15 @@ int main (int argc, char** argv)
} else {
string strCfgFileName = argv[1];
basic_string <char>::size_type index;
static const basic_string <char>::size_type npos = size_t (-1);
index = strCfgFileName.rfind (".cfg"); // check configuration type (like .cfg?)
if (index == npos) {
if (index == std::string::npos) {
if (argc > 2) {
iRet = ProcessEncodingSvcWithParam (pSVCEncoder, argc, argv);
if (iRet != 0)
goto exit;
} else {
} else if (argc == 2 && ! strcmp(argv[1], "-h"))
PrintHelp();
else {
cout << "You specified pCommand is invalid!!" << endl;
goto exit;
}