From d4d3b11c3aee15be2b4548b932929728d6ccb531 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Wed, 25 Jun 2014 03:34:19 +0100 Subject: [PATCH] Fix problem with the ffmpeg handling --- source/lib/PlaYUVerStream.cpp | 22 ++++++++++++---------- source/lib/PlaYUVerStream.h | 8 +++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source/lib/PlaYUVerStream.cpp b/source/lib/PlaYUVerStream.cpp index d7aa028..5176e91 100644 --- a/source/lib/PlaYUVerStream.cpp +++ b/source/lib/PlaYUVerStream.cpp @@ -57,6 +57,8 @@ PlaYUVerStream::PlaYUVerStream() m_uiFrameBufferSize = 2; m_uiFrameBufferIndex = 0; m_uiAveragePlayInterval = 0; + + m_cLibAvContext = NULL; } PlaYUVerStream::~PlaYUVerStream() @@ -145,9 +147,9 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ #ifdef USE_FFMPEG if( m_bIsInput && QFileInfo( filename ).suffix().compare( QString( "yuv" ) ) ) { - avStatus = m_cLibAvContext.initAvFormat( m_cFilename.toLocal8Bit().data(), m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate, m_uiTotalFrameNum ); + avStatus = m_cLibAvContext->initAvFormat( m_cFilename.toLocal8Bit().data(), m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate, m_uiTotalFrameNum ); m_cFormatName = QFileInfo( filename ).completeSuffix().toUpper(); - m_cCodedName = QString::fromUtf8( m_cLibAvContext.getCodecName() ).toUpper(); + m_cCodedName = QString::fromUtf8( m_cLibAvContext->getCodecName() ).toUpper(); } #endif @@ -237,7 +239,7 @@ Void PlaYUVerStream::close() fclose( m_pFile ); #ifdef USE_FFMPEG - m_cLibAvContext.closeAvFormat(); + m_cLibAvContext->closeAvFormat(); #endif if( m_ppcFrameBuffer ) @@ -367,9 +369,9 @@ Void PlaYUVerStream::getDuration( Int* duration_array ) { Int hours, mins, secs; #ifdef USE_FFMPEG - if( m_cLibAvContext.getStatus() ) + if( m_cLibAvContext->getStatus() ) { - secs = m_cLibAvContext.getStreamDuration(); + secs = m_cLibAvContext->getStreamDuration(); } else #endif @@ -403,10 +405,10 @@ Void PlaYUVerStream::readFrame() } #ifdef USE_FFMPEG - if( m_cLibAvContext.getStatus() ) + if( m_cLibAvContext->getStatus() ) { - m_cLibAvContext.decodeAvFormat(); - m_pcNextFrame->FrameFromBuffer( m_cLibAvContext.video_dst_data[0], m_iPixelFormat ); + m_cLibAvContext->decodeAvFormat(); + m_pcNextFrame->FrameFromBuffer( m_cLibAvContext->video_dst_data[0], m_iPixelFormat ); } else #endif @@ -506,9 +508,9 @@ Void PlaYUVerStream::seekInput( UInt64 new_frame_num ) return; } #ifdef USE_FFMPEG - if( m_cLibAvContext.getStatus() ) + if( m_cLibAvContext->getStatus() ) { - m_cLibAvContext.seekAvFormat( new_frame_num ); + m_cLibAvContext->seekAvFormat( new_frame_num ); } else #endif diff --git a/source/lib/PlaYUVerStream.h b/source/lib/PlaYUVerStream.h index 5a6c298..72d079d 100644 --- a/source/lib/PlaYUVerStream.h +++ b/source/lib/PlaYUVerStream.h @@ -31,11 +31,11 @@ #include #include "PlaYUVerFrame.h" -class LibAvContextHandle; - namespace plaYUVer { +class LibAvContextHandle; + class PlaYUVerStream { private: @@ -45,9 +45,7 @@ private: Bool m_bLoadAll; Int m_iErrorStatus; -#ifdef USE_FFMPEG - LibAvContextHandle m_cLibAvContext; -#endif + LibAvContextHandle* m_cLibAvContext; QString m_cFilename; QString m_cFormatName;