[vlc-devel] [PATCH 1/6] chromecast: pass the MIME type to the http server
Steve Lhomme
robux4 at videolabs.io
Wed Oct 7 15:36:37 CEST 2015
--
replaces https://patches.videolan.org/patch/10248/
---
modules/stream_out/chromecast/cast.cpp | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index e878f80..3ce9024 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -83,6 +83,7 @@ struct sout_stream_sys_t
unsigned i_requestId;
std::string appTransportId;
+ char *psz_mime;
std::queue<castchannel::CastMessage> messagesToSend;
@@ -233,6 +234,13 @@ static int Open(vlc_object_t *p_this)
}
p_sys->serverIP = psz_localIP;
+ p_sys->psz_mime = var_GetNonEmptyString(p_stream, SOUT_CFG_PREFIX "mime");
+ if (p_sys->psz_mime == NULL)
+ {
+ Clean(p_stream);
+ return VLC_EGENERIC;
+ }
+
char *psz_mux = var_GetNonEmptyString(p_stream, SOUT_CFG_PREFIX "mux");
if (psz_mux == NULL)
{
@@ -240,9 +248,9 @@ static int Open(vlc_object_t *p_this)
return VLC_EGENERIC;
}
char *psz_chain = NULL;
- int i_bytes = asprintf(&psz_chain, "http{dst=:%u/stream,mux=%s}",
+ int i_bytes = asprintf(&psz_chain, "http{dst=:%u/stream,mux=%s,access=http{mime=%s}}",
(unsigned)var_InheritInteger(p_stream, SOUT_CFG_PREFIX"http-port"),
- psz_mux);
+ psz_mux, p_sys->psz_mime);
free(psz_mux);
if (i_bytes < 0)
{
@@ -352,6 +360,7 @@ static void Clean(sout_stream_t *p_stream)
disconnectChromecast(p_stream);
+ free(p_sys->psz_mime);
delete p_sys;
}
@@ -878,21 +887,15 @@ static void msgLoad(sout_stream_t *p_stream)
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
- char *psz_mime = var_GetNonEmptyString(p_stream, SOUT_CFG_PREFIX "mime");
- if (psz_mime == NULL)
- return;
-
std::stringstream ss;
ss << "{\"type\":\"LOAD\","
<< "\"media\":{\"contentId\":\"http://" << p_sys->serverIP << ":"
<< var_InheritInteger(p_stream, SOUT_CFG_PREFIX"http-port")
<< "/stream\","
<< "\"streamType\":\"LIVE\","
- << "\"contentType\":\"" << std::string(psz_mime) << "\"},"
+ << "\"contentType\":\"" << p_sys->psz_mime << "\"},"
<< "\"requestId\":" << p_stream->p_sys->i_requestId++ << "}";
- free(psz_mime);
-
castchannel::CastMessage msg = buildMessage("urn:x-cast:com.google.cast.media",
castchannel::CastMessage_PayloadType_STRING, ss.str(), p_sys->appTransportId);
--
2.5.2
More information about the vlc-devel
mailing list