| 36 | | while( psz_parser && *psz_parser ) |
|---|
| | 39 | if( *psz_parser == '\0' ) |
|---|
| | 40 | break; |
|---|
| | 41 | |
|---|
| | 42 | const char *psz_next = strchr( psz_parser, ':' ); |
|---|
| | 43 | if( psz_next == NULL ) |
|---|
| | 44 | psz_next = psz_parser + strlen( psz_parser ); |
|---|
| | 45 | |
|---|
| | 46 | char psz_plugin[psz_next - psz_parser + 1]; |
|---|
| | 47 | memcpy (psz_plugin, psz_parser, sizeof (psz_plugin) - 1); |
|---|
| | 48 | psz_plugin[sizeof (psz_plugin) - 1] = '\0'; |
|---|
| | 49 | psz_parser = psz_next; |
|---|
| | 50 | |
|---|
| | 51 | /* Perform the addition */ |
|---|
| | 52 | msg_Dbg( p_playlist, "Add services_discovery %s", psz_plugin ); |
|---|
| | 53 | services_discovery_t *p_sd = vlc_object_create( p_playlist, |
|---|
| | 54 | VLC_OBJECT_SD ); |
|---|
| | 55 | if( p_sd == NULL ) |
|---|
| | 56 | return VLC_ENOMEM; |
|---|
| | 57 | |
|---|
| | 58 | p_sd->pf_run = NULL; |
|---|
| | 59 | p_sd->p_module = module_Need( p_sd, "services_discovery", psz_plugin, 0 ); |
|---|
| | 60 | |
|---|
| | 61 | if( p_sd->p_module == NULL ) |
|---|
| 44 | | if( *psz_parser == '\0' ) |
|---|
| 45 | | break; |
|---|
| 46 | | msg_Dbg( p_playlist, "Add services_discovery %s", psz_parser ); |
|---|
| 47 | | /* Perform the addition */ |
|---|
| 48 | | { |
|---|
| 49 | | services_discovery_t *p_sd = vlc_object_create( p_playlist, |
|---|
| 50 | | VLC_OBJECT_SD ); |
|---|
| 51 | | p_sd->pf_run = NULL; |
|---|
| 52 | | p_sd->p_module = module_Need( p_sd, "services_discovery", psz_parser, 0 ); |
|---|
| 53 | | |
|---|
| 54 | | if( p_sd->p_module == NULL ) |
|---|
| 55 | | { |
|---|
| 56 | | msg_Err( p_playlist, "no suitable services discovery module" ); |
|---|
| 57 | | vlc_object_destroy( p_sd ); |
|---|
| 58 | | return VLC_EGENERIC; |
|---|
| 59 | | } |
|---|
| 60 | | p_sd->psz_module = strdup( psz_parser ); |
|---|
| 61 | | p_sd->b_die = VLC_FALSE; |
|---|
| 62 | | |
|---|
| 63 | | PL_LOCK; |
|---|
| 64 | | TAB_APPEND( p_playlist->i_sds, p_playlist->pp_sds, p_sd ); |
|---|
| 65 | | PL_UNLOCK; |
|---|
| 66 | | |
|---|
| 67 | | if( !p_sd->pf_run ) { |
|---|
| 68 | | psz_parser = psz_next; |
|---|
| 69 | | continue; |
|---|
| 70 | | } |
|---|
| 71 | | |
|---|
| 72 | | if( vlc_thread_create( p_sd, "services_discovery", RunSD, |
|---|
| 73 | | VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) ) |
|---|
| 74 | | { |
|---|
| 75 | | msg_Err( p_sd, "cannot create services discovery thread" ); |
|---|
| 76 | | vlc_object_destroy( p_sd ); |
|---|
| 77 | | return VLC_EGENERIC; |
|---|
| 78 | | } |
|---|
| 79 | | } |
|---|
| 80 | | psz_parser = psz_next; |
|---|
| | 75 | if ((p_sd->pf_run != NULL) |
|---|
| | 76 | && vlc_thread_create( p_sd, "services_discovery", RunSD, |
|---|
| | 77 | VLC_THREAD_PRIORITY_LOW, VLC_FALSE)) |
|---|
| | 78 | { |
|---|
| | 79 | msg_Err( p_sd, "cannot create services discovery thread" ); |
|---|
| | 80 | vlc_object_destroy( p_sd ); |
|---|
| | 81 | retval = VLC_EGENERIC; |
|---|
| | 82 | continue; |
|---|