[vlmc-devel] ClipWorkflow: Proceed with cleanup once the media player has been stopped

Hugo Beauzée-Luyssen git at videolan.org
Thu Mar 24 13:22:18 CET 2016


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Mar 15 23:20:05 2016 +0100| [727d95b27f2f572efee4c66eacf6d4d33c1eecbc] | committer: Hugo Beauzée-Luyssen

ClipWorkflow: Proceed with cleanup once the media player has been stopped

This aims toward a more event-based approch, to be continued in the next
commits

> https://code.videolan.org/videolan/vlmc/commit/727d95b27f2f572efee4c66eacf6d4d33c1eecbc
---

 src/Workflow/ClipWorkflow.cpp | 22 ++++++++++++++--------
 src/Workflow/ClipWorkflow.h   |  1 +
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/Workflow/ClipWorkflow.cpp b/src/Workflow/ClipWorkflow.cpp
index 79519bc..4c9afc8 100644
--- a/src/Workflow/ClipWorkflow.cpp
+++ b/src/Workflow/ClipWorkflow.cpp
@@ -82,6 +82,7 @@ ClipWorkflow::initialize()
     connect( m_eventWatcher, SIGNAL( playing() ), this, SLOT( loadingComplete() ), Qt::QueuedConnection );
     connect( m_eventWatcher, SIGNAL( endReached() ), this, SLOT( clipEndReached() ), Qt::DirectConnection );
     connect( m_eventWatcher, SIGNAL( errorEncountered() ), this, SLOT( errorEncountered() ) );
+    connect( m_eventWatcher, &RendererEventWatcher::stopped, this, &ClipWorkflow::mediaPlayerStopped );
     m_renderer->start();
 }
 
@@ -130,14 +131,6 @@ ClipWorkflow::stop()
     if ( m_renderer && m_state != Stopped )
     {
         m_renderer->stop();
-        m_eventWatcher->disconnect();
-        if ( m_state != Error )
-            m_state = Stopped;
-        flushComputedBuffers();
-        m_isRendering = false;
-
-        m_initWaitCond->wakeAll();
-        m_renderWaitCond->wakeAll();
     }
 }
 
@@ -229,6 +222,19 @@ ClipWorkflow::mediaPlayerUnpaused()
 }
 
 void
+ClipWorkflow::mediaPlayerStopped()
+{
+    m_eventWatcher->disconnect();
+    if ( m_state != Error )
+        m_state = Stopped;
+    flushComputedBuffers();
+    m_isRendering = false;
+
+    m_initWaitCond->wakeAll();
+    m_renderWaitCond->wakeAll();
+}
+
+void
 ClipWorkflow::resyncClipWorkflow()
 {
     flushComputedBuffers();
diff --git a/src/Workflow/ClipWorkflow.h b/src/Workflow/ClipWorkflow.h
index 63971fd..f0a4339 100644
--- a/src/Workflow/ClipWorkflow.h
+++ b/src/Workflow/ClipWorkflow.h
@@ -243,6 +243,7 @@ class   ClipWorkflow : public EffectUser
         void                    clipEndReached();
         void                    mediaPlayerPaused();
         void                    mediaPlayerUnpaused();
+        void                    mediaPlayerStopped();
         void                    resyncClipWorkflow();
 
     protected slots:



More information about the Vlmc-devel mailing list