[vlc-commits] chromecast: chromecast_ctrl is no longer an interface plugin

Steve Lhomme git at videolan.org
Tue May 3 13:22:58 CEST 2016


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Thu Apr 28 14:18:34 2016 +0200| [ec6fb41a142dc365a242dfac2c266da00b5ca6a8] | committer: Thomas Guillem

chromecast: chromecast_ctrl is no longer an interface plugin

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ec6fb41a142dc365a242dfac2c266da00b5ca6a8
---

 modules/stream_out/Makefile.am                    |   10 --
 modules/stream_out/chromecast/chromecast.h        |    5 +-
 modules/stream_out/chromecast/chromecast_ctrl.cpp |  141 ---------------------
 3 files changed, 4 insertions(+), 152 deletions(-)

diff --git a/modules/stream_out/Makefile.am b/modules/stream_out/Makefile.am
index e30cd43..26c0cf2 100644
--- a/modules/stream_out/Makefile.am
+++ b/modules/stream_out/Makefile.am
@@ -80,15 +80,6 @@ SUFFIXES += .proto .pb.cc
 %.pb.h %.pb.cc: %.proto
 	$(PROTOC) --cpp_out=. -I$(srcdir) $<
 
-libchromecast_plugin_la_SOURCES = \
-    stream_out/chromecast/cast_channel.proto stream_out/chromecast/chromecast.h \
-    stream_out/chromecast/chromecast_ctrl.cpp \
-    misc/webservices/json.h misc/webservices/json.c
-nodist_libchromecast_plugin_la_SOURCES = stream_out/chromecast/cast_channel.pb.cc
-libchromecast_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -Istream_out/chromecast $(CHROMECAST_CFLAGS)
-libchromecast_plugin_la_LIBADD = $(CHROMECAST_LIBS) $(SOCKET_LIBS)
-CLEANFILES += $(nodist_libchromecast_plugin_la_SOURCES)
-
 libstream_out_chromecast_plugin_la_SOURCES = stream_out/chromecast/cast.cpp stream_out/chromecast/chromecast.h
 libstream_out_chromecast_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -Istream_out/chromecast $(CHROMECAST_CFLAGS)
 libstream_out_chromecast_plugin_la_LIBADD = $(CHROMECAST_LIBS) $(SOCKET_LIBS)
@@ -97,6 +88,5 @@ if ENABLE_SOUT
 if BUILD_CHROMECAST
 BUILT_SOURCES += stream_out/chromecast/cast_channel.pb.h
 sout_LTLIBRARIES += libstream_out_chromecast_plugin.la
-control_LTLIBRARIES += libchromecast_plugin.la
 endif
 endif
diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index 2031fee..6998c22 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -72,6 +72,10 @@ enum receiver_state {
     RECEIVER_PAUSED,
 };
 
+
+/*****************************************************************************
+ * intf_sys_t: description and status of interface
+ *****************************************************************************/
 struct intf_sys_t
 {
     intf_sys_t(vlc_object_t * const p_this);
@@ -80,7 +84,6 @@ struct intf_sys_t
     vlc_object_t  * const p_module;
     std::string    serverIP;
     std::string    mime;
-    std::string    muxer;
 
     std::string appTransportId;
     std::string mediaSessionId;
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index c7fce9b..7bc3224 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -32,8 +32,6 @@
 
 #include "chromecast.h"
 
-#include <vlc_playlist.h>
-
 #include <cassert>
 #include <cerrno>
 #ifdef HAVE_POLL
@@ -66,147 +64,8 @@ static const std::string NAMESPACE_RECEIVER         = "urn:x-cast:com.google.cas
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int Open(vlc_object_t *);
-static void Close(vlc_object_t *);
-
 static void *ChromecastThread(void *data);
 
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-
-#define IP_TEXT N_("Chromecast IP address")
-#define IP_LONGTEXT N_("This sets the IP address of the Chromecast receiver.")
-#define HTTP_PORT_TEXT N_("HTTP port")
-#define HTTP_PORT_LONGTEXT N_("This sets the HTTP port of the server " \
-                              "used to stream the media to the Chromecast.")
-#define MUXER_TEXT N_("Muxer")
-#define MUXER_LONGTEXT N_("This sets the muxer used to stream to the Chromecast.")
-#define MIME_TEXT N_("MIME content type")
-#define MIME_LONGTEXT N_("This sets the media MIME content type sent to the Chromecast.")
-
-vlc_module_begin ()
-    set_shortname( N_("Chromecast") )
-    set_category( CAT_INTERFACE )
-    set_subcategory( SUBCAT_INTERFACE_CONTROL )
-    set_description( N_("Chromecast interface") )
-    set_capability( "interface", 0 )
-    add_shortcut("chromecast")
-    add_string(CONTROL_CFG_PREFIX "addr", "", IP_TEXT, IP_LONGTEXT, false)
-    add_integer(CONTROL_CFG_PREFIX "http-port", HTTP_PORT, HTTP_PORT_TEXT, HTTP_PORT_LONGTEXT, false)
-    add_string(CONTROL_CFG_PREFIX "mime", "video/x-matroska", MIME_TEXT, MIME_LONGTEXT, false)
-    add_string(CONTROL_CFG_PREFIX "mux", "avformat{mux=matroska}", MUXER_TEXT, MUXER_LONGTEXT, false)
-    set_callbacks( Open, Close )
-
-vlc_module_end ()
-
-/*****************************************************************************
- * Open: connect to the Chromecast and initialize the sout
- *****************************************************************************/
-int Open(vlc_object_t *p_module)
-{
-    intf_thread_t *p_intf = reinterpret_cast<intf_thread_t*>(p_module);
-    intf_sys_t *p_sys = new(std::nothrow) intf_sys_t(p_module);
-    if (unlikely(p_sys == NULL))
-        return VLC_ENOMEM;
-    p_intf->p_sys = p_sys;
-
-    mtime_t deadline;
-    char *psz_mux;
-
-    char *psz_ipChromecast = var_InheritString( p_module, CONTROL_CFG_PREFIX "addr");
-    if (psz_ipChromecast == NULL)
-    {
-        msg_Err( p_module, "No Chromecast receiver IP provided");
-        goto error;
-    }
-
-    p_sys->i_sock_fd = p_sys->connectChromecast(psz_ipChromecast);
-    free(psz_ipChromecast);
-    if (p_sys->i_sock_fd < 0)
-    {
-        msg_Err( p_module, "Could not connect the Chromecast");
-        goto error;
-    }
-    p_sys->setConnectionStatus(CHROMECAST_TLS_CONNECTED);
-
-    char psz_localIP[NI_MAXNUMERICHOST];
-    if (net_GetSockAddress(p_sys->i_sock_fd, psz_localIP, NULL))
-    {
-        msg_Err( p_module, "Cannot get local IP address");
-        goto error;
-    }
-    p_sys->serverIP = psz_localIP;
-
-    psz_mux = var_InheritString( p_module, CONTROL_CFG_PREFIX "mux");
-    if (psz_mux == NULL)
-    {
-        msg_Err( p_module, "Bad muxer provided");
-        goto error;
-    }
-    p_sys->muxer = psz_mux;
-    free(psz_mux);
-
-    psz_mux = var_InheritString( p_module, CONTROL_CFG_PREFIX "mime");
-    if (psz_mux == NULL)
-    {
-        msg_Err( p_module, "Bad MIME type provided");
-        goto error;
-    }
-    p_sys->mime = psz_mux; /* TODO get the MIME type from the playlist/input ? */
-    free(psz_mux);
-
-    // Start the Chromecast event thread.
-    if (vlc_clone(&p_sys->chromecastThread, ChromecastThread, p_module,
-                  VLC_THREAD_PRIORITY_LOW))
-    {
-        msg_Err( p_module, "Could not start the Chromecast talking thread");
-        goto error;
-    }
-
-    /* Ugly part:
-     * We want to be sure that the Chromecast receives the first data packet sent by
-     * the HTTP server. */
-
-    // Lock the sout thread until we have sent the media loading command to the Chromecast.
-    deadline = mdate() + 6 * CLOCK_FREQ;
-    vlc_mutex_lock(&p_sys->lock);
-    while (p_sys->getPlayerStatus() != CMD_LOAD_SENT)
-    {
-        int i_ret = vlc_cond_timedwait(&p_sys->loadCommandCond, &p_sys->lock, deadline);
-        if (i_ret == ETIMEDOUT)
-        {
-            msg_Err( p_module, "Timeout reached before sending the media loading command");
-            vlc_mutex_unlock(&p_sys->lock);
-            vlc_cancel(p_sys->chromecastThread);
-            goto error;
-        }
-    }
-    vlc_mutex_unlock(&p_sys->lock);
-
-    /* Even uglier: sleep more to let to the Chromecast initiate the connection
-     * to the http server. */
-    msleep(2 * CLOCK_FREQ);
-
-    return VLC_SUCCESS;
-
-error:
-    delete p_sys;
-    return VLC_EGENERIC;
-}
-
-
-/*****************************************************************************
- * Close: destroy interface
- *****************************************************************************/
-void Close(vlc_object_t *p_module)
-{
-    intf_thread_t *p_intf = reinterpret_cast<intf_thread_t*>(p_module);
-    intf_sys_t *p_sys = p_intf->p_sys;
-
-    delete p_sys;
-}
-
 /**
  * @brief Build a CastMessage to send to the Chromecast
  * @param namespace_ the message namespace



More information about the vlc-commits mailing list