Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
4921e9a2
Commit
4921e9a2
authored
Dec 23, 2015
by
Steve Lhomme
Committed by
Jean-Baptiste Kempf
Dec 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chromecast: reuse the same objects for namespaces
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
a459a47b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
14 deletions
+24
-14
modules/stream_out/chromecast/cast.cpp
modules/stream_out/chromecast/cast.cpp
+7
-7
modules/stream_out/chromecast/chromecast.h
modules/stream_out/chromecast/chromecast.h
+10
-0
modules/stream_out/chromecast/chromecast_ctrl.cpp
modules/stream_out/chromecast/chromecast_ctrl.cpp
+7
-7
No files found.
modules/stream_out/chromecast/cast.cpp
View file @
4921e9a2
...
@@ -317,7 +317,7 @@ static void Close(vlc_object_t *p_this)
...
@@ -317,7 +317,7 @@ static void Close(vlc_object_t *p_this)
p_sys
->
p_intf
->
msgReceiverClose
(
p_sys
->
p_intf
->
appTransportId
);
p_sys
->
p_intf
->
msgReceiverClose
(
p_sys
->
p_intf
->
appTransportId
);
// ft
// ft
case
CHROMECAST_AUTHENTICATED
:
case
CHROMECAST_AUTHENTICATED
:
p_sys
->
p_intf
->
msgReceiverClose
(
"receiver-0"
);
p_sys
->
p_intf
->
msgReceiverClose
(
DEFAULT_CHOMECAST_RECEIVER
);
// Send the just added close messages.
// Send the just added close messages.
sendMessages
(
p_stream
);
sendMessages
(
p_stream
);
// ft
// ft
...
@@ -577,7 +577,7 @@ static int processMessage(sout_stream_t *p_stream, const castchannel::CastMessag
...
@@ -577,7 +577,7 @@ static int processMessage(sout_stream_t *p_stream, const castchannel::CastMessag
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
std
::
string
namespace_
=
msg
.
namespace_
();
std
::
string
namespace_
=
msg
.
namespace_
();
if
(
namespace_
==
"urn:x-cast:com.google.cast.tp.deviceauth"
)
if
(
namespace_
==
NAMESPACE_DEVICEAUTH
)
{
{
castchannel
::
DeviceAuthMessage
authMessage
;
castchannel
::
DeviceAuthMessage
authMessage
;
authMessage
.
ParseFromString
(
msg
.
payload_binary
());
authMessage
.
ParseFromString
(
msg
.
payload_binary
());
...
@@ -596,11 +596,11 @@ static int processMessage(sout_stream_t *p_stream, const castchannel::CastMessag
...
@@ -596,11 +596,11 @@ static int processMessage(sout_stream_t *p_stream, const castchannel::CastMessag
{
{
vlc_mutex_locker
locker
(
&
p_sys
->
lock
);
vlc_mutex_locker
locker
(
&
p_sys
->
lock
);
p_sys
->
i_status
=
CHROMECAST_AUTHENTICATED
;
p_sys
->
i_status
=
CHROMECAST_AUTHENTICATED
;
p_sys
->
p_intf
->
msgConnect
(
"receiver-0"
);
p_sys
->
p_intf
->
msgConnect
(
DEFAULT_CHOMECAST_RECEIVER
);
p_sys
->
p_intf
->
msgReceiverLaunchApp
();
p_sys
->
p_intf
->
msgReceiverLaunchApp
();
}
}
}
}
else
if
(
namespace_
==
"urn:x-cast:com.google.cast.tp.heartbeat"
)
else
if
(
namespace_
==
NAMESPACE_HEARTBEAT
)
{
{
json_value
*
p_data
=
json_parse
(
msg
.
payload_utf8
().
c_str
());
json_value
*
p_data
=
json_parse
(
msg
.
payload_utf8
().
c_str
());
std
::
string
type
((
*
p_data
)[
"type"
]);
std
::
string
type
((
*
p_data
)[
"type"
]);
...
@@ -622,7 +622,7 @@ static int processMessage(sout_stream_t *p_stream, const castchannel::CastMessag
...
@@ -622,7 +622,7 @@ static int processMessage(sout_stream_t *p_stream, const castchannel::CastMessag
json_value_free
(
p_data
);
json_value_free
(
p_data
);
}
}
else
if
(
namespace_
==
"urn:x-cast:com.google.cast.receiver"
)
else
if
(
namespace_
==
NAMESPACE_RECEIVER
)
{
{
json_value
*
p_data
=
json_parse
(
msg
.
payload_utf8
().
c_str
());
json_value
*
p_data
=
json_parse
(
msg
.
payload_utf8
().
c_str
());
std
::
string
type
((
*
p_data
)[
"type"
]);
std
::
string
type
((
*
p_data
)[
"type"
]);
...
@@ -685,7 +685,7 @@ static int processMessage(sout_stream_t *p_stream, const castchannel::CastMessag
...
@@ -685,7 +685,7 @@ static int processMessage(sout_stream_t *p_stream, const castchannel::CastMessag
json_value_free
(
p_data
);
json_value_free
(
p_data
);
}
}
else
if
(
namespace_
==
"urn:x-cast:com.google.cast.media"
)
else
if
(
namespace_
==
NAMESPACE_MEDIA
)
{
{
json_value
*
p_data
=
json_parse
(
msg
.
payload_utf8
().
c_str
());
json_value
*
p_data
=
json_parse
(
msg
.
payload_utf8
().
c_str
());
std
::
string
type
((
*
p_data
)[
"type"
]);
std
::
string
type
((
*
p_data
)[
"type"
]);
...
@@ -713,7 +713,7 @@ static int processMessage(sout_stream_t *p_stream, const castchannel::CastMessag
...
@@ -713,7 +713,7 @@ static int processMessage(sout_stream_t *p_stream, const castchannel::CastMessag
json_value_free
(
p_data
);
json_value_free
(
p_data
);
}
}
else
if
(
namespace_
==
"urn:x-cast:com.google.cast.tp.connection"
)
else
if
(
namespace_
==
NAMESPACE_CONNECTION
)
{
{
json_value
*
p_data
=
json_parse
(
msg
.
payload_utf8
().
c_str
());
json_value
*
p_data
=
json_parse
(
msg
.
payload_utf8
().
c_str
());
std
::
string
type
((
*
p_data
)[
"type"
]);
std
::
string
type
((
*
p_data
)[
"type"
]);
...
...
modules/stream_out/chromecast/chromecast.h
View file @
4921e9a2
...
@@ -36,6 +36,16 @@
...
@@ -36,6 +36,16 @@
#include "cast_channel.pb.h"
#include "cast_channel.pb.h"
// Media player Chromecast app id
static
const
std
::
string
DEFAULT_CHOMECAST_RECEIVER
=
"receiver-0"
;
static
const
std
::
string
NAMESPACE_DEVICEAUTH
=
"urn:x-cast:com.google.cast.tp.deviceauth"
;
static
const
std
::
string
NAMESPACE_CONNECTION
=
"urn:x-cast:com.google.cast.tp.connection"
;
static
const
std
::
string
NAMESPACE_HEARTBEAT
=
"urn:x-cast:com.google.cast.tp.heartbeat"
;
static
const
std
::
string
NAMESPACE_RECEIVER
=
"urn:x-cast:com.google.cast.receiver"
;
/* see https://developers.google.com/cast/docs/reference/messages */
static
const
std
::
string
NAMESPACE_MEDIA
=
"urn:x-cast:com.google.cast.media"
;
// Status
// Status
enum
enum
{
{
...
...
modules/stream_out/chromecast/chromecast_ctrl.cpp
View file @
4921e9a2
...
@@ -89,7 +89,7 @@ void intf_sys_t::msgAuth()
...
@@ -89,7 +89,7 @@ void intf_sys_t::msgAuth()
std
::
string
authMessageString
;
std
::
string
authMessageString
;
authMessage
.
SerializeToString
(
&
authMessageString
);
authMessage
.
SerializeToString
(
&
authMessageString
);
castchannel
::
CastMessage
msg
=
buildMessage
(
"urn:x-cast:com.google.cast.tp.deviceauth"
,
castchannel
::
CastMessage
msg
=
buildMessage
(
NAMESPACE_DEVICEAUTH
,
castchannel
::
CastMessage_PayloadType_BINARY
,
authMessageString
);
castchannel
::
CastMessage_PayloadType_BINARY
,
authMessageString
);
messagesToSend
.
push
(
msg
);
messagesToSend
.
push
(
msg
);
...
@@ -99,7 +99,7 @@ void intf_sys_t::msgAuth()
...
@@ -99,7 +99,7 @@ void intf_sys_t::msgAuth()
void
intf_sys_t
::
msgPing
()
void
intf_sys_t
::
msgPing
()
{
{
std
::
string
s
(
"{
\"
type
\"
:
\"
PING
\"
}"
);
std
::
string
s
(
"{
\"
type
\"
:
\"
PING
\"
}"
);
castchannel
::
CastMessage
msg
=
buildMessage
(
"urn:x-cast:com.google.cast.tp.heartbeat"
,
castchannel
::
CastMessage
msg
=
buildMessage
(
NAMESPACE_HEARTBEAT
,
castchannel
::
CastMessage_PayloadType_STRING
,
s
);
castchannel
::
CastMessage_PayloadType_STRING
,
s
);
messagesToSend
.
push
(
msg
);
messagesToSend
.
push
(
msg
);
...
@@ -109,7 +109,7 @@ void intf_sys_t::msgPing()
...
@@ -109,7 +109,7 @@ void intf_sys_t::msgPing()
void
intf_sys_t
::
msgPong
()
void
intf_sys_t
::
msgPong
()
{
{
std
::
string
s
(
"{
\"
type
\"
:
\"
PONG
\"
}"
);
std
::
string
s
(
"{
\"
type
\"
:
\"
PONG
\"
}"
);
castchannel
::
CastMessage
msg
=
buildMessage
(
"urn:x-cast:com.google.cast.tp.heartbeat"
,
castchannel
::
CastMessage
msg
=
buildMessage
(
NAMESPACE_HEARTBEAT
,
castchannel
::
CastMessage_PayloadType_STRING
,
s
);
castchannel
::
CastMessage_PayloadType_STRING
,
s
);
messagesToSend
.
push
(
msg
);
messagesToSend
.
push
(
msg
);
...
@@ -119,7 +119,7 @@ void intf_sys_t::msgPong()
...
@@ -119,7 +119,7 @@ void intf_sys_t::msgPong()
void
intf_sys_t
::
msgConnect
(
std
::
string
destinationId
)
void
intf_sys_t
::
msgConnect
(
std
::
string
destinationId
)
{
{
std
::
string
s
(
"{
\"
type
\"
:
\"
CONNECT
\"
}"
);
std
::
string
s
(
"{
\"
type
\"
:
\"
CONNECT
\"
}"
);
castchannel
::
CastMessage
msg
=
buildMessage
(
"urn:x-cast:com.google.cast.tp.connection"
,
castchannel
::
CastMessage
msg
=
buildMessage
(
NAMESPACE_CONNECTION
,
castchannel
::
CastMessage_PayloadType_STRING
,
s
,
destinationId
);
castchannel
::
CastMessage_PayloadType_STRING
,
s
,
destinationId
);
messagesToSend
.
push
(
msg
);
messagesToSend
.
push
(
msg
);
...
@@ -129,7 +129,7 @@ void intf_sys_t::msgConnect(std::string destinationId)
...
@@ -129,7 +129,7 @@ void intf_sys_t::msgConnect(std::string destinationId)
void
intf_sys_t
::
msgReceiverClose
(
std
::
string
destinationId
)
void
intf_sys_t
::
msgReceiverClose
(
std
::
string
destinationId
)
{
{
std
::
string
s
(
"{
\"
type
\"
:
\"
CLOSE
\"
}"
);
std
::
string
s
(
"{
\"
type
\"
:
\"
CLOSE
\"
}"
);
castchannel
::
CastMessage
msg
=
buildMessage
(
"urn:x-cast:com.google.cast.tp.connection"
,
castchannel
::
CastMessage
msg
=
buildMessage
(
NAMESPACE_CONNECTION
,
castchannel
::
CastMessage_PayloadType_STRING
,
s
,
destinationId
);
castchannel
::
CastMessage_PayloadType_STRING
,
s
,
destinationId
);
messagesToSend
.
push
(
msg
);
messagesToSend
.
push
(
msg
);
...
@@ -140,7 +140,7 @@ void intf_sys_t::msgReceiverGetStatus()
...
@@ -140,7 +140,7 @@ void intf_sys_t::msgReceiverGetStatus()
std
::
stringstream
ss
;
std
::
stringstream
ss
;
ss
<<
"{
\"
type
\"
:
\"
GET_STATUS
\"
}"
;
ss
<<
"{
\"
type
\"
:
\"
GET_STATUS
\"
}"
;
castchannel
::
CastMessage
msg
=
buildMessage
(
"urn:x-cast:com.google.cast.receiver"
,
castchannel
::
CastMessage
msg
=
buildMessage
(
NAMESPACE_RECEIVER
,
castchannel
::
CastMessage_PayloadType_STRING
,
ss
.
str
());
castchannel
::
CastMessage_PayloadType_STRING
,
ss
.
str
());
messagesToSend
.
push
(
msg
);
messagesToSend
.
push
(
msg
);
...
@@ -153,7 +153,7 @@ void intf_sys_t::msgReceiverLaunchApp()
...
@@ -153,7 +153,7 @@ void intf_sys_t::msgReceiverLaunchApp()
<<
"
\"
appId
\"
:
\"
"
<<
APP_ID
<<
"
\"
,"
<<
"
\"
appId
\"
:
\"
"
<<
APP_ID
<<
"
\"
,"
<<
"
\"
requestId
\"
:"
<<
i_requestId
++
<<
"}"
;
<<
"
\"
requestId
\"
:"
<<
i_requestId
++
<<
"}"
;
castchannel
::
CastMessage
msg
=
buildMessage
(
"urn:x-cast:com.google.cast.receiver"
,
castchannel
::
CastMessage
msg
=
buildMessage
(
NAMESPACE_RECEIVER
,
castchannel
::
CastMessage_PayloadType_STRING
,
ss
.
str
());
castchannel
::
CastMessage_PayloadType_STRING
,
ss
.
str
());
messagesToSend
.
push
(
msg
);
messagesToSend
.
push
(
msg
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment