~ubuntu-branches/ubuntu/maverick/vlc/maverick

« back to all changes in this revision

Viewing changes to modules/access_output/bonjour.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-09-17 21:56:14 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20080917215614-tj0vx8xzd57e52t8
Tags: 0.9.2-1ubuntu1
* New Upstream Release, exception granted by
    - dktrkranz, norsetto, Hobbsee (via irc). LP: #270404

Changes done in ubuntu:

* add libxul-dev to build-depends
* make sure that vlc is build against libxul in configure. This doesn't
  change anything in the package, but makes it more robust if building
  in an 'unclean' chroot or when modifying the package.
* debian/control: make Vcs-* fields point to the motumedia branch
* add libx264-dev and libass-dev to build-depends
  LP: #210354, #199870
* actually enable libass support by passing --enable-libass to configure
* enable libdca: add libdca-dev to build depends and --enable-libdca
* install the x264 plugin.

Changes already in the pkg-multimedia branch in debian:

* don't install usr/share/vlc/mozilla in debian/mozilla-plugin-vlc.install  
* new upstream .desktop file now registers flash video mimetype LP: #261567
* add Xb-Npp-Applications to mozilla-plugin-vlc
* remove duplicate entries in debian/vlc-nox.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * bonjour.c
3
3
 *****************************************************************************
4
4
 * Copyright (C) 2005 the VideoLAN team
5
 
 * $Id: 1f21a7fe7a6b43000af955b76c37d4d7979570cf $
 
5
 * $Id: 9d37308c0bff8f75483932fabb0ae60bbbda4caa $
6
6
 *
7
7
 * Authors: Jon Lech Johansen <jon@nanocrew.net>
8
8
 *
24
24
/*****************************************************************************
25
25
 * Preamble
26
26
 *****************************************************************************/
27
 
#include <stdlib.h>
28
 
 
29
 
#include <vlc/vlc.h>
 
27
 
 
28
#ifdef HAVE_CONFIG_H
 
29
# include "config.h"
 
30
#endif
 
31
 
 
32
#include <vlc_common.h>
 
33
#include "bonjour.h"
30
34
 
31
35
#ifdef HAVE_AVAHI_CLIENT
32
 
#include <vlc/intf.h>
33
 
#include <vlc/sout.h>
 
36
#include <vlc_sout.h>
34
37
 
35
38
#include <avahi-client/client.h>
36
39
#ifdef HAVE_AVAHI_06
78
81
                                  AvahiEntryGroupState state,
79
82
                                  void *userdata )
80
83
{
 
84
    (void)g;
81
85
    bonjour_t *p_sys = (bonjour_t *)userdata;
82
86
 
83
87
    if( state == AVAHI_ENTRY_GROUP_ESTABLISHED )
178
182
/*****************************************************************************
179
183
 * poll_iterate_thread
180
184
 *****************************************************************************/
181
 
static void poll_iterate_thread( poll_thread_t *p_pt )
 
185
static void* poll_iterate_thread( vlc_object_t *p_this )
182
186
{
 
187
    poll_thread_t *p_pt = (poll_thread_t*)p_this;
183
188
    vlc_thread_ready( p_pt );
184
189
 
185
 
    while( !p_pt->b_die )
 
190
    while( vlc_object_alive (p_pt) )
186
191
        if( avahi_simple_poll_iterate( p_pt->simple_poll, 100 ) != 0 )
187
192
            break;
 
193
 
 
194
    return NULL;
188
195
}
189
196
 
190
197
/*****************************************************************************
191
198
 * bonjour_start_service
192
199
 *****************************************************************************/
193
 
void *bonjour_start_service( vlc_object_t *p_log, char *psz_stype,
194
 
                            char *psz_name, int i_port, char *psz_txt )
 
200
void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
 
201
                             const char *psz_name, int i_port, char *psz_txt )
195
202
{
196
203
    int err;
197
204
    bonjour_t *p_sys;
198
205
 
199
206
    p_sys = (bonjour_t *)malloc( sizeof(*p_sys) );
200
207
    if( p_sys == NULL )
201
 
    {
202
 
        msg_Err( p_log, "out of memory" );
203
208
        return NULL;
204
 
    }
205
209
 
206
210
    memset( p_sys, 0, sizeof(*p_sys) );
207
211
 
211
215
    p_sys->psz_name = avahi_strdup( psz_name );
212
216
    p_sys->psz_stype = avahi_strdup( psz_stype );
213
217
    if( p_sys->psz_name == NULL || p_sys->psz_stype == NULL )
214
 
    {
215
 
        msg_Err( p_sys->p_log, "out of memory" );
216
218
        goto error;
217
 
    }
218
219
 
219
220
    if( psz_txt != NULL )
220
221
    {
221
222
        p_sys->psz_txt = avahi_strdup( psz_txt );
222
223
        if( p_sys->psz_txt == NULL )
223
 
        {
224
 
            msg_Err( p_sys->p_log, "out of memory" );
225
224
            goto error;
226
 
        }
227
225
    }
228
226
 
229
227
    p_sys->simple_poll = avahi_simple_poll_new();
248
246
    p_sys->poll_thread = vlc_object_create( p_sys->p_log,
249
247
                                            sizeof(poll_thread_t) );
250
248
    if( p_sys->poll_thread == NULL )
251
 
    {
252
 
        msg_Err( p_sys->p_log, "out of memory" );
253
249
        goto error;
254
 
    }
255
250
    p_sys->poll_thread->simple_poll = p_sys->simple_poll;
256
251
 
257
252
    if( vlc_thread_create( p_sys->poll_thread, "Avahi Poll Iterate Thread",
258
253
                           poll_iterate_thread,
259
 
                           VLC_THREAD_PRIORITY_HIGHEST, VLC_FALSE ) )
 
254
                           VLC_THREAD_PRIORITY_HIGHEST, false ) )
260
255
    {
261
256
        msg_Err( p_sys->p_log, "failed to create poll iterate thread" );
262
257
        goto error;
266
261
 
267
262
error:
268
263
    if( p_sys->poll_thread != NULL )
269
 
        vlc_object_destroy( p_sys->poll_thread );
 
264
        vlc_object_release( p_sys->poll_thread );
270
265
    if( p_sys->client != NULL )
271
266
        avahi_client_free( p_sys->client );
272
267
    if( p_sys->simple_poll != NULL )
278
273
    if( p_sys->psz_txt != NULL )
279
274
        avahi_free( p_sys->psz_txt );
280
275
 
281
 
    free( (void *)p_sys );
 
276
    free( p_sys );
282
277
 
283
278
    return NULL;
284
279
}
290
285
{
291
286
    bonjour_t *p_sys = (bonjour_t *)_p_sys;
292
287
 
293
 
    if( p_sys->poll_thread->b_thread )
294
 
    {
295
 
        p_sys->poll_thread->b_die = 1;
296
 
        vlc_thread_join( p_sys->poll_thread );
297
 
    }
298
 
 
299
 
    vlc_object_destroy( p_sys->poll_thread );
 
288
    vlc_object_kill( p_sys->poll_thread );
 
289
    vlc_thread_join( p_sys->poll_thread );
 
290
    vlc_object_release( p_sys->poll_thread );
300
291
 
301
292
    if( p_sys->group != NULL )
302
293
        avahi_entry_group_free( p_sys->group );