[vlc-commits] podcast: fail safe if running in LibVLC (i.e. without playlist)

Rémi Denis-Courmont git at videolan.org
Thu Jan 2 23:32:01 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jan  3 00:01:15 2014 +0200| [4e684f13c0237de4b9112c6426472ff8df46c358] | committer: Rémi Denis-Courmont

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4e684f13c0237de4b9112c6426472ff8df46c358
---

 modules/services_discovery/podcast.c |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c
index 3f4f5d2..d3064f2 100644
--- a/modules/services_discovery/podcast.c
+++ b/modules/services_discovery/podcast.c
@@ -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 );
 
@@ -167,8 +168,8 @@ static int Open( 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_sys_t *p_sys  = p_sd->p_sys;
-    playlist_t *pl = pl_Get( p_this );
+    services_discovery_sys_t *p_sys = p_sd->p_sys;
+    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 );
     }



More information about the vlc-commits mailing list