From 304c0f6683f98e0232a8193200acf8f6d3861877 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Thu, 10 Jun 2021 23:45:09 +0100 Subject: [PATCH] Fix the module skip while playing --- app/CalypAppModuleIf.cpp | 8 ++++++++ app/CalypAppModuleIf.h | 1 + app/VideoSubWindow.cpp | 21 ++++++++++++++------- app/VideoSubWindow.h | 1 + 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/app/CalypAppModuleIf.cpp b/app/CalypAppModuleIf.cpp index 3dfab31..98e600d 100644 --- a/app/CalypAppModuleIf.cpp +++ b/app/CalypAppModuleIf.cpp @@ -60,6 +60,14 @@ void CalypAppModuleIf::update( bool isPlaying ) } } +void CalypAppModuleIf::setPlaying( bool isPlaying ) +{ + if( m_pcDisplaySubWindow ) + { + m_pcDisplaySubWindow->setPlaying( isPlaying ); + } +} + bool CalypAppModuleIf::isRunning() { #ifdef CALYP_THREADED_MODULES diff --git a/app/CalypAppModuleIf.h b/app/CalypAppModuleIf.h index 9bedd76..410f4f2 100644 --- a/app/CalypAppModuleIf.h +++ b/app/CalypAppModuleIf.h @@ -108,6 +108,7 @@ public: ClpString moduleInfo() { return m_pcModule->moduleInfo(); } void update( bool isPlaying ); bool apply( bool isPlaying = false, bool disableThreads = false ); + void setPlaying( bool isPlaying ); bool isRunning(); void show(); void destroy(); diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index af6507c..8e9a6b8 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -815,6 +815,15 @@ bool VideoSubWindow::saveStream( QString filename ) return iRet; } +void VideoSubWindow::setPlaying( bool isPlaying ) +{ + m_bIsPlaying = isPlaying; + for( auto module : m_apcCurrentModule ) + { + module->setPlaying( isPlaying ); + } +} + bool VideoSubWindow::isPlaying() { if( getCategory() & SubWindowCategory::MODULE_SUBWINDOW ) @@ -831,14 +840,12 @@ bool VideoSubWindow::isPlaying() bool VideoSubWindow::play() { + bool isPlaying = false; if( m_pCurrStream && m_pCurrStream->getFrameNum() > 1 ) { - m_bIsPlaying = true; - } - else - { - m_bIsPlaying = false; + isPlaying = true; } + setPlaying( isPlaying ); return m_bIsPlaying; } @@ -854,7 +861,7 @@ bool VideoSubWindow::playEvent() void VideoSubWindow::pause() { - m_bIsPlaying = false; + setPlaying( false ); refreshFrame(); } @@ -891,7 +898,7 @@ void VideoSubWindow::stop() m_cRefreshResult.waitForFinished(); m_cReadResult.waitForFinished(); #endif - m_bIsPlaying = false; + setPlaying( false ); seekAbsoluteEvent( 0 ); return; } diff --git a/app/VideoSubWindow.h b/app/VideoSubWindow.h index 377f669..b9e8df7 100644 --- a/app/VideoSubWindow.h +++ b/app/VideoSubWindow.h @@ -127,6 +127,7 @@ public: bool playEvent(); void stop(); + void setPlaying( bool isPlaying ); bool isPlaying(); void seekAbsoluteEvent( unsigned int new_frame_num ); void seekRelativeEvent( bool bIsFoward );