[vlc-commits] microdns: Use chromecasts' friendly name when available

Hugo Beauzée-Luyssen git at videolan.org
Tue Jan 9 12:38:45 CET 2018


vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Jan  8 18:04:11 2018 +0100| [771bb38588e6bfaecdade9aa24b227bb53241d4f] | committer: Jean-Baptiste Kempf

microdns: Use chromecasts' friendly name when available

(cherry picked from commit 8d895bed0cd1de88dd7c6a161995eeb1d7e77b24)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/services_discovery/microdns.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/modules/services_discovery/microdns.c b/modules/services_discovery/microdns.c
index e9b7ecc567..c83bda6c25 100644
--- a/modules/services_discovery/microdns.c
+++ b/modules/services_discovery/microdns.c
@@ -301,6 +301,7 @@ parse_entries( const struct rr_entry *p_entries, bool b_renderer,
 
     /* There is one ip for several srvs, fetch them */
     const char *psz_ip = NULL;
+    struct srv *p_srv = NULL;
     i_nb_srv = 0;
     for( const struct rr_entry *p_entry = p_entries;
          p_entry != NULL; p_entry = p_entry->next )
@@ -312,7 +313,7 @@ parse_entries( const struct rr_entry *p_entries, bool b_renderer,
                 if( !strrcmp( p_entry->name, protocols[i].psz_service_name ) &&
                     protocols[i].b_renderer == b_renderer )
                 {
-                    struct srv *p_srv = &p_srvs[i_nb_srv];
+                    p_srv = &p_srvs[i_nb_srv];
 
                     p_srv->psz_device_name =
                         strndup( p_entry->name, strlen( p_entry->name )
@@ -334,6 +335,19 @@ parse_entries( const struct rr_entry *p_entries, bool b_renderer,
             psz_ip = p_entry->data.AAAA.addr_str;
             *p_ipv6 = true;
         }
+        else if( p_entry->type == RR_TXT && p_srv != NULL )
+        {
+            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 ) )
+                {
+                    free( p_srv->psz_device_name );
+                    p_srv->psz_device_name = strdup( p_txt->txt + 3 );
+                }
+            }
+        }
     }
     if( psz_ip == NULL || i_nb_srv == 0 )
     {



More information about the vlc-commits mailing list