[vlc-commits] podcast: convert to stream filter

Rémi Denis-Courmont git at videolan.org
Sat Jun 3 22:02:32 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May 22 20:42:37 2017 +0300| [e25666f71690034d2bc89f3e762b91f3e97a6dc8] | committer: Rémi Denis-Courmont

podcast: convert to stream filter

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

 modules/demux/playlist/playlist.c |  4 ++--
 modules/demux/playlist/podcast.c  | 26 ++++++++++----------------
 src/input/demux.c                 |  1 -
 3 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c
index 51fc0deed4..dfa76b4407 100644
--- a/modules/demux/playlist/playlist.c
+++ b/modules/demux/playlist/playlist.c
@@ -88,8 +88,8 @@ vlc_module_begin ()
         set_callbacks( Import_DVB, NULL )
     add_submodule ()
         set_description( N_("Podcast parser") )
-        add_shortcut( "playlist", "podcast" )
-        set_capability( "demux", 10 )
+        add_shortcut( "podcast" )
+        set_capability( "stream_filter", 10 )
         set_callbacks( Import_podcast, NULL )
     add_submodule ()
         set_description( N_("XSPF playlist import") )
diff --git a/modules/demux/playlist/podcast.c b/modules/demux/playlist/podcast.c
index d1e588a143..8c47d5ab6f 100644
--- a/modules/demux/playlist/podcast.c
+++ b/modules/demux/playlist/podcast.c
@@ -29,7 +29,7 @@
 #endif
 
 #include <vlc_common.h>
-#include <vlc_demux.h>
+#include <vlc_access.h>
 
 #include "playlist.h"
 #include <vlc_xml.h>
@@ -38,7 +38,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int Demux( demux_t *p_demux);
+static int ReadDir( stream_t *, input_item_node_t * );
 static mtime_t strTimeToMTime( const char *psz );
 
 /*****************************************************************************
@@ -46,21 +46,21 @@ static mtime_t strTimeToMTime( const char *psz );
  *****************************************************************************/
 int Import_podcast( vlc_object_t *p_this )
 {
-    demux_t *p_demux = (demux_t *)p_this;
+    stream_t *p_demux = (stream_t *)p_this;
 
     CHECK_FILE(p_demux);
-    if( !demux_IsForced( p_demux, "podcast" ) )
+    if( !stream_IsMimeType( p_demux->p_source, "application/rss+xml" ) )
         return VLC_EGENERIC;
 
-    p_demux->pf_demux = Demux;
-    p_demux->pf_control = Control;
+    p_demux->pf_readdir = ReadDir;
+    p_demux->pf_control = access_vaDirectoryControlHelper;
     msg_Dbg( p_demux, "using podcast reader" );
 
     return VLC_SUCCESS;
 }
 
 /* "specs" : http://phobos.apple.com/static/iTunesRSS.html */
-static int Demux( demux_t *p_demux )
+static int ReadDir( stream_t *p_demux, input_item_node_t *p_subitems )
 {
     bool b_item = false;
     bool b_image = false;
@@ -82,11 +82,10 @@ static int Demux( demux_t *p_demux )
     const char *node;
     int i_type;
     input_item_t *p_input;
-    input_item_node_t *p_subitems = NULL;
 
     input_item_t *p_current_input = GetCurrentItem(p_demux);
 
-    p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s );
+    p_xml_reader = xml_ReaderCreate( p_demux, p_demux->p_source );
     if( !p_xml_reader )
         goto error;
 
@@ -104,8 +103,6 @@ static int Demux( demux_t *p_demux )
         goto error;
     }
 
-    p_subitems = input_item_node_Create( p_current_input );
-
     while( (i_type = xml_ReaderNextNode( p_xml_reader, &node )) > 0 )
     {
         switch( i_type )
@@ -318,8 +315,7 @@ static int Demux( demux_t *p_demux )
     free( psz_elname );
     xml_ReaderDelete( p_xml_reader );
 
-    input_item_node_PostAndDelete( p_subitems );
-    return 0; /* Needed for correct operation of go back */
+    return VLC_SUCCESS;
 
 error:
     free( psz_item_name );
@@ -338,10 +334,8 @@ error:
 
     if( p_xml_reader )
         xml_ReaderDelete( p_xml_reader );
-    if( p_subitems )
-        input_item_node_Delete( p_subitems );
 
-    return -1;
+    return VLC_EGENERIC;
 }
 
 static mtime_t strTimeToMTime( const char *psz )
diff --git a/src/input/demux.c b/src/input/demux.c
index 006b426436..0ccc2dcc8d 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -65,7 +65,6 @@ static const char *demux_NameFromMimeType(const char *mime)
         { "audio/aac",           "m4a"     },
         { "audio/aacp",          "m4a"     },
         { "audio/mpeg",          "mp3"     },
-        { "application/rss+xml", "podcast" },
         //{ "video/MP1S",          "es,mpgv" }, !b_force
         { "video/dv",            "rawdv"   },
         { "video/MP2P",          "ps"      },



More information about the vlc-commits mailing list