[vlc-commits] chromecast: demux: add deinit()

Thomas Guillem git at videolan.org
Thu Mar 29 14:04:12 CEST 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Mar 28 12:17:57 2018 +0200| [b8f3bc8269ff2f9b4f2b54ae73cc3b71734d1cbd] | committer: Thomas Guillem

chromecast: demux: add deinit()

(cherry picked from commit a7ee0f82f96f6bc26941ceb42365474bc62abb27)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=b8f3bc8269ff2f9b4f2b54ae73cc3b71734d1cbd
---

 modules/stream_out/chromecast/chromecast_demux.cpp | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp
index fdd61092d6..08485d13b7 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -141,6 +141,14 @@ struct demux_cc
         resetTimes();
     }
 
+    void deinit()
+    {
+        assert(p_renderer);
+        p_renderer->pf_set_meta( p_renderer->p_opaque, NULL );
+        p_renderer->pf_set_on_paused_changed_cb( p_renderer->p_opaque,
+                                                 NULL, NULL );
+    }
+
     void resetTimes()
     {
         m_start_time = m_last_time = -1;
@@ -162,11 +170,7 @@ struct demux_cc
     ~demux_cc()
     {
         if( p_renderer )
-        {
-            p_renderer->pf_set_meta( p_renderer->p_opaque, NULL );
-            p_renderer->pf_set_on_paused_changed_cb( p_renderer->p_opaque,
-                                                     NULL, NULL );
-        }
+            deinit();
     }
 
     void resetDemuxEof()
@@ -414,14 +418,14 @@ struct demux_cc
         case DEMUX_FILTER_ENABLE:
             p_renderer = static_cast<chromecast_common *>(
                         var_InheritAddress( p_demux, CC_SHARED_VAR_NAME ) );
+            assert(p_renderer != NULL);
             m_enabled = true;
             init();
             return VLC_SUCCESS;
 
         case DEMUX_FILTER_DISABLE:
 
-            p_renderer->pf_set_on_paused_changed_cb( p_renderer->p_opaque,
-                                                     NULL, NULL );
+            deinit();
 
             /* Seek back to last known position. Indeed we don't want to resume
              * from the input position that can be more than 1 minutes forward



More information about the vlc-commits mailing list