Seperate command opts by app

This commit is contained in:
2015-02-24 01:53:54 +00:00
parent e924a06a9e
commit 40aa4f95f3
4 changed files with 42 additions and 24 deletions
+1 -21
View File
@@ -62,21 +62,11 @@ po::options_description PlaYUVerCmdParser::GetCommandOpts()
( "pel_fmts", "list pixel formats" ) /**/
( "frames,f", po::value<UInt>(), "number of frames" );
po::options_description qualityOpts( "Quality" );
qualityOpts.add_options() /**/
( "quality", po::value<std::string>(), "select a quality metric" ) /**/
( "quality_metrics", "list supported quality metrics" );
po::options_description moduleOpts( "Module" );
moduleOpts.add_options() /**/
( "module", po::value<std::string>(), "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;
}
+35
View File
@@ -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<std::string>(), "select a quality metric" ) /**/
( "quality_metrics", "list supported quality metrics" );
po::options_description moduleOpts( "Module" );
moduleOpts.add_options() /**/
( "module", po::value<std::string>(), "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
+1
View File
@@ -38,6 +38,7 @@ public:
CommandLineHandle();
~CommandLineHandle();
Int ParseToolsArgs();
};
+5 -3
View File
@@ -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()