Add support for log messages. Show them inside the MdiArea

This commit is contained in:
jfmcarreira committed 2015-04-12 21:53:06 +01:00
1 parent dd5b694102
commit e63075119b
10 files changed
+90 -53

No files matched your search

+22 -23
View File
@@ -81,14 +81,14 @@ Int PlaYUVerTools::openInputs()
{
if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, 8, 1 ) )
{
m_cCmdLineHandler.log( CommandLineHandle::ERROR, "Cannot open input stream %s! ", inputFileNames[i].c_str() );
m_cCmdLineHandler.log( LOG_ERROR, "Cannot open input stream %s! ", inputFileNames[i].c_str() );
return 2;
}
m_apcInputStreams.push_back( pcStream );
}
catch( const char *msg )
{
m_cCmdLineHandler.log( CommandLineHandle::ERROR, "Cannot open input stream %s with the following error: \n%s\n", inputFileNames[i].c_str(), msg );
m_cCmdLineHandler.log( LOG_ERROR, "Cannot open input stream %s with the following error: \n%s\n", inputFileNames[i].c_str(), msg );
return 2;
}
}
@@ -134,7 +134,7 @@ Int PlaYUVerTools::Open( Int argc, Char *argv[] )
std::string qualityMetric = m_cCmdLineHandler.m_strQualityMetric;
// if( m_apcInputStreams.size() != 2 )
// {
// m_cCmdLineHandler.log( CommandLineHandle::ERROR, "Invalid number of inputs! " );
// m_cCmdLineHandler.log( LOG_ERROR, "Invalid number of inputs! " );
// return 2;
// }
for( UInt i = 0; i < PlaYUVerFrame::supportedQualityMetricsList().size(); i++ )
@@ -146,12 +146,12 @@ Int PlaYUVerTools::Open( Int argc, Char *argv[] )
}
if( m_uiQualityMetric == -1 )
{
m_cCmdLineHandler.log( CommandLineHandle::ERROR, "Invalid quality metric! " );
m_cCmdLineHandler.log( LOG_ERROR, "Invalid quality metric! " );
return 2;
}
m_uiOperation = QUALITY_OPERATION;
m_fpProcess = &PlaYUVerTools::QualityOperation;
m_cCmdLineHandler.log( CommandLineHandle::INFO, "PlaYUVer Quality\n" );
m_cCmdLineHandler.log( LOG_INFO, "PlaYUVer Quality\n" );
}
/**
@@ -174,7 +174,7 @@ Int PlaYUVerTools::Open( Int argc, Char *argv[] )
if( m_apcInputStreams.size() != m_pcCurrModuleIf->m_uiNumberOfFrames )
{
m_cCmdLineHandler.log( CommandLineHandle::ERROR, "Invalid number of inputs! " );
m_cCmdLineHandler.log( LOG_ERROR, "Invalid number of inputs! " );
return 2;
}
@@ -198,7 +198,7 @@ Int PlaYUVerTools::Open( Int argc, Char *argv[] )
}
if( !moduleCreated )
{
m_cCmdLineHandler.log( CommandLineHandle::ERROR, "Module is not supported with the selected inputs! " );
m_cCmdLineHandler.log( LOG_ERROR, "Module is not supported with the selected inputs! " );
return 2;
}
@@ -231,19 +231,19 @@ Int PlaYUVerTools::Open( Int argc, Char *argv[] )
}
else
{
m_cCmdLineHandler.log( CommandLineHandle::ERROR, "One output is required! " );
m_cCmdLineHandler.log( LOG_ERROR, "One output is required! " );
return 2;
}
}
m_uiOperation = MODULE_OPERATION;
m_fpProcess = &PlaYUVerTools::ModuleOperation;
m_cCmdLineHandler.log( CommandLineHandle::INFO, "PlaYUVer Module\n" );
m_cCmdLineHandler.log( LOG_INFO, "PlaYUVer Module\n" );
}
if( m_uiOperation == INVALID_OPERATION )
{
m_cCmdLineHandler.log( CommandLineHandle::ERROR, "No operation was selected! " );
m_cCmdLineHandler.log( LOG_ERROR, "No operation was selected! " );
return 2;
}
return iRet;
@@ -267,8 +267,7 @@ Int PlaYUVerTools::QualityOperation()
Double adAverageQuality[MAX_NUMBER_INPUTS - 1][MAX_NUMBER_COMPONENTS];
Double dQuality;
m_cCmdLineHandler.log( CommandLineHandle::INFO, " Measuring Quality using %s ... \n",
PlaYUVerFrame::supportedQualityMetricsList()[m_uiQualityMetric].c_str() );
m_cCmdLineHandler.log( LOG_INFO, " Measuring Quality using %s ... \n", PlaYUVerFrame::supportedQualityMetricsList()[m_uiQualityMetric].c_str() );
for( UInt s = 0; s < m_apcInputStreams.size(); s++ )
{
@@ -280,21 +279,21 @@ Int PlaYUVerTools::QualityOperation()
}
for( UInt frame = 0; frame < m_uiNumberOfFrames; frame++ )
{
m_cCmdLineHandler.log( CommandLineHandle::INFO, " %3d", frame );
m_cCmdLineHandler.log( LOG_INFO, " %3d", frame );
for( UInt s = 0; s < m_apcInputStreams.size(); s++ )
apcCurrFrame[s] = m_apcInputStreams[s]->getCurrFrame();
for( UInt s = 1; s < m_apcInputStreams.size(); s++ )
{
m_cCmdLineHandler.log( CommandLineHandle::RESULT, " " );
m_cCmdLineHandler.log( LOG_RESULT, " " );
for( UInt c = 0; c < m_uiNumberOfComponents; c++ )
{
dQuality = apcCurrFrame[s]->getQuality( m_uiQualityMetric, apcCurrFrame[0], c );
adAverageQuality[s - 1][c] = ( adAverageQuality[s - 1][c] * Double( frame ) + dQuality ) / Double( frame + 1 );
m_cCmdLineHandler.log( CommandLineHandle::RESULT, " %5.3f", dQuality );
m_cCmdLineHandler.log( LOG_RESULT, " %5.3f", dQuality );
}
}
m_cCmdLineHandler.log( CommandLineHandle::RESULT, "\n" );
m_cCmdLineHandler.log( LOG_RESULT, "\n" );
for( UInt s = 0; s < m_apcInputStreams.size(); s++ )
{
abEOF[s] = m_apcInputStreams[s]->setNextFrame();
@@ -304,15 +303,15 @@ Int PlaYUVerTools::QualityOperation()
}
}
}
m_cCmdLineHandler.log( CommandLineHandle::INFO, "\n Mean Values: \n " );
m_cCmdLineHandler.log( LOG_INFO, "\n Mean Values: \n " );
for( UInt s = 0; s < m_apcInputStreams.size() - 1; s++ )
{
for( UInt c = 0; c < m_uiNumberOfComponents; c++ )
{
m_cCmdLineHandler.log( CommandLineHandle::INFO, " %5.3f", adAverageQuality[s][c] );
m_cCmdLineHandler.log( LOG_INFO, " %5.3f", adAverageQuality[s][c] );
}
}
m_cCmdLineHandler.log( CommandLineHandle::INFO, "\n" );
m_cCmdLineHandler.log( LOG_INFO, "\n" );
return 0;
}
@@ -329,7 +328,7 @@ PlaYUVerFrame* PlaYUVerTools::applyFrameModule()
Int PlaYUVerTools::ModuleOperation()
{
std::vector<PlaYUVerFrame*> apcFrameList;
m_cCmdLineHandler.log( CommandLineHandle::INFO, " Applying Module %s/%s ...\n", m_pcCurrModuleIf->m_pchModuleCategory, m_pcCurrModuleIf->m_pchModuleName );
m_cCmdLineHandler.log( LOG_INFO, " Applying Module %s/%s ...\n", m_pcCurrModuleIf->m_pchModuleCategory, m_pcCurrModuleIf->m_pchModuleName );
PlaYUVerFrame* pcProcessedFrame = NULL;
Double dMeasurementResult = 0.0;
@@ -370,8 +369,8 @@ Int PlaYUVerTools::ModuleOperation()
{
dMeasurementResult = m_pcCurrModuleIf->measure( m_apcInputStreams[0]->getCurrFrame() );
}
m_cCmdLineHandler.log( CommandLineHandle::INFO, " %3d", frame );
m_cCmdLineHandler.log( CommandLineHandle::RESULT, " %8.3f \n", dMeasurementResult );
m_cCmdLineHandler.log( LOG_INFO, " %3d", frame );
m_cCmdLineHandler.log( LOG_RESULT, " %8.3f \n", dMeasurementResult );
dAveragedMeasurementResult = ( dAveragedMeasurementResult * Double( frame ) + dMeasurementResult ) / Double( frame + 1 );
}
@@ -387,7 +386,7 @@ Int PlaYUVerTools::ModuleOperation()
if( m_pcCurrModuleIf->m_iModuleType == FRAME_MEASUREMENT_MODULE )
{
m_cCmdLineHandler.log( CommandLineHandle::INFO, "\n Mean Value: \n %8.3f\n", dAveragedMeasurementResult );
m_cCmdLineHandler.log( LOG_INFO, "\n Mean Value: \n %8.3f\n", dAveragedMeasurementResult );
}
return 0;