chromecast: EOF is when the Chromecast is finished reading all sent data
authorSteve Lhomme <robux4@videolabs.io>
Thu, 28 Apr 2016 12:21:00 +0000 (14:21 +0200)
committerThomas Guillem <thomas@gllm.fr>
Tue, 3 May 2016 11:22:20 +0000 (13:22 +0200)
It will then tell it's buffering, waiting for more data

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
modules/stream_out/chromecast/cast.cpp
modules/stream_out/chromecast/chromecast.h

index 4e3608a..99455ed 100644 (file)
@@ -379,6 +379,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;
 
index 0635a4f..3b13c4a 100644 (file)
@@ -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);
+    }
+
     void setHasInput( bool has_input, const std::string mime_type = "");
 
 private: