[vlc-commits] dvb: convert to stream filter

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


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

dvb: convert to stream filter

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

 NEWS                              |  2 ++
 modules/demux/playlist/dvb.c      | 24 ++++++++++--------------
 modules/demux/playlist/playlist.c |  4 ++--
 3 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/NEWS b/NEWS
index e4fa417594..5c966e00d9 100644
--- a/NEWS
+++ b/NEWS
@@ -125,6 +125,8 @@ Demuxers:
  * Fix Quicktime Mp4 inside MKV and unpacketized VC1
  * Support for isofLaC
  * Improved fLaC seeking
+ * Replaced --demux dvb-open option with --stream-filter dvb to parse
+   channels.conf digital TV channel list files
 
 Stream filter:
  * Added ADF stream filter
diff --git a/modules/demux/playlist/dvb.c b/modules/demux/playlist/dvb.c
index 7a11a724b3..12d9873009 100644
--- a/modules/demux/playlist/dvb.c
+++ b/modules/demux/playlist/dvb.c
@@ -33,26 +33,26 @@
 #include <assert.h>
 
 #include <vlc_common.h>
-#include <vlc_demux.h>
+#include <vlc_access.h>
 #include <vlc_charset.h>
 
 #include "playlist.h"
 
-static int Demux(demux_t *);
+static int ReadDir(stream_t *, input_item_node_t *);
 static input_item_t *ParseLine(char *line);
 
 /** Detect dvb-utils zap channels.conf format */
 int Import_DVB(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, ".conf" ) && !demux->obj.force )
+    if (!stream_HasExtension(demux, ".conf" ) && !demux->obj.force )
         return VLC_EGENERIC;
 
     /* Check if this really is a channels file */
     const uint8_t *peek;
-    int len = vlc_stream_Peek(demux->s, &peek, 1023);
+    int len = vlc_stream_Peek(demux->p_source, &peek, 1023);
     if (len <= 0)
         return VLC_EGENERIC;
 
@@ -71,20 +71,18 @@ int Import_DVB(vlc_object_t *p_this)
     input_item_Release(item);
 
     msg_Dbg(demux, "found valid channels.conf file");
-    demux->pf_control = Control;
-    demux->pf_demux = Demux;
+    demux->pf_control = access_vaDirectoryControlHelper;
+    demux->pf_readdir = ReadDir;
 
     return VLC_SUCCESS;
 }
 
 /** Parses the whole channels.conf file */
-static int Demux(demux_t *demux)
+static int ReadDir(stream_t *s, input_item_node_t *subitems)
 {
-    input_item_t *input = GetCurrentItem(demux);
-    input_item_node_t *subitems = input_item_node_Create(input);
     char *line;
 
-    while ((line = vlc_stream_ReadLine(demux->s)) != NULL)
+    while ((line = vlc_stream_ReadLine(s->p_source)) != NULL)
     {
         input_item_t *item = ParseLine(line);
         free(line);
@@ -95,9 +93,7 @@ static int Demux(demux_t *demux)
         input_item_Release(item);
     }
 
-    input_item_node_PostAndDelete(subitems);
-
-    return 0; /* Needed for correct operation of go back */
+    return VLC_SUCCESS;
 }
 
 static int cmp(const void *k, const void *e)
diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c
index c3a46ada8f..4d38c61bc6 100644
--- a/modules/demux/playlist/playlist.c
+++ b/modules/demux/playlist/playlist.c
@@ -84,8 +84,8 @@ vlc_module_begin ()
         set_callbacks( Import_B4S, NULL )
     add_submodule ()
         set_description( N_("DVB playlist import") )
-        add_shortcut( "playlist", "dvb-open" )
-        set_capability( "demux", 10 )
+        add_shortcut( "dvb" )
+        set_capability( "stream_filter", 10 )
         set_callbacks( Import_DVB, NULL )
     add_submodule ()
         set_description( N_("Podcast parser") )



More information about the vlc-commits mailing list