[vlc-devel] [PATCH 12/12] chromecast: EOF is when the Chromecast is finished reading all sent data

Steve Lhomme robux4 at videolabs.io
Mon Apr 25 17:46:16 CEST 2016


It will then tell it's buffering, waiting for more data
---
 modules/stream_out/chromecast/cast.cpp     | 8 ++++++++
 modules/stream_out/chromecast/chromecast.h | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index b194b40..c6ebe33 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -396,6 +396,14 @@ static int Control(sout_stream_t *p_stream, int i_query, va_list args)
 {
     sout_stream_sys_t *p_sys = p_stream->p_sys;
 
+    if (i_query == SOUT_STREAM_EMPTY)
+    {
+        bool *b = va_arg( args, bool * );
+        /* check if the Chromecast to be done playing */
+        *b = p_sys->p_intf == NULL || p_sys->p_intf->isFinishedPlaying();
+        return VLC_SUCCESS;
+    }
+
     if ( !p_sys->p_out->pf_control )
         return VLC_EGENERIC;
 
diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index 42ef8ec..755b3f1 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -82,6 +82,11 @@ struct intf_sys_t
     intf_sys_t(vlc_object_t * const p_this, int local_port, std::string device_addr, int device_port = 0);
     ~intf_sys_t();
 
+    bool isFinishedPlaying() {
+        vlc_mutex_locker locker(&lock);
+        return conn_status == CHROMECAST_CONNECTION_DEAD || (receiverState == RECEIVER_BUFFERING && cmd_status != CMD_SEEK_SENT);
+    }
+
     vlc_object_t  * const p_module;
     const int      i_port;
     std::string    serverIP;
-- 
2.7.0



More information about the vlc-devel mailing list