diff --git a/lib/PlaYUVerCmdParser.cpp b/lib/PlaYUVerCmdParser.cpp index ae9c4f8..0d9c1c8 100644 --- a/lib/PlaYUVerCmdParser.cpp +++ b/lib/PlaYUVerCmdParser.cpp @@ -62,21 +62,11 @@ po::options_description PlaYUVerCmdParser::GetCommandOpts() ( "pel_fmts", "list pixel formats" ) /**/ ( "frames,f", po::value(), "number of frames" ); - po::options_description qualityOpts( "Quality" ); - qualityOpts.add_options() /**/ - ( "quality", po::value(), "select a quality metric" ) /**/ - ( "quality_metrics", "list supported quality metrics" ); - - po::options_description moduleOpts( "Module" ); - moduleOpts.add_options() /**/ - ( "module", po::value(), "select a module" ) /**/ - ( "module_list", "list supported modules" ); - po::options_description commonOpts( "Common" ); commonOpts.add_options()/**/ ( "help", "produce help message" )/**/ ( "version", "show version and exit" ); - commonOpts.add( inputOpts ).add( qualityOpts ).add( moduleOpts ); + commonOpts.add( inputOpts ); return commonOpts; } @@ -136,16 +126,6 @@ Bool PlaYUVerCmdParser::checkListingOpts() } bRet |= true; } - - if( m_cOptionsMap.count( "quality_metrics" ) ) - { - printf( "PlaYUVer supported quality metrics: \n" ); - for( UInt i = 0; i < PlaYUVerFrame::supportedQualityMetricsList().size(); i++ ) - { - printf( " %s\n", PlaYUVerFrame::supportedQualityMetricsList()[i].c_str() ); - } - bRet |= true; - } return bRet; } diff --git a/tools/CommandLineHandle.cpp b/tools/CommandLineHandle.cpp index be0f49d..418f083 100644 --- a/tools/CommandLineHandle.cpp +++ b/tools/CommandLineHandle.cpp @@ -23,6 +23,7 @@ */ #include "CommandLineHandle.h" +#include "lib/PlaYUVerFrame.h" namespace plaYUVer { @@ -37,5 +38,39 @@ CommandLineHandle::~CommandLineHandle() } +Int CommandLineHandle::ParseToolsArgs() +{ + Int iRet = 0; + + po::options_description qualityOpts( "Quality" ); + qualityOpts.add_options() /**/ + ( "quality", po::value(), "select a quality metric" ) /**/ + ( "quality_metrics", "list supported quality metrics" ); + + po::options_description moduleOpts( "Module" ); + moduleOpts.add_options() /**/ + ( "module", po::value(), "select a module" ) /**/ + ( "module_list", "list supported modules" ); + + addOptions( qualityOpts ); + addOptions( moduleOpts ); + + if( !parse() ) + { + iRet = 1; + } + + if( getOptionsMap().count( "quality_metrics" ) ) + { + printf( "PlaYUVer supported quality metrics: \n" ); + for( UInt i = 0; i < PlaYUVerFrame::supportedQualityMetricsList().size(); i++ ) + { + printf( " %s\n", PlaYUVerFrame::supportedQualityMetricsList()[i].c_str() ); + } + iRet = 1; + } + + return iRet; +} } // NAMESPACE diff --git a/tools/CommandLineHandle.h b/tools/CommandLineHandle.h index b4a6ad6..1d8565a 100644 --- a/tools/CommandLineHandle.h +++ b/tools/CommandLineHandle.h @@ -38,6 +38,7 @@ public: CommandLineHandle(); ~CommandLineHandle(); + Int ParseToolsArgs(); }; diff --git a/tools/PlaYUVerTools.cpp b/tools/PlaYUVerTools.cpp index 1216b2d..23d9636 100644 --- a/tools/PlaYUVerTools.cpp +++ b/tools/PlaYUVerTools.cpp @@ -113,10 +113,12 @@ Int PlaYUVerTools::openOutputs() Int PlaYUVerTools::Open( Int argc, Char *argv[] ) { + Int iRet = 0; + m_cCommandLineParser.Config( argc, argv ); - if( !m_cCommandLineParser.parse() ) + if( ( iRet = m_cCommandLineParser.ParseToolsArgs() ) > 0 ) { - return 1; + return iRet; } if( openInputs() > 0 ) @@ -165,7 +167,7 @@ Int PlaYUVerTools::Open( Int argc, Char *argv[] ) printf( "No operation was selected! " ); return 2; } - return 0; + return iRet; } Int PlaYUVerTools::Process()