diff --git a/lib/PlaYUVerFrame.cpp b/lib/PlaYUVerFrame.cpp index 854f8ec..e546cba 100644 --- a/lib/PlaYUVerFrame.cpp +++ b/lib/PlaYUVerFrame.cpp @@ -120,7 +120,7 @@ Int PlaYUVerFrame::getColorSpace() const return m_pcPelFormat->colorSpace; } -Int PlaYUVerFrame::getNumberChannels() const +UInt PlaYUVerFrame::getNumberChannels() const { return m_pcPelFormat->numberChannels; } diff --git a/lib/PlaYUVerFrame.h b/lib/PlaYUVerFrame.h index a3824b1..d0562a4 100644 --- a/lib/PlaYUVerFrame.h +++ b/lib/PlaYUVerFrame.h @@ -102,7 +102,7 @@ public: static UInt64 getBytesPerFrame( UInt, UInt, Int ); Int getColorSpace() const; - Int getNumberChannels() const; + UInt getNumberChannels() const; UInt getChromaWidth() const; UInt getChromaHeight() const; UInt getChromaLength() const; diff --git a/lib/PlaYUVerStream.cpp b/lib/PlaYUVerStream.cpp index 2d5d1c6..6ce5d58 100644 --- a/lib/PlaYUVerStream.cpp +++ b/lib/PlaYUVerStream.cpp @@ -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 ); }