[vlc-commits] chromecast: replace the p_input hack by an other one

Thomas Guillem git at videolan.org
Fri Jul 20 14:39:39 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jul 20 14:35:04 2018 +0200| [11ce842eb87bbbeccf3e9b09c823829d3f621984] | committer: Thomas Guillem

chromecast: replace the p_input hack by an other one

This is very questionable if this hack is cleaner that the previous one. But
this one doesn't depend on the input_thread_t that we want to hide from
demuxers. Furthermore, it allows more controls with applications using libvlc
that will receive a CorkEvent.

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

 modules/stream_out/chromecast/chromecast_demux.cpp | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp
index 915298c6e1..e076a18f4d 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -457,10 +457,21 @@ protected:
 static void on_paused_changed_cb( void *data, bool paused )
 {
     demux_t *p_demux = reinterpret_cast<demux_t*>(data);
+    vlc_object_t *obj = p_demux->p_next->obj.parent;
 
-    input_thread_t *p_input = p_demux->p_next->p_input;
-    if( p_input )
-        var_SetInteger( p_input, "state", paused ? PAUSE_S : PLAYING_S );
+    /* XXX: Ugly: Notify the parent of the input_thread_t that the corks state
+     * changed */
+    while( obj != NULL )
+    {
+        /* Try to find the playlist or the mediaplayer that handle the corks
+         * state */
+        if( var_Type( obj, "corks" ) != 0 )
+        {
+            ( paused ? var_IncInteger : var_DecInteger )( obj, "corks" );
+            return;
+        }
+        obj = obj->obj.parent;
+    }
 }
 
 static int Demux( demux_t *p_demux_filter )



More information about the vlc-commits mailing list