[vlc-commits] microdns: Fix chromecast audio detection

Hugo Beauzée-Luyssen git at videolan.org
Tue Jan 16 17:19:23 CET 2018


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Jan 16 15:29:48 2018 +0100| [108ea2b884113d3ebe2fe8e24ccd285ca311eea9] | committer: Hugo Beauzée-Luyssen

microdns: Fix chromecast audio detection

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

 modules/services_discovery/microdns.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/modules/services_discovery/microdns.c b/modules/services_discovery/microdns.c
index 368309f1bd..e5d60eb8dd 100644
--- a/modules/services_discovery/microdns.c
+++ b/modules/services_discovery/microdns.c
@@ -340,11 +340,26 @@ parse_entries( const struct rr_entry *p_entries, bool b_renderer,
             for ( struct rr_data_txt *p_txt = p_entry->data.TXT;
                   p_txt != NULL ; p_txt = p_txt->next )
             {
-                if( !strcmp( p_srv->psz_protocol, "chromecast" ) &&
-                        !strncmp( "fn=", p_txt->txt, 3 ) )
+                if( !strcmp( p_srv->psz_protocol, "chromecast" ) )
                 {
-                    free( p_srv->psz_device_name );
-                    p_srv->psz_device_name = strdup( p_txt->txt + 3 );
+                    if ( !strncmp( "fn=", p_txt->txt, 3 ) )
+                    {
+                        free( p_srv->psz_device_name );
+                        p_srv->psz_device_name = strdup( p_txt->txt + 3 );
+                    }
+                    else if( !strncmp( "ca=", p_txt->txt, 3 ) )
+                    {
+                        int ca = atoi( p_txt->txt + 3);
+                        /*
+                         * For chromecast, the `ca=` is composed from (at least)
+                         * 0x01 to indicate video support
+                         * 0x04 to indivate audio support
+                         */
+                        if ( ( ca & 0x01 ) != 0 )
+                            p_srv->i_renderer_flags |= VLC_RENDERER_CAN_VIDEO;
+                        if ( ( ca & 0x04 ) != 0 )
+                            p_srv->i_renderer_flags |= VLC_RENDERER_CAN_AUDIO;
+                    }
                 }
             }
         }
@@ -514,12 +529,7 @@ new_entries_rd_cb( void *p_this, int i_status, const struct rr_entry *p_entries
         }
 
         if( strcmp( p_srv->psz_protocol, "chromecast" ) == 0)
-        {
-            if ( psz_model == NULL
-                || strcasecmp( psz_model, "Chromecast Audio" ) != 0 )
-                p_srv->i_renderer_flags |= VLC_RENDERER_CAN_VIDEO;
             psz_demux_filter = "cc_demux";
-        }
 
         items_add_renderer( p_sys, p_rd, p_srv->psz_device_name, psz_uri,
                             psz_demux_filter, psz_icon_uri,



More information about the vlc-commits mailing list