+#ifdef HAVE_AVAHI_CLIENT
+ if( config_GetInt(p_this, SOUT_CFG_PREFIX "bonjour") )
+ {
+ char *psz_txt, *psz_name;
+ playlist_t *p_playlist = pl_Yield( p_access );
+
+ char *psz_uri = input_item_GetURI( p_playlist->status.p_item->p_input );
+ char *psz_newuri = psz_uri;
+ psz_name = strrchr( psz_newuri, DIRECTORY_SEPARATOR );
+ if( psz_name != NULL ) psz_name++;
+ else psz_name = psz_newuri;
+
+ if( psz_file_name &&
+ asprintf( &psz_txt, "path=%s", psz_file_name ) == -1 )
+ {
+ pl_Release( p_access );
+ free( psz_uri );
+ return VLC_ENOMEM;
+ }
+
+ p_sys->p_bonjour = bonjour_start_service( (vlc_object_t *)p_access,
+ strcmp( p_access->psz_access, "https" )
+ ? "_vlc-http._tcp" : "_vlc-https._tcp",
+ psz_name, i_bind_port, psz_txt );
+ free( psz_uri );
+ free( (void *)psz_txt );
+
+ if( p_sys->p_bonjour == NULL )
+ msg_Err( p_access, "unable to start requested Bonjour announce" );
+ pl_Release( p_access );
+ }
+ else
+ p_sys->p_bonjour = NULL;
+#endif
+