[vlc-commits] [Git][videolan/vlc][3.0.x] chromecast: Disable HEVC for original Chromecast devices

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Apr 15 16:35:16 UTC 2026



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
328920c5 by Gautier at 2026-04-15T16:11:59+00:00
chromecast: Disable HEVC for original Chromecast devices

- - - - -


4 changed files:

- modules/stream_out/chromecast/cast.cpp
- modules/stream_out/chromecast/chromecast.h
- modules/stream_out/chromecast/chromecast_ctrl.cpp
- src/misc/renderer_discovery.c


Changes:

=====================================
modules/stream_out/chromecast/cast.cpp
=====================================
@@ -179,7 +179,7 @@ static int AccessOpen(vlc_object_t *);
 static void AccessClose(vlc_object_t *);
 
 static const char *const ppsz_sout_options[] = {
-    "ip", "port",  "http-port", "video", NULL
+    "ip", "port", "http-port", "video", "device-name", NULL
 };
 
 /*****************************************************************************
@@ -248,6 +248,8 @@ vlc_module_begin ()
         change_private()
     add_integer(SOUT_CFG_PREFIX "port", CHROMECAST_CONTROL_PORT, NULL, NULL, false)
         change_private()
+    add_string(SOUT_CFG_PREFIX "device-name", NULL, NULL, NULL, false)
+        change_private()
     add_bool(SOUT_CFG_PREFIX "video", true, NULL, NULL, false)
         change_private()
     add_integer(SOUT_CFG_PREFIX "http-port", HTTP_PORT, HTTP_PORT_TEXT, HTTP_PORT_LONGTEXT, false)
@@ -786,7 +788,20 @@ bool sout_stream_sys_t::canDecodeVideo( vlc_fourcc_t i_codec ) const
 {
     if( transcoding_state & TRANSCODING_VIDEO )
         return false;
-    return i_codec == VLC_CODEC_H264 || i_codec == VLC_CODEC_HEVC
+
+    const std::string suffix = "(Chromecast)";
+    const std::string name = p_intf->getDeviceName();
+    const bool original_chromecast = name.size() >= suffix.size() &&
+        std::equal(suffix.rbegin(), suffix.rend(), name.rbegin());
+
+    if( i_codec == VLC_CODEC_HEVC )
+    {
+        if( original_chromecast )
+            // Original Chromecasts do not support HEVC
+            return false;
+        return true;
+    }
+    return i_codec == VLC_CODEC_H264
         || i_codec == VLC_CODEC_VP8 || i_codec == VLC_CODEC_VP9;
 }
 


=====================================
modules/stream_out/chromecast/chromecast.h
=====================================
@@ -189,6 +189,8 @@ struct intf_sys_t
     std::string getHttpStreamPath() const;
     std::string getHttpArtRoot() const;
 
+    std::string getDeviceName() const { return m_device_name; };
+
     int httpd_file_fill( uint8_t *psz_request, uint8_t **pp_data, int *pi_data );
     void interrupt_wake_up();
 private:
@@ -247,6 +249,7 @@ private:
     const int      m_device_port;
     std::string    m_mime;
     std::string    m_device_addr;
+    std::string    m_device_name;
 
     std::string m_appTransportId;
     unsigned m_last_request_id;


=====================================
modules/stream_out/chromecast/chromecast_ctrl.cpp
=====================================
@@ -37,6 +37,7 @@
 #include <cerrno>
 #include <iomanip>
 
+#include <vlc_fixups.h>
 #include <vlc_stream.h>
 #include <vlc_rand.h>
 
@@ -116,6 +117,7 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device
  , m_cc_time_date( VLC_TICK_INVALID )
  , m_cc_time( VLC_TICK_INVALID )
  , m_pingRetriesLeft( PING_WAIT_RETRIES )
+ , m_device_name(_("Unknown"))
 {
     m_communication = new ChromecastCommunication( p_this,
         getHttpStreamPath(), getHttpStreamPort(),
@@ -133,6 +135,13 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device
     ss << "http://" << m_communication->getServerIp() << ":" << port;
     m_art_http_ip = ss.str();
 
+    char *device_name = var_GetString(p_this, "sout-chromecast-device-name");
+    if (device_name)
+    {
+        m_device_name = device_name;
+        free(device_name);
+    }
+
     m_common.p_opaque = this;
     m_common.pf_set_demux_enabled = set_demux_enabled;
     m_common.pf_get_time         = get_time;


=====================================
src/misc/renderer_discovery.c
=====================================
@@ -82,8 +82,10 @@ vlc_renderer_item_new(const char *psz_type, const char *psz_name,
     if (p_item->psz_name == NULL)
         goto error;
 
-    if (asprintf(&p_item->psz_sout, "%s{ip=%s,port=%d%s%s}",
+    if (asprintf(&p_item->psz_sout, "%s{ip=%s,port=%d,%s%s%s%s}",
                  url.psz_protocol, url.psz_host, url.i_port,
+                 psz_name != NULL ? "device-name=" : "",
+                 psz_name != NULL ? psz_name : "",
                  psz_extra_sout != NULL ? "," : "",
                  psz_extra_sout != NULL ? psz_extra_sout : "") == -1)
         goto error;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/328920c523eef72c15ee3b1a79da80319fa1350a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/328920c523eef72c15ee3b1a79da80319fa1350a
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list