[vlc-devel] [PATCH 18/33] chromecast: GET_STATUS and LAUNCH require a request ID

Steve Lhomme robux4 at videolabs.io
Wed Dec 23 12:58:37 CET 2015


---
 modules/stream_out/chromecast/chromecast.h        | 1 +
 modules/stream_out/chromecast/chromecast_ctrl.cpp | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index 4db1f99..3a1087e 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -117,6 +117,7 @@ private:
 
     enum connection_status conn_status;
 
+    unsigned i_receiver_requestId;
     unsigned i_requestId;
 };
 
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index b40f5e2..a9be103 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -39,7 +39,7 @@
 #include "../../misc/webservices/json.h"
 
 // Media player Chromecast app id
-#define APP_ID "CC1AD845" // Default media player
+#define APP_ID "CC1AD845" // Default media player aka DEFAULT_MEDIA_RECEIVER_APPLICATION_ID
 
 #define SOUT_CFG_PREFIX "sout-chromecast-"
 
@@ -81,6 +81,7 @@ intf_sys_t::intf_sys_t(sout_stream_t * const p_this)
  : p_stream(p_this)
  , p_tls(NULL)
  , conn_status(CHROMECAST_DISCONNECTED)
+ , i_receiver_requestId(0)
  , i_requestId(0)
 {
     vlc_mutex_init(&lock);
@@ -300,7 +301,8 @@ void intf_sys_t::msgReceiverClose(std::string destinationId)
 void intf_sys_t::msgReceiverGetStatus()
 {
     std::stringstream ss;
-    ss << "{\"type\":\"GET_STATUS\"}";
+    ss << "{\"type\":\"GET_STATUS\","
+       <<  "\"requestId\":" << i_receiver_requestId++ << "}";
 
     buildMessage(NAMESPACE_RECEIVER, ss.str());
 }
@@ -310,7 +312,7 @@ void intf_sys_t::msgReceiverLaunchApp()
     std::stringstream ss;
     ss << "{\"type\":\"LAUNCH\","
        <<  "\"appId\":\"" << APP_ID << "\","
-       <<  "\"requestId\":" << i_requestId++ << "}";
+       <<  "\"requestId\":" << i_receiver_requestId++ << "}";
 
     buildMessage(NAMESPACE_RECEIVER, ss.str());
 }
-- 
2.6.3



More information about the vlc-devel mailing list