X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess_output%2Fbonjour.c;h=3dfb9b888a136860df1342217a7629f9e7dfca92;hb=20141e2c65bd1b5c924943046ec640adc5ec7a4a;hp=507ddf44687cb81eca4078e614556278f1a18f39;hpb=be400691f55a66d411e9bd7787feb1f4332612f0;p=vlc diff --git a/modules/access_output/bonjour.c b/modules/access_output/bonjour.c index 507ddf4468..3dfb9b888a 100644 --- a/modules/access_output/bonjour.c +++ b/modules/access_output/bonjour.c @@ -36,10 +36,8 @@ #include #include -#ifdef HAVE_AVAHI_06 -# include -# include -#endif +#include +#include #include #include #include @@ -122,11 +120,7 @@ static int create_service( bonjour_t *p_sys ) } error = avahi_entry_group_add_service( p_sys->group, AVAHI_IF_UNSPEC, -#ifdef HAVE_AVAHI_06 AVAHI_PROTO_UNSPEC, 0, p_sys->psz_name, -#else - AVAHI_PROTO_UNSPEC, p_sys->psz_name, -#endif p_sys->psz_stype, NULL, NULL, p_sys->i_port, p_sys->psz_txt, NULL ); @@ -167,12 +161,8 @@ static void client_callback( AvahiClient *c, if( p_sys->group != NULL ) avahi_entry_group_reset( p_sys->group ); } -#ifdef HAVE_AVAHI_06 else if( state == AVAHI_CLIENT_FAILURE && (avahi_client_errno(c) == AVAHI_ERR_DISCONNECTED) ) -#else - else if( state == AVAHI_CLIENT_DISCONNECTED ) -#endif { msg_Err( p_sys->p_log, "avahi client disconnected" ); avahi_simple_poll_quit( p_sys->simple_poll ); @@ -185,7 +175,6 @@ static void client_callback( AvahiClient *c, static void* poll_iterate_thread( vlc_object_t *p_this ) { poll_thread_t *p_pt = (poll_thread_t*)p_this; - vlc_thread_ready( p_pt ); int canc = vlc_savecancel (); while( vlc_object_alive (p_pt) ) @@ -203,16 +192,12 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype, const char *psz_name, int i_port, char *psz_txt ) { int err; - bonjour_t *p_sys; - p_sys = (bonjour_t *)malloc( sizeof(*p_sys) ); + bonjour_t* p_sys = calloc( 1, sizeof(*p_sys) ); if( p_sys == NULL ) return NULL; - memset( p_sys, 0, sizeof(*p_sys) ); - p_sys->p_log = p_log; - p_sys->i_port = i_port; p_sys->psz_name = avahi_strdup( psz_name ); p_sys->psz_stype = avahi_strdup( psz_stype ); @@ -234,9 +219,7 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype, } p_sys->client = avahi_client_new( avahi_simple_poll_get(p_sys->simple_poll), -#ifdef HAVE_AVAHI_06 0, -#endif client_callback, p_sys, &err ); if( p_sys->client == NULL ) { @@ -253,7 +236,7 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype, if( vlc_thread_create( p_sys->poll_thread, "Avahi Poll Iterate Thread", poll_iterate_thread, - VLC_THREAD_PRIORITY_HIGHEST, false ) ) + VLC_THREAD_PRIORITY_HIGHEST ) ) { msg_Err( p_sys->p_log, "failed to create poll iterate thread" ); goto error;