[vlc-commits] b4s: convert to stream filter

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


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

b4s: convert to stream filter

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

 modules/demux/playlist/b4s.c      | 25 +++++++++----------------
 modules/demux/playlist/playlist.c |  4 ++--
 2 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/modules/demux/playlist/b4s.c b/modules/demux/playlist/b4s.c
index af1451f9e7..dd886463e5 100644
--- a/modules/demux/playlist/b4s.c
+++ b/modules/demux/playlist/b4s.c
@@ -30,7 +30,7 @@
 #endif
 
 #include <vlc_common.h>
-#include <vlc_demux.h>
+#include <vlc_access.h>
 #include <vlc_xml.h>
 #include <vlc_strings.h>
 
@@ -39,7 +39,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int Demux( demux_t *p_demux);
+static int ReadDir( stream_t *, input_item_node_t *);
 static bool IsWhitespace( const char *psz_string );
 
 /*****************************************************************************
@@ -47,20 +47,19 @@ static bool IsWhitespace( const char *psz_string );
  *****************************************************************************/
 int Import_B4S( vlc_object_t *p_this )
 {
-    demux_t *demux = (demux_t *)p_this;
+    stream_t *demux = (stream_t *)p_this;
 
     CHECK_FILE(demux);
-    if( !demux_IsPathExtension( demux, ".b4s" )
-     && !demux_IsForced( demux, "b4s-open" ) )
+    if( !stream_HasExtension( demux, ".b4s" ) )
         return VLC_EGENERIC;
 
-    demux->pf_demux = Demux;
-    demux->pf_control = Control;
+    demux->pf_readdir = ReadDir;
+    demux->pf_control = access_vaDirectoryControlHelper;
 
     return VLC_SUCCESS;
 }
 
-static int Demux( demux_t *p_demux )
+static int ReadDir( stream_t *p_demux, input_item_node_t *p_subitems )
 {
     int i_ret = -1;
 
@@ -70,13 +69,12 @@ static int Demux( demux_t *p_demux )
     input_item_t *p_input;
     char *psz_mrl = NULL, *psz_title = NULL, *psz_genre = NULL;
     char *psz_now = NULL, *psz_listeners = NULL, *psz_bitrate = NULL;
-    input_item_node_t *p_subitems = NULL;
 
     input_item_t *p_current_input = GetCurrentItem(p_demux);
 
-    free( vlc_stream_ReadLine( p_demux->s ) );
+    free( vlc_stream_ReadLine( p_demux->p_source ) );
 
-    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 )
         return -1;
 
@@ -124,8 +122,6 @@ static int Demux( demux_t *p_demux )
                       " <playlist>", attr, value );
     }
 
-    p_subitems = input_item_node_Create( p_current_input );
-
     while( (i_ret = xml_ReaderNextNode( p_xml_reader, &node )) > 0 )
     {
         // Get the node type
@@ -227,9 +223,6 @@ static int Demux( demux_t *p_demux )
 end:
     free( psz_elname );
 
-    if( p_subitems )
-        input_item_node_PostAndDelete( p_subitems );
-
     if( p_xml_reader )
         xml_ReaderDelete( p_xml_reader );
     return i_ret;
diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c
index b8efb13dfb..aeb1e302d8 100644
--- a/modules/demux/playlist/playlist.c
+++ b/modules/demux/playlist/playlist.c
@@ -79,8 +79,8 @@ vlc_module_begin ()
         set_callbacks( Import_PLS, NULL )
     add_submodule ()
         set_description( N_("B4S playlist import") )
-        add_shortcut( "playlist", "b4s-open", "shout-b4s" )
-        set_capability( "demux", 10 )
+        add_shortcut( "shout-b4s" )
+        set_capability( "stream_filter", 10 )
         set_callbacks( Import_B4S, NULL )
     add_submodule ()
         set_description( N_("DVB playlist import") )



More information about the vlc-commits mailing list