Commit 4e684f13 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

podcast: fail safe if running in LibVLC (i.e. without playlist)

parent 0476906e
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_services_discovery.h> #include <vlc_services_discovery.h>
#include <vlc_playlist.h>
#include <vlc_network.h> #include <vlc_network.h>
#include <assert.h> #include <assert.h>
...@@ -120,10 +119,11 @@ static void SaveUrls( services_discovery_t *p_sd ); ...@@ -120,10 +119,11 @@ static void SaveUrls( services_discovery_t *p_sd );
*****************************************************************************/ *****************************************************************************/
static int Open( vlc_object_t *p_this ) static int Open( vlc_object_t *p_this )
{ {
playlist_t *pl = pl_Get( p_this ); if( strcmp( p_this->p_parent->psz_object_type, "playlist" ) )
return VLC_EGENERIC; /* FIXME: support LibVLC SD too! */
services_discovery_t *p_sd = ( services_discovery_t* )p_this; services_discovery_t *p_sd = ( services_discovery_t* )p_this;
services_discovery_sys_t *p_sys = malloc( services_discovery_sys_t *p_sys = malloc( sizeof( *p_sys ) );
sizeof( services_discovery_sys_t ) );
if( !p_sys ) if( !p_sys )
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -143,6 +143,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -143,6 +143,7 @@ static int Open( vlc_object_t *p_this )
p_sd->p_sys = p_sys; p_sd->p_sys = p_sys;
/* Launch the callback associated with this variable */ /* Launch the callback associated with this variable */
vlc_object_t *pl = p_sd->p_parent;
var_Create( pl, "podcast-urls", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( pl, "podcast-urls", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_AddCallback( pl, "podcast-urls", UrlsChange, p_sys ); var_AddCallback( pl, "podcast-urls", UrlsChange, p_sys );
...@@ -167,8 +168,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -167,8 +168,8 @@ static int Open( vlc_object_t *p_this )
static void Close( vlc_object_t *p_this ) static void Close( vlc_object_t *p_this )
{ {
services_discovery_t *p_sd = ( services_discovery_t* )p_this; services_discovery_t *p_sd = ( services_discovery_t* )p_this;
services_discovery_sys_t *p_sys = p_sd->p_sys; services_discovery_sys_t *p_sys = p_sd->p_sys;
playlist_t *pl = pl_Get( p_this ); vlc_object_t *pl = p_sd->p_parent;
int i; int i;
vlc_cancel (p_sys->thread); vlc_cancel (p_sys->thread);
...@@ -220,8 +221,8 @@ static void *Run( void *data ) ...@@ -220,8 +221,8 @@ static void *Run( void *data )
if( p_sys->update_type == UPDATE_URLS ) if( p_sys->update_type == UPDATE_URLS )
{ {
playlist_t *pl = pl_Get( p_sd ); char *psz_urls = var_GetNonEmptyString( p_sd->p_parent,
char* psz_urls = var_GetNonEmptyString( pl, "podcast-urls" ); "podcast-urls" );
ParseUrls( p_sd, psz_urls ); ParseUrls( p_sd, psz_urls );
free( psz_urls ); free( psz_urls );
} }
...@@ -372,8 +373,8 @@ static void ParseRequest( services_discovery_t *p_sd ) ...@@ -372,8 +373,8 @@ static void ParseRequest( services_discovery_t *p_sd )
if ( ! p_sys->b_savedurls_loaded ) if ( ! p_sys->b_savedurls_loaded )
{ {
playlist_t *pl = pl_Get( p_sd ); char *psz_urls = var_GetNonEmptyString( p_sd->p_parent,
char* psz_urls = var_GetNonEmptyString( pl, "podcast-urls" ); "podcast-urls" );
ParseUrls( p_sd, psz_urls ); ParseUrls( p_sd, psz_urls );
free( psz_urls ); free( psz_urls );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment