[vlc-devel] [PATCH 6/6] avahi: Include the model in the friendly name
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Fri Jun 26 17:11:12 CEST 2020
Since it helps differenciate amongs devices and matches what
bonjour & microdns are doing
---
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 );
}
/*****************************************************************************
--
2.20.1
More information about the vlc-devel
mailing list