[vlc-commits] shoutcast: convert to stream filter

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


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

shoutcast: convert to stream filter

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

 modules/demux/playlist/playlist.c  |  2 +-
 modules/demux/playlist/shoutcast.c | 35 ++++++++++++++---------------------
 2 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c
index b7029be2b7..bff5e477e2 100644
--- a/modules/demux/playlist/playlist.c
+++ b/modules/demux/playlist/playlist.c
@@ -98,7 +98,7 @@ vlc_module_begin ()
     add_submodule ()
         set_description( N_("New winamp 5.2 shoutcast import") )
         add_shortcut( "shout-winamp" )
-        set_capability( "demux", 0 )
+        set_capability( "stream_filter", 0 )
         set_callbacks( Import_Shoutcast, NULL )
         add_bool( "shoutcast-show-adult", false,
                    SHOW_ADULT_TEXT, SHOW_ADULT_LONGTEXT, false )
diff --git a/modules/demux/playlist/shoutcast.c b/modules/demux/playlist/shoutcast.c
index cef0c8685d..7432cac73c 100644
--- a/modules/demux/playlist/shoutcast.c
+++ b/modules/demux/playlist/shoutcast.c
@@ -31,7 +31,7 @@
 #endif
 
 #include <vlc_common.h>
-#include <vlc_demux.h>
+#include <vlc_access.h>
 
 #include "playlist.h"
 #include <vlc_xml.h>
@@ -45,11 +45,11 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int Demux( demux_t *p_demux);
+static int Demux( stream_t *, input_item_node_t * );
 
-static int DemuxGenre( demux_t *p_demux, xml_reader_t *p_xml_reader,
+static int DemuxGenre( stream_t *p_demux, xml_reader_t *p_xml_reader,
                        input_item_node_t *p_input_node );
-static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
+static int DemuxStation( stream_t *p_demux, xml_reader_t *p_xml_reader,
                          input_item_node_t *p_input_node, bool b_adult );
 
 /*****************************************************************************
@@ -57,26 +57,24 @@ static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
  *****************************************************************************/
 int Import_Shoutcast( 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);
 
-    p_demux->pf_demux = Demux;
-    p_demux->pf_control = Control;
+    p_demux->pf_readdir = Demux;
+    p_demux->pf_control = access_vaDirectoryControlHelper;
     msg_Dbg( p_demux, "using shoutcast playlist reader" );
 
     return VLC_SUCCESS;
 }
 
-static int Demux( demux_t *p_demux )
+static int Demux( stream_t *p_demux, input_item_node_t *p_input_node )
 {
     xml_reader_t *p_xml_reader = NULL;
     const char *node;
-    int i_ret = -1;
-    input_item_t *p_current_input = GetCurrentItem(p_demux);
-    input_item_node_t *p_input_node = NULL;
+    int i_ret = VLC_EGENERIC;
 
-    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;
 
@@ -93,8 +91,6 @@ static int Demux( demux_t *p_demux )
         goto error;
     }
 
-    p_input_node = input_item_node_Create( p_current_input );
-
     if( !strcmp( node, "genrelist" ) )
     {
         /* we're reading a genre list */
@@ -109,10 +105,7 @@ static int Demux( demux_t *p_demux )
             goto error;
     }
 
-    input_item_node_PostAndDelete( p_input_node );
-    p_input_node = NULL;
-
-    i_ret = 0; /* Needed for correct operation of go back */
+    i_ret = VLC_SUCCESS;
 
 error:
     if( p_xml_reader )
@@ -126,7 +119,7 @@ error:
  *   ...
  * </genrelist>
  **/
-static int DemuxGenre( demux_t *p_demux, xml_reader_t *p_xml_reader,
+static int DemuxGenre( stream_t *p_demux, xml_reader_t *p_xml_reader,
                        input_item_node_t *p_input_node )
 {
     const char *node;
@@ -171,7 +164,7 @@ static int DemuxGenre( demux_t *p_demux, xml_reader_t *p_xml_reader,
                         vlc_xml_decode( psz_mrl );
                         p_input = input_item_New( psz_mrl, psz_name );
                         input_item_CopyOptions( p_input, p_input_node->p_item );
-                        input_item_AddOption( p_input, "demux=shout-winamp", VLC_INPUT_OPTION_TRUSTED );
+                        input_item_AddOption( p_input, "stream-filter=shout-winamp", VLC_INPUT_OPTION_TRUSTED );
                         free( psz_mrl );
                         input_item_node_AppendItem( p_input_node, p_input );
                         input_item_Release( p_input );
@@ -211,7 +204,7 @@ static int DemuxGenre( demux_t *p_demux, xml_reader_t *p_xml_reader,
  *            lc="listener count"></station>
  * </stationlist>
  **/
-static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
+static int DemuxStation( stream_t *p_demux, xml_reader_t *p_xml_reader,
                          input_item_node_t *p_input_node, bool b_adult )
 {
     char *psz_base = NULL; /* */



More information about the vlc-commits mailing list