minor changes in PlaYUVerFrame and Stream

This commit is contained in:
jfmcarreira committed 2015-02-23 18:19:59 +00:00
1 parent 11bb3dbf96
commit cbd3a65ed1
3 files changed
+11 -13

No files matched your search

+9 -11
View File
@@ -162,12 +162,14 @@ Bool PlaYUVerStream::open( std::string filename, std::string resolution, std::st
UInt height;
Int input_format = -1;
sscanf( resolution.c_str(), "%ux%u", &width, &height );
if( width <= 0 || height <= 0 )
if( resolution.size() > 0 )
{
return false;
sscanf( resolution.c_str(), "%ux%u", &width, &height );
if( width <= 0 || height <= 0 )
{
return false;
}
}
for( UInt i = 0; i < PlaYUVerFrame::supportedPixelFormatListNames().size(); i++ )
{
if( lowercase( PlaYUVerFrame::supportedPixelFormatListNames()[i] ) == lowercase( input_format_name ) )
@@ -176,11 +178,7 @@ Bool PlaYUVerStream::open( std::string filename, std::string resolution, std::st
break;
}
}
if( width > 0 && height > 0 && input_format >= 0 )
{
return open( filename, width, height, input_format, frame_rate, bInput );
}
return false;
return open( filename, width, height, input_format, frame_rate, bInput );
}
Bool PlaYUVerStream::open( std::string filename, UInt width, UInt height, Int input_format, UInt frame_rate, Bool bInput )
@@ -481,7 +479,7 @@ Void PlaYUVerStream::readFrame()
if( !m_bInit || !m_bIsInput )
return;
if( m_iCurrFrameNum + 1 >= ( Int64 )m_uiTotalFrameNum )
if( m_iCurrFrameNum + ( m_uiFrameBufferSize - 1 )>= ( Int64 )m_uiTotalFrameNum )
{
m_iErrorStatus = LAST_FRAME;
m_pcNextFrame = NULL;
@@ -598,7 +596,7 @@ Bool PlaYUVerStream::saveFrame( const std::string& filename, PlaYUVerFrame *save
else
{
cv::Mat* image;
saveFrame->getCvMat( (Void**)&image );
saveFrame->getCvMat( ( Void** )&image );
return cv::imwrite( filename, *image );
}