From 769bcead8620f3fa4be5ee5ddc4dce49055226c5 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Wed, 23 Apr 2014 22:49:42 +0100 Subject: [PATCH 1/2] Rearrange modules enable/disable code. now the main function is inside ModulesHandle class --- source/app/ModulesHandle.cpp | 58 +++++++++++++++++++++++++++++----- source/app/ModulesHandle.h | 10 ++++-- source/app/PlaYUVerModuleIf.h | 3 +- source/app/SubWindowHandle.cpp | 2 +- source/app/plaYUVerApp.cpp | 36 +++------------------ 5 files changed, 66 insertions(+), 43 deletions(-) diff --git a/source/app/ModulesHandle.cpp b/source/app/ModulesHandle.cpp index 47c49d5..f6e56a2 100644 --- a/source/app/ModulesHandle.cpp +++ b/source/app/ModulesHandle.cpp @@ -25,6 +25,9 @@ #include #include "ModulesHandle.h" +#include "SubWindowHandle.h" + +// List of modules includes #include "FilterFrame.h" namespace plaYUVer @@ -32,20 +35,22 @@ namespace plaYUVer Void ModulesHandle::ModulesList( Bool bCreate ) { + // Register Modules REGISTER_MODULE( FilterFrame ); - } - ModulesHandle::ModulesHandle( QWidget * parent ) { - ModulesList( true ); + m_pcParent = parent; + // configure class - setParent( parent ); + setParent( m_pcParent ); m_uiModulesCount = 0; - m_uiModuleSelected= -1; + m_uiModuleSelected = -1; + + ModulesList( true ); } ModulesHandle::~ModulesHandle() @@ -69,12 +74,51 @@ PlaYUVerModuleIf* ModulesHandle::getSelectedModuleIf() if( m_uiModuleSelected >= 0 ) //if( m_arrayModulesActions.at(m_uiModuleSelected)->isChecked() ) - currModuleIf = m_pcPlaYUVerModules.at( m_uiModuleSelected ); + currModuleIf = m_pcPlaYUVerModules.at( m_uiModuleSelected ); m_uiModuleSelected = -1; return currModuleIf; } +SubWindowHandle* ModulesHandle::toggleSelectedModuleIf( SubWindowHandle* pcSubWindow ) +{ + SubWindowHandle* interfaceChild = NULL; + PlaYUVerModuleIf* currModuleIf = NULL; + + if( m_uiModuleSelected >= 0 ) + //if( m_arrayModulesActions.at(m_uiModuleSelected)->isChecked() ) + currModuleIf = m_pcPlaYUVerModules.at( m_uiModuleSelected ); + m_uiModuleSelected = -1; + + if( currModuleIf->m_pcAction->isChecked() ) + { + if( currModuleIf->m_cModuleDef.m_bRequiresNewWindow ) + { + interfaceChild = new SubWindowHandle( m_pcParent ); + //mdiArea->addSubWindow( interfaceChild ); + + pcSubWindow->setModuleSubWindow( interfaceChild ); + pcSubWindow->enableModule( currModuleIf ); + + interfaceChild->show(); + interfaceChild->zoomToFit(); + connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), this, + SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); + } + else + { + pcSubWindow->enableModule( currModuleIf ); + } + currModuleIf->m_pcSubWindow = pcSubWindow; + } + else + { + currModuleIf->m_pcSubWindow->disableModule(); + currModuleIf->m_pcSubWindow = NULL; + } + return interfaceChild; +} + QMenu* ModulesHandle::createMenus( QMenuBar *MainAppMenuBar ) { PlaYUVerModuleIf* currModuleIf; @@ -88,8 +132,6 @@ QMenu* ModulesHandle::createMenus( QMenuBar *MainAppMenuBar ) //m_arrayModulesActions.resize( m_uiModulesCount ); - - for( Int i = 0; i < m_pcPlaYUVerModules.size(); i++ ) { currModuleIf = m_pcPlaYUVerModules.at( i ); diff --git a/source/app/ModulesHandle.h b/source/app/ModulesHandle.h index b859dda..4f5f554 100644 --- a/source/app/ModulesHandle.h +++ b/source/app/ModulesHandle.h @@ -42,9 +42,11 @@ namespace plaYUVer { -class ModulesHandle : public QObject +class SubWindowHandle; + +class ModulesHandle: public QObject { - Q_OBJECT +Q_OBJECT public: ModulesHandle( QWidget * parent = 0 ); ~ModulesHandle(); @@ -52,8 +54,11 @@ public: QMenu* createMenus( QMenuBar *MainAppMenuBar ); Void updateMenus( Bool hasSubWindow ); PlaYUVerModuleIf* getSelectedModuleIf(); + SubWindowHandle* toggleSelectedModuleIf( SubWindowHandle* pcSubWindow ); private: + QWidget *m_pcParent; + UInt m_uiModulesCount; Int m_uiModuleSelected; QMenu* m_pcModulesMenu; @@ -64,6 +69,7 @@ private: Void appendModule( PlaYUVerModuleIf* ); Void ModulesList( Bool bCreate ); + private Q_SLOTS: void selectModule( int index ); }; diff --git a/source/app/PlaYUVerModuleIf.h b/source/app/PlaYUVerModuleIf.h index d52d777..a7d1132 100644 --- a/source/app/PlaYUVerModuleIf.h +++ b/source/app/PlaYUVerModuleIf.h @@ -73,6 +73,7 @@ typedef struct __PlaYUVerModuleDefinition bool m_bRequiresNewWindow; }PlaYUVerModuleDefinition; +class SubWindowHandle; class PlaYUVerModuleIf { @@ -86,7 +87,7 @@ public: } QAction* m_pcAction; - + SubWindowHandle* m_pcSubWindow; PlaYUVerModuleDefinition m_cModuleDef; virtual Void create() {}; diff --git a/source/app/SubWindowHandle.cpp b/source/app/SubWindowHandle.cpp index 5d425d2..4b32fc1 100644 --- a/source/app/SubWindowHandle.cpp +++ b/source/app/SubWindowHandle.cpp @@ -131,7 +131,7 @@ Void SubWindowHandle::disableModule() if( !m_pcCurrentModule ) return; - m_pcCurrentModule->m_pcAction->setCheckable( false ); + m_pcCurrentModule->m_pcAction->setChecked( false ); m_pcCurrentModule->destroy(); m_pcCurrentModule = NULL; refreshFrame(); diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index 182ea32..026a981 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -49,7 +49,6 @@ plaYUVerApp::plaYUVerApp() //mdiArea->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded ); connect( mdiArea, SIGNAL( subWindowActivated(QMdiSubWindow*) ), this, SLOT( chageSubWindowSelection() ) ); - //connect( mdiArea, SIGNAL( subWindowActivated(QMdiSubWindow*) ), this, SLOT( updateMenus() ) ); mapperWindow = new QSignalMapper( this ); connect( mapperWindow, SIGNAL( mapped(QWidget*) ), this, SLOT( setActiveSubWindow(QWidget*) ) ); @@ -221,32 +220,11 @@ void plaYUVerApp::closeAll() void plaYUVerApp::selectModule( QAction *curr_action ) { - //emit curr_action->triggered(); - if( m_pcCurrentSubWindow ) + SubWindowHandle *interfaceChild = m_pcModulesHandle->toggleSelectedModuleIf( m_pcCurrentSubWindow ); + if( interfaceChild ) { - PlaYUVerModuleIf* pcCurrMod = m_pcModulesHandle->getSelectedModuleIf(); - if( pcCurrMod ) - { - if( pcCurrMod->m_cModuleDef.m_bRequiresNewWindow ) - { - SubWindowHandle *interfaceChild = new SubWindowHandle( this ); //createSubWindow(); - mdiArea->addSubWindow( interfaceChild ); - -// connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, InputStream *) ), this, -// SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); - // connect( interfaceChild->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, - // SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); - m_pcCurrentSubWindow->setModuleSubWindow( interfaceChild ); - m_pcCurrentSubWindow->enableModule( pcCurrMod ); - interfaceChild->show(); - interfaceChild->zoomToFit(); - interfaceChild->getViewArea()->setTool( m_appTool ); - } - else - { - m_pcCurrentSubWindow->enableModule( pcCurrMod ); - } - } + mdiArea->addSubWindow( interfaceChild ); + interfaceChild->getViewArea()->setTool( m_appTool ); } return; } @@ -555,12 +533,8 @@ void plaYUVerApp::chageSubWindowSelection() SubWindowHandle *new_window = activeSubWindow(); if( activeSubWindow() != m_pcCurrentSubWindow ) { - if( activeSubWindow() ) + if( activeSubWindow() ) { - if( m_pcCurrentSubWindow ) - { - m_pcCurrentSubWindow->disableModule(); - } m_pcCurrentSubWindow = new_window; m_pcStreamProperties->setData( m_pcCurrentSubWindow->getInputStream() ); m_pcFrameProperties->setData( m_pcCurrentSubWindow->getInputStream()->getCurrFrame() ); From 78d09e03af54d554038856bf794141183ab6e84c Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Thu, 24 Apr 2014 03:07:26 +0100 Subject: [PATCH 2/2] Improve modules handle in order to be compatible with new windows --- source/app/InputStream.cpp | 2 + source/app/ModulesHandle.cpp | 42 +++++++++---------- source/app/ModulesHandle.h | 3 +- source/app/PlaYUVerModuleIf.h | 8 +++- source/app/SubWindowHandle.cpp | 39 +++++++++--------- source/app/SubWindowHandle.h | 13 +++++- source/app/plaYUVerApp.cpp | 73 ++++++++++++++++++---------------- 7 files changed, 101 insertions(+), 79 deletions(-) diff --git a/source/app/InputStream.cpp b/source/app/InputStream.cpp index ba9ea75..6cd67ec 100755 --- a/source/app/InputStream.cpp +++ b/source/app/InputStream.cpp @@ -399,6 +399,8 @@ cv::Mat InputStream::getFrameCvMat() Void InputStream::seekInput( UInt64 new_frame_num ) { + if( !m_pFile ) + return; if( new_frame_num < 0 || new_frame_num >= m_uiTotalFrameNum ) return; #ifdef USE_FFMPEG diff --git a/source/app/ModulesHandle.cpp b/source/app/ModulesHandle.cpp index f6e56a2..ecd54e5 100644 --- a/source/app/ModulesHandle.cpp +++ b/source/app/ModulesHandle.cpp @@ -49,7 +49,7 @@ ModulesHandle::ModulesHandle( QWidget * parent ) setParent( m_pcParent ); m_uiModulesCount = 0; m_uiModuleSelected = -1; - + m_bShowModulesNewWindow = false; ModulesList( true ); } @@ -68,42 +68,31 @@ void ModulesHandle::selectModule( int index ) m_uiModuleSelected = index; } -PlaYUVerModuleIf* ModulesHandle::getSelectedModuleIf() -{ - PlaYUVerModuleIf* currModuleIf = NULL; - - if( m_uiModuleSelected >= 0 ) - //if( m_arrayModulesActions.at(m_uiModuleSelected)->isChecked() ) - currModuleIf = m_pcPlaYUVerModules.at( m_uiModuleSelected ); - - m_uiModuleSelected = -1; - return currModuleIf; -} - SubWindowHandle* ModulesHandle::toggleSelectedModuleIf( SubWindowHandle* pcSubWindow ) { SubWindowHandle* interfaceChild = NULL; PlaYUVerModuleIf* currModuleIf = NULL; if( m_uiModuleSelected >= 0 ) - //if( m_arrayModulesActions.at(m_uiModuleSelected)->isChecked() ) currModuleIf = m_pcPlaYUVerModules.at( m_uiModuleSelected ); m_uiModuleSelected = -1; if( currModuleIf->m_pcAction->isChecked() ) { - if( currModuleIf->m_cModuleDef.m_bRequiresNewWindow ) + currModuleIf->m_pcDisplaySubWindow = NULL; + if( currModuleIf->m_cModuleDef.m_bRequiresNewWindow || m_bShowModulesNewWindow ) { + QString windowName; interfaceChild = new SubWindowHandle( m_pcParent ); - //mdiArea->addSubWindow( interfaceChild ); - pcSubWindow->setModuleSubWindow( interfaceChild ); pcSubWindow->enableModule( currModuleIf ); - - interfaceChild->show(); - interfaceChild->zoomToFit(); + windowName.append( pcSubWindow->userFriendlyCurrentFile() ); + windowName.append( " - " ); + windowName.append( currModuleIf->m_cModuleDef.m_pchModuleName ); + interfaceChild->setWindowName( windowName ); connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), this, SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); + currModuleIf->m_pcDisplaySubWindow = interfaceChild; } else { @@ -114,11 +103,22 @@ SubWindowHandle* ModulesHandle::toggleSelectedModuleIf( SubWindowHandle* pcSubWi else { currModuleIf->m_pcSubWindow->disableModule(); - currModuleIf->m_pcSubWindow = NULL; } return interfaceChild; } +Void ModulesHandle::destroyModuleIf( PlaYUVerModuleIf* pcCurrModuleIf ) +{ + pcCurrModuleIf->m_pcAction->setChecked( false ); + if( pcCurrModuleIf->m_pcDisplaySubWindow ) + { + pcCurrModuleIf->m_pcDisplaySubWindow->close(); + pcCurrModuleIf->m_pcDisplaySubWindow = NULL; + } + pcCurrModuleIf->m_pcSubWindow = NULL; + pcCurrModuleIf->destroy(); +} + QMenu* ModulesHandle::createMenus( QMenuBar *MainAppMenuBar ) { PlaYUVerModuleIf* currModuleIf; diff --git a/source/app/ModulesHandle.h b/source/app/ModulesHandle.h index 4f5f554..528eaa6 100644 --- a/source/app/ModulesHandle.h +++ b/source/app/ModulesHandle.h @@ -53,12 +53,13 @@ public: QMenu* createMenus( QMenuBar *MainAppMenuBar ); Void updateMenus( Bool hasSubWindow ); - PlaYUVerModuleIf* getSelectedModuleIf(); SubWindowHandle* toggleSelectedModuleIf( SubWindowHandle* pcSubWindow ); + static Void destroyModuleIf( PlaYUVerModuleIf* pcCurrModuleIf ); private: QWidget *m_pcParent; + Bool m_bShowModulesNewWindow; UInt m_uiModulesCount; Int m_uiModuleSelected; QMenu* m_pcModulesMenu; diff --git a/source/app/PlaYUVerModuleIf.h b/source/app/PlaYUVerModuleIf.h index a7d1132..f3d74cc 100644 --- a/source/app/PlaYUVerModuleIf.h +++ b/source/app/PlaYUVerModuleIf.h @@ -77,6 +77,12 @@ class SubWindowHandle; class PlaYUVerModuleIf { + friend class ModulesHandle; +private: + QAction* m_pcAction; + SubWindowHandle* m_pcSubWindow; + SubWindowHandle* m_pcDisplaySubWindow; + public: PlaYUVerModuleIf() { @@ -86,8 +92,6 @@ public: { } - QAction* m_pcAction; - SubWindowHandle* m_pcSubWindow; PlaYUVerModuleDefinition m_cModuleDef; virtual Void create() {}; diff --git a/source/app/SubWindowHandle.cpp b/source/app/SubWindowHandle.cpp index 4b32fc1..1051cdf 100644 --- a/source/app/SubWindowHandle.cpp +++ b/source/app/SubWindowHandle.cpp @@ -52,8 +52,9 @@ SubWindowHandle::SubWindowHandle( QWidget * parent ) : m_cScrollArea->setWidget( m_cViewArea ); m_cScrollArea->setWidgetResizable( true ); + m_pCurrStream = NULL; m_pCurrStream = new InputStream; - + m_pcCurrFrame = NULL; m_pcCurrentModule = NULL; m_pcModuleSubWindow = NULL; @@ -64,15 +65,11 @@ SubWindowHandle::SubWindowHandle( QWidget * parent ) : SubWindowHandle::~SubWindowHandle() { + disableModule(); delete m_cViewArea; delete m_cScrollArea; - delete m_pCurrStream; - if( m_pcCurrentModule ) - { - m_pcCurrentModule->m_pcAction->setChecked( false ); - m_pcCurrentModule->destroy(); - m_pcCurrentModule = NULL; - } + if( m_pCurrStream ) + delete m_pCurrStream; } Bool SubWindowHandle::loadFile( const QString &fileName ) @@ -80,6 +77,9 @@ Bool SubWindowHandle::loadFile( const QString &fileName ) UInt Width = 0, Height = 0, FrameRate = 30; Int InputFormat = -1; + if( !m_pCurrStream ) + m_pCurrStream = new InputStream; + m_pCurrStream->getFormat( Width, Height, InputFormat, FrameRate ); if( m_pCurrStream->guessFormat( fileName, Width, Height, InputFormat, FrameRate ) ) @@ -102,7 +102,6 @@ Bool SubWindowHandle::loadFile( const QString &fileName ) QApplication::restoreOverrideCursor(); refreshFrame(); - //normalSize(); m_cCurrFileName = fileName; m_cWindowName = m_pCurrStream->getStreamInformationString(); @@ -116,11 +115,6 @@ Bool SubWindowHandle::loadFile( const QString &fileName ) */ Void SubWindowHandle::enableModule( PlaYUVerModuleIf* select_module ) { - if( m_pcCurrentModule == select_module ) - { - disableModule(); - return; - } m_pcCurrentModule = select_module; m_pcCurrentModule->create( m_pCurrStream->getCurrFrame() ); refreshFrame(); @@ -130,10 +124,9 @@ Void SubWindowHandle::disableModule() { if( !m_pcCurrentModule ) return; - - m_pcCurrentModule->m_pcAction->setChecked( false ); - m_pcCurrentModule->destroy(); + ModulesHandle::destroyModuleIf( m_pcCurrentModule ); m_pcCurrentModule = NULL; + m_pcModuleSubWindow = NULL; refreshFrame(); } @@ -268,7 +261,11 @@ Void SubWindowHandle::scaleView( Int width, Int height ) Void SubWindowHandle::scaleView( const QSize & size ) { - QSize imgViewSize( m_pCurrStream->getWidth(), m_pCurrStream->getHeight() ); + QSize imgViewSize; + if( m_pcCurrFrame ) + imgViewSize = QSize( m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight() ); + else + imgViewSize = QSize( m_pCurrStream->getWidth(), m_pCurrStream->getHeight() ); QSize newSize = imgViewSize; newSize.scale( size, Qt::KeepAspectRatio ); @@ -361,7 +358,11 @@ QSize SubWindowHandle::sizeHint() const maxSize = p->size(); } - QSize isize = QSize( m_pCurrStream->getWidth() + 50, m_pCurrStream->getHeight() + 50 ); + QSize isize; + if( m_pcCurrFrame ) + isize = QSize( m_pcCurrFrame->getWidth() + 50, m_pcCurrFrame->getHeight() + 50 ); + else + isize = QSize( m_pCurrStream->getWidth() + 50, m_pCurrStream->getHeight() + 50 ); // If the SubWindowHandle needs more space that the avaiable, we'll give // to the subwindow a reasonable size preserving the image aspect ratio. diff --git a/source/app/SubWindowHandle.h b/source/app/SubWindowHandle.h index 44fecb5..6f3e708 100644 --- a/source/app/SubWindowHandle.h +++ b/source/app/SubWindowHandle.h @@ -36,7 +36,7 @@ #include "TypeDef.h" #include "InputStream.h" #include "ViewArea.h" -#include "PlaYUVerModuleIf.h" +#include "ModulesHandle.h" namespace plaYUVer { @@ -94,6 +94,11 @@ public: return m_pCurrStream; } + PlaYUVerFrame* getCurrFrame() + { + return m_pcCurrFrame; + } + ViewArea* getViewArea() { return m_cViewArea; @@ -146,6 +151,12 @@ public: QSize sizeHint() const; + Void setWindowName( QString name ) + { + m_cWindowName = name; + setWindowTitle( m_cWindowName ); + } + QString userFriendlyCurrentFile() { return m_cWindowName; diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index 026a981..9021902 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -224,6 +224,8 @@ void plaYUVerApp::selectModule( QAction *curr_action ) if( interfaceChild ) { mdiArea->addSubWindow( interfaceChild ); + interfaceChild->show(); + interfaceChild->zoomToFit(); interfaceChild->getViewArea()->setTool( m_appTool ); } return; @@ -247,7 +249,7 @@ Void plaYUVerApp::updateFrameProperties() { if( m_pcCurrentSubWindow ) { - m_pcFrameProperties->setData( m_pcCurrentSubWindow->getInputStream()->getCurrFrame() ); + m_pcFrameProperties->setData( m_pcCurrentSubWindow->getCurrFrame() ); //m_pcFrameProperties->setSelection( m_pcCurrentSubWindow->getViewArea()->selectedArea() ); } else @@ -297,47 +299,51 @@ Void plaYUVerApp::setTimerStatus() void plaYUVerApp::play() { - if( m_pcCurrentSubWindow ) + if( !m_pcCurrentSubWindow ) + return; + + if( !m_pcCurrentSubWindow->getInputStream() ) + return; + + if( actionVideoLock->isChecked() && m_acPlayingSubWindows.size() ) { - if( actionVideoLock->isChecked() && m_acPlayingSubWindows.size() ) + Bool bFind = false; + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) { - Bool bFind = false; - for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + if( m_acPlayingSubWindows.at( i ) == m_pcCurrentSubWindow ) { - if( m_acPlayingSubWindows.at( i ) == m_pcCurrentSubWindow ) - { - bFind = true; - break; - } - } - if( !bFind ) - { - m_acPlayingSubWindows.append( m_pcCurrentSubWindow ); - m_pcCurrentSubWindow->seekAbsoluteEvent( m_acPlayingSubWindows.at( 0 )->getInputStream()->getCurrFrameNum() ); - m_pcCurrentSubWindow->play(); - m_pcFrameSlider->setMaximum( qMin( m_pcFrameSlider->maximum(), ( Int )m_pcCurrentSubWindow->getInputStream()->getFrameNum() - 1 ) ); + bFind = true; + break; } } - else + if( !bFind ) { - playingTimer->stop(); - m_acPlayingSubWindows.clear(); m_acPlayingSubWindows.append( m_pcCurrentSubWindow ); + m_pcCurrentSubWindow->seekAbsoluteEvent( m_acPlayingSubWindows.at( 0 )->getInputStream()->getCurrFrameNum() ); m_pcCurrentSubWindow->play(); - m_uiAveragePlayInterval = 0; - m_bIsPlaying = false; - } - if( !m_bIsPlaying ) - { - UInt frameRate = m_acPlayingSubWindows.at( 0 )->getInputStream()->getFrameRate(); - UInt timeInterval = ( UInt )( 1000.0 / frameRate + 0.5 ); - qDebug( ) << "Desired frame rate: " - << QString::number( 1000 / timeInterval ) - << " fps"; - playingTimer->start( timeInterval ); - m_cTimer.start(); + m_pcFrameSlider->setMaximum( qMin( m_pcFrameSlider->maximum(), ( Int )m_pcCurrentSubWindow->getInputStream()->getFrameNum() - 1 ) ); } } + else + { + playingTimer->stop(); + m_acPlayingSubWindows.clear(); + m_acPlayingSubWindows.append( m_pcCurrentSubWindow ); + m_pcCurrentSubWindow->play(); + m_uiAveragePlayInterval = 0; + m_bIsPlaying = false; + } + if( !m_bIsPlaying ) + { + UInt frameRate = m_acPlayingSubWindows.at( 0 )->getInputStream()->getFrameRate(); + UInt timeInterval = ( UInt )( 1000.0 / frameRate + 0.5 ); + qDebug( ) << "Desired frame rate: " + << QString::number( 1000 / timeInterval ) + << " fps"; + playingTimer->start( timeInterval ); + m_cTimer.start(); + } + } void plaYUVerApp::pause() @@ -453,7 +459,6 @@ void plaYUVerApp::seekEvent( int direction ) else { m_pcCurrentSubWindow->seekRelativeEvent( direction > 0 ? true : false ); - } updateFrameProperties(); updateCurrFrameNum(); @@ -536,8 +541,6 @@ void plaYUVerApp::chageSubWindowSelection() if( activeSubWindow() ) { m_pcCurrentSubWindow = new_window; - m_pcStreamProperties->setData( m_pcCurrentSubWindow->getInputStream() ); - m_pcFrameProperties->setData( m_pcCurrentSubWindow->getInputStream()->getCurrFrame() ); updateCurrFrameNum(); updateTotalFrameNum(); updateStreamProperties();