minor changes in PlaYUVerFrame and Stream

This commit is contained in:
jfmcarreira committed 2015-02-23 18:21:43 +00:00
1 parent b176f98f0e
commit 66a3764d48
3 files changed
+11 -12

No files matched your search

+9 -10
View File
@@ -162,10 +162,13 @@ 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++ )
{
@@ -175,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 )
@@ -480,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;
@@ -597,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 );
}