[vlc-commits] avahi: Include the model in the friendly name

Hugo Beauzée-Luyssen git at videolan.org
Mon Jun 29 11:52:39 CEST 2020


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Jun 26 17:01:09 2020 +0200| [e3ef1a22532a1d9ebe183c6c21c691e17d65cf19] | committer: Hugo Beauzée-Luyssen

avahi: Include the model in the friendly name

Since it helps differenciate amongs devices and matches what
bonjour & microdns are doing

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

 modules/services_discovery/avahi.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/modules/services_discovery/avahi.c b/modules/services_discovery/avahi.c
index 7fe25e29e3..77bb9f3711 100644
--- a/modules/services_discovery/avahi.c
+++ b/modules/services_discovery/avahi.c
@@ -136,6 +136,7 @@ static void add_renderer( const char *psz_protocol, const char *psz_name,
     char *friendly_name = NULL;
     char *icon_uri = NULL;
     char *uri = NULL;
+    char *model = NULL;
     const char *demux = NULL;
     const char *extra_uri = NULL;
     int renderer_flags = 0;
@@ -174,6 +175,8 @@ static void add_renderer( const char *psz_protocol, const char *psz_name,
             free( icon_raw );
         }
 
+        model = get_string_list_value( txt, "md" );
+
         if( asprintf( &uri, "%s://%s:%u", psz_protocol, psz_addr, i_port ) < 0 )
             goto error;
 
@@ -181,6 +184,16 @@ static void add_renderer( const char *psz_protocol, const char *psz_name,
         demux = "cc_demux";
     }
 
+    if ( friendly_name && model ) {
+        char* combined;
+        if ( asprintf( &combined, "%s (%s)", friendly_name, model ) == -1 )
+            combined = NULL;
+        if ( combined != NULL ) {
+            free(friendly_name);
+            friendly_name = combined;
+        }
+    }
+
     vlc_renderer_item_t *p_renderer_item =
         vlc_renderer_item_new( psz_protocol, friendly_name ? friendly_name : psz_name, uri, extra_uri,
                                demux, icon_uri, renderer_flags );
@@ -195,6 +208,7 @@ error:
     free( friendly_name );
     free( icon_uri );
     free( uri );
+    free( model );
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list