[vlc-devel] [PATCH 15/33] chromecast: the default payload type we send is STRING

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


---
 modules/stream_out/chromecast/chromecast.h        |  4 ++--
 modules/stream_out/chromecast/chromecast_ctrl.cpp | 27 +++++++++--------------
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index b7d63be..7d88acf 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -115,9 +115,9 @@ private:
     int sendMessage(castchannel::CastMessage &msg);
 
     void buildMessage(const std::string & namespace_,
-                      castchannel::CastMessage_PayloadType payloadType,
                       const std::string & payload,
-                      const std::string & destinationId = DEFAULT_CHOMECAST_RECEIVER);
+                      const std::string & destinationId = DEFAULT_CHOMECAST_RECEIVER,
+                      castchannel::CastMessage_PayloadType payloadType = castchannel::CastMessage_PayloadType_STRING);
 
     enum connection_status conn_status;
 
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index f4e5915..f2dce27 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -53,9 +53,9 @@
  * @return the generated CastMessage
  */
 void intf_sys_t::buildMessage(const std::string & namespace_,
-                              castchannel::CastMessage_PayloadType payloadType,
                               const std::string & payload,
-                              const std::string & destinationId)
+                              const std::string & destinationId,
+                              castchannel::CastMessage_PayloadType payloadType)
 {
     castchannel::CastMessage msg;
 
@@ -264,38 +264,34 @@ void intf_sys_t::msgAuth()
     authMessage.SerializeToString(&authMessageString);
 
     buildMessage(NAMESPACE_DEVICEAUTH,
-        castchannel::CastMessage_PayloadType_BINARY, authMessageString);
+        authMessageString, DEFAULT_CHOMECAST_RECEIVER, castchannel::CastMessage_PayloadType_BINARY);
 }
 
 
 void intf_sys_t::msgPing()
 {
     std::string s("{\"type\":\"PING\"}");
-    buildMessage(NAMESPACE_HEARTBEAT,
-        castchannel::CastMessage_PayloadType_STRING, s);
+    buildMessage(NAMESPACE_HEARTBEAT, s);
 }
 
 
 void intf_sys_t::msgPong()
 {
     std::string s("{\"type\":\"PONG\"}");
-    buildMessage(NAMESPACE_HEARTBEAT,
-        castchannel::CastMessage_PayloadType_STRING, s);
+    buildMessage(NAMESPACE_HEARTBEAT, s);
 }
 
 void intf_sys_t::msgConnect(const std::string & destinationId)
 {
     std::string s("{\"type\":\"CONNECT\"}");
-    buildMessage(NAMESPACE_CONNECTION,
-        castchannel::CastMessage_PayloadType_STRING, s, destinationId);
+    buildMessage(NAMESPACE_CONNECTION, s, destinationId);
 }
 
 
 void intf_sys_t::msgReceiverClose(std::string destinationId)
 {
     std::string s("{\"type\":\"CLOSE\"}");
-    buildMessage(NAMESPACE_CONNECTION,
-        castchannel::CastMessage_PayloadType_STRING, s, destinationId);
+    buildMessage(NAMESPACE_CONNECTION, s, destinationId);
 }
 
 void intf_sys_t::msgReceiverGetStatus()
@@ -303,8 +299,7 @@ void intf_sys_t::msgReceiverGetStatus()
     std::stringstream ss;
     ss << "{\"type\":\"GET_STATUS\"}";
 
-    buildMessage(NAMESPACE_RECEIVER,
-        castchannel::CastMessage_PayloadType_STRING, ss.str());
+    buildMessage(NAMESPACE_RECEIVER, ss.str());
 }
 
 void intf_sys_t::msgReceiverLaunchApp()
@@ -314,8 +309,7 @@ void intf_sys_t::msgReceiverLaunchApp()
        <<  "\"appId\":\"" << APP_ID << "\","
        <<  "\"requestId\":" << i_requestId++ << "}";
 
-    buildMessage(NAMESPACE_RECEIVER,
-        castchannel::CastMessage_PayloadType_STRING, ss.str());
+    buildMessage(NAMESPACE_RECEIVER, ss.str());
 }
 
 
@@ -336,8 +330,7 @@ void intf_sys_t::msgPlayerLoad()
 
     free(psz_mime);
 
-    buildMessage(NAMESPACE_MEDIA,
-        castchannel::CastMessage_PayloadType_STRING, ss.str(), appTransportId);
+    buildMessage(NAMESPACE_MEDIA, ss.str(), appTransportId);
 }
 
 /**
-- 
2.6.3



More information about the vlc-devel mailing list