* Preamble
*****************************************************************************/
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include "bonjour.h"
#ifdef HAVE_AVAHI_CLIENT
#include <vlc_sout.h>
{
vlc_thread_ready( p_pt );
- while( !p_pt->b_die )
+ while( vlc_object_alive (p_pt) )
if( avahi_simple_poll_iterate( p_pt->simple_poll, 100 ) != 0 )
break;
}
/*****************************************************************************
* bonjour_start_service
*****************************************************************************/
-void *bonjour_start_service( vlc_object_t *p_log, char *psz_stype,
- char *psz_name, int i_port, char *psz_txt )
+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) );
if( p_sys == NULL )
- {
- msg_Err( p_log, "out of memory" );
return NULL;
- }
memset( p_sys, 0, sizeof(*p_sys) );
p_sys->psz_name = avahi_strdup( psz_name );
p_sys->psz_stype = avahi_strdup( psz_stype );
if( p_sys->psz_name == NULL || p_sys->psz_stype == NULL )
- {
- msg_Err( p_sys->p_log, "out of memory" );
goto error;
- }
if( psz_txt != NULL )
{
p_sys->psz_txt = avahi_strdup( psz_txt );
if( p_sys->psz_txt == NULL )
- {
- msg_Err( p_sys->p_log, "out of memory" );
goto error;
- }
}
p_sys->simple_poll = avahi_simple_poll_new();
p_sys->poll_thread = vlc_object_create( p_sys->p_log,
sizeof(poll_thread_t) );
if( p_sys->poll_thread == NULL )
- {
- msg_Err( p_sys->p_log, "out of memory" );
goto error;
- }
p_sys->poll_thread->simple_poll = p_sys->simple_poll;
if( vlc_thread_create( p_sys->poll_thread, "Avahi Poll Iterate Thread",
poll_iterate_thread,
- VLC_THREAD_PRIORITY_HIGHEST, VLC_FALSE ) )
+ VLC_THREAD_PRIORITY_HIGHEST, false ) )
{
msg_Err( p_sys->p_log, "failed to create poll iterate thread" );
goto error;
error:
if( p_sys->poll_thread != NULL )
- vlc_object_destroy( p_sys->poll_thread );
+ vlc_object_release( p_sys->poll_thread );
if( p_sys->client != NULL )
avahi_client_free( p_sys->client );
if( p_sys->simple_poll != NULL )
vlc_object_kill( p_sys->poll_thread );
vlc_thread_join( p_sys->poll_thread );
- vlc_object_destroy( p_sys->poll_thread );
+ vlc_object_release( p_sys->poll_thread );
if( p_sys->group != NULL )
avahi_entry_group_free( p_sys->group );