From bb83147bb37747e8c4210a2be39a5a7e48d61add Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Fri, 9 May 2014 02:01:42 +0100 Subject: [PATCH] Improve input args parser to support multiple inputs --- source/app/InputStream.cpp | 9 ++++----- source/app/InputStream.h | 1 - source/app/SubWindowHandle.cpp | 4 ---- source/app/plaYUVerApp.cpp | 22 +++++++++++++++++++++- source/app/plaYUVerApp.h | 3 +++ 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/source/app/InputStream.cpp b/source/app/InputStream.cpp index 6cd67ec..8c82f89 100755 --- a/source/app/InputStream.cpp +++ b/source/app/InputStream.cpp @@ -163,7 +163,8 @@ Bool InputStream::open( QString filename, UInt width, UInt height, Int input_for if( !avStatus ) { m_pFile = NULL; - m_pFile = fopen( m_cFilename.toLocal8Bit().data(), "rb" ); + Char *filename = m_cFilename.toLocal8Bit().data(); + m_pFile = fopen( filename, "rb" ); if( m_pFile == NULL ) { close(); @@ -283,6 +284,8 @@ Bool InputStream::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, In break; } } + if( rWidth >= 0 && rHeight >= 0 && rInputFormat >= 0 ) + bRet = false; } return bRet; } @@ -313,10 +316,6 @@ Void InputStream::readNextFrame() { UInt64 bytes_read = 0; //m_cTimer.restart(); - if( m_iStatus == 0 ) - { - return; - } if( m_iCurrFrameNum + 1 >= ( Int )m_uiTotalFrameNum ) { diff --git a/source/app/InputStream.h b/source/app/InputStream.h index 6365c9d..5b4a0c8 100755 --- a/source/app/InputStream.h +++ b/source/app/InputStream.h @@ -53,7 +53,6 @@ class InputStream private: Bool m_bInit; - Int m_iStatus; Int m_iErrorStatus; #ifdef USE_FFMPEG diff --git a/source/app/SubWindowHandle.cpp b/source/app/SubWindowHandle.cpp index 369d4fd..17abf0e 100644 --- a/source/app/SubWindowHandle.cpp +++ b/source/app/SubWindowHandle.cpp @@ -81,10 +81,6 @@ Bool SubWindowHandle::loadFile( const QString &fileName ) { m_pCurrStream = new InputStream; } -// else -// { -// m_pCurrStream->close(); -// } m_pCurrStream->getFormat( Width, Height, InputFormat, FrameRate ); diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index 9e38268..c574d69 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -87,6 +87,15 @@ Void plaYUVerApp::parseArgs( Int argc, Char *argv[] ) { loadFile( argv[1] ); } + if( argc >= 2 ) + { + for( Int i = 1; i < argc; i++ ) + { + loadFile( argv[i] ); + } + mdiArea->tileSubWindows(); + zoomToFitAll(); + } } Void plaYUVerApp::closeEvent( QCloseEvent *event ) @@ -524,6 +533,17 @@ void plaYUVerApp::zoomToFit() activeSubWindow()->zoomToFit(); } +Void plaYUVerApp::zoomToFitAll() +{ + SubWindowHandle *subWindow; + for( Int i = 0; i < mdiArea->subWindowList().size(); i++ ) + { + subWindow = qobject_cast( mdiArea->subWindowList().at( i ) ); + subWindow->zoomToFit(); + } +} + + void plaYUVerApp::scaleFrame( int ratio ) { if( activeSubWindow() ) @@ -540,7 +560,7 @@ void plaYUVerApp::scaleFrame( int ratio ) void plaYUVerApp::about() { QString about_message; - about_message.append("The plaYUVerApp is an open-source raw video player"); + about_message.append( "The plaYUVerApp is an open-source raw video player" ); // about_message.append("\n\r"); // about_message.append("João Carreira"); // about_message.append("\n\r"); diff --git a/source/app/plaYUVerApp.h b/source/app/plaYUVerApp.h index 84fd296..4aa9bab 100644 --- a/source/app/plaYUVerApp.h +++ b/source/app/plaYUVerApp.h @@ -117,6 +117,9 @@ private: UInt m_uiAveragePlayInterval; Void loadFile( QString fileName ); + + Void zoomToFitAll(); + //! Playing functions Void setTimerStatus(); Void updateCurrFrameNum();