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 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_services_discovery.h>
#include <vlc_playlist.h>
#include <vlc_network.h>
#include <assert.h>
......@@ -120,10 +119,11 @@ static void SaveUrls( services_discovery_t *p_sd );
*****************************************************************************/
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_sys_t *p_sys = malloc(
sizeof( services_discovery_sys_t ) );
services_discovery_sys_t *p_sys = malloc( sizeof( *p_sys ) );
if( !p_sys )
return VLC_ENOMEM;
......@@ -143,6 +143,7 @@ static int Open( vlc_object_t *p_this )
p_sd->p_sys = p_sys;
/* 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_AddCallback( pl, "podcast-urls", UrlsChange, p_sys );
......@@ -168,7 +169,7 @@ static void Close( vlc_object_t *p_this )
{
services_discovery_t *p_sd = ( services_discovery_t* )p_this;
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;
vlc_cancel (p_sys->thread);
......@@ -220,8 +221,8 @@ static void *Run( void *data )
if( p_sys->update_type == UPDATE_URLS )
{
playlist_t *pl = pl_Get( p_sd );
char* psz_urls = var_GetNonEmptyString( pl, "podcast-urls" );
char *psz_urls = var_GetNonEmptyString( p_sd->p_parent,
"podcast-urls" );
ParseUrls( p_sd, psz_urls );
free( psz_urls );
}
......@@ -372,8 +373,8 @@ static void ParseRequest( services_discovery_t *p_sd )
if ( ! p_sys->b_savedurls_loaded )
{
playlist_t *pl = pl_Get( p_sd );
char* psz_urls = var_GetNonEmptyString( pl, "podcast-urls" );
char *psz_urls = var_GetNonEmptyString( p_sd->p_parent,
"podcast-urls" );
ParseUrls( p_sd, 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