diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 3c8b9e3..74a383b 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -109,6 +109,12 @@ VideoSubWindow::~VideoSubWindow() delete m_pCurrStream; } +Void VideoSubWindow::loadAll() +{ + m_pCurrStream->loadAll(); + refreshFrame(); +} + Void VideoSubWindow::reloadFile() { Int currFrameNum = m_pCurrStream->getCurrFrameNum(); diff --git a/app/VideoSubWindow.h b/app/VideoSubWindow.h index 8cee14c..6000295 100644 --- a/app/VideoSubWindow.h +++ b/app/VideoSubWindow.h @@ -104,6 +104,7 @@ public: Bool loadFile( QString cFilename, Bool bForceDialog = false ); Bool loadFile( PlaYUVerStreamInfo* streamInfo ); + Void loadAll( ); Void reloadFile(); Bool save( QString filename ); diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index c958294..96d1823 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -357,7 +357,7 @@ Void plaYUVerApp::loadAll() if( m_pcCurrentVideoSubWindow ) { statusBar()->showMessage( tr( "Loading file into memory ..." ) ); - m_pcCurrentVideoSubWindow->getInputStream()->loadAll(); + m_pcCurrentVideoSubWindow->loadAll(); statusBar()->showMessage( tr( "File loaded" ), 2000 ); } } diff --git a/lib/PlaYUVerStream.cpp b/lib/PlaYUVerStream.cpp index 461b2a8..558c4b5 100644 --- a/lib/PlaYUVerStream.cpp +++ b/lib/PlaYUVerStream.cpp @@ -441,14 +441,16 @@ Void PlaYUVerStream::loadAll() m_pcCurrFrame = m_ppcFrameBuffer[m_uiFrameBufferIndex]; m_iCurrFrameNum = -1; seekInput( 0 ); - setNextFrame(); - for( UInt i = m_uiFrameBufferIndex; i < m_uiFrameBufferSize; i++ ) + for( UInt i = m_uiFrameBufferIndex + 1; i < m_uiFrameBufferSize; i++ ) { + m_pcNextFrame = m_ppcFrameBuffer[i]; readFrame(); - setNextFrame(); } m_bLoadAll = true; - seekInput( 0 ); + m_uiFrameBufferIndex = 0; + m_pcNextFrame = m_ppcFrameBuffer[m_uiFrameBufferIndex]; + m_iCurrFrameNum = -1; + setNextFrame(); } Void PlaYUVerStream::getDuration( Int* duration_array ) @@ -475,10 +477,10 @@ Void PlaYUVerStream::getDuration( Int* duration_array ) Void PlaYUVerStream::readFrame() { - if( !m_bInit || !m_bIsInput ) + if( !m_bInit || !m_bIsInput || m_bLoadAll ) return; - if( ( m_iCurrFrameNum + ( m_uiFrameBufferSize - 1 ) >= ( Int64 )m_uiTotalFrameNum ) || m_bLoadAll ) + if( ( m_iCurrFrameNum + ( m_uiFrameBufferSize - 1 ) >= ( Int64 )m_uiTotalFrameNum ) ) { m_pcNextFrame = NULL; return;