[vlc-commits] expose demux_New

Francois Cartegnie git at videolan.org
Tue Oct 6 12:25:49 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Sep 25 13:24:42 2015 +0200| [eacbb34ff971e5f3acf90b96f5199e28d22b0d3a] | committer: Francois Cartegnie

expose demux_New

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

 include/vlc_demux.h      |   46 +++++++++++++++++++++++++++++++++++++++++-----
 src/input/demux.c        |   23 ++++++++++++++++++-----
 src/input/demux.h        |   31 ++++---------------------------
 src/input/input.c        |   10 +++++-----
 src/input/stream_demux.c |    4 ++--
 src/libvlccore.sym       |    2 ++
 6 files changed, 72 insertions(+), 44 deletions(-)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index e0b4c49..0810f08 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -183,7 +183,47 @@ enum demux_query_e
     DEMUX_NAV_RIGHT,           /* res=can fail */
 };
 
-VLC_API int demux_vaControlHelper( stream_t *, int64_t i_start, int64_t i_end, int64_t i_bitrate, int i_align, int i_query, va_list args );
+/*************************************************************************
+ * Main Demux
+ *************************************************************************/
+
+/* stream_t *s could be null and then it mean a access+demux in one */
+VLC_API demux_t *demux_New( vlc_object_t *p_obj, const char *psz_name,
+                            const char *psz_path, stream_t *s, es_out_t *out );
+
+VLC_API void demux_Delete( demux_t * );
+
+
+VLC_API int demux_vaControlHelper( stream_t *, int64_t i_start, int64_t i_end,
+                                   int64_t i_bitrate, int i_align, int i_query, va_list args );
+
+VLC_USED static inline int demux_Demux( demux_t *p_demux )
+{
+    if( !p_demux->pf_demux )
+        return 1;
+
+    return p_demux->pf_demux( p_demux );
+}
+
+static inline int demux_vaControl( demux_t *p_demux, int i_query, va_list args )
+{
+    return p_demux->pf_control( p_demux, i_query, args );
+}
+
+static inline int demux_Control( demux_t *p_demux, int i_query, ... )
+{
+    va_list args;
+    int     i_result;
+
+    va_start( args, i_query );
+    i_result = demux_vaControl( p_demux, i_query, args );
+    va_end( args );
+    return i_result;
+}
+
+/*************************************************************************
+ * Miscellaneous helpers for demuxers
+ *************************************************************************/
 
 static inline void demux_UpdateTitleFromStream( demux_t *demux )
 {
@@ -205,10 +245,6 @@ static inline void demux_UpdateTitleFromStream( demux_t *demux )
     }
 }
 
-/*************************************************************************
- * Miscellaneous helpers for demuxers
- *************************************************************************/
-
 VLC_USED
 static inline bool demux_IsPathExtension( demux_t *p_demux, const char *psz_extension )
 {
diff --git a/src/input/demux.c b/src/input/demux.c
index 91f1742..189bdca 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -72,15 +72,28 @@ static const char *demux_FromContentType(const char *mime)
     return (type != NULL) ? type->demux : "any";
 }
 
-#undef demux_New
 /*****************************************************************************
  * demux_New:
  *  if s is NULL then load a access_demux
  *****************************************************************************/
-demux_t *demux_New( vlc_object_t *p_obj, input_thread_t *p_parent_input,
-                    const char *psz_access, const char *psz_demux,
-                    const char *psz_location,
-                    stream_t *s, es_out_t *out, bool b_quick )
+demux_t *demux_New( vlc_object_t *p_obj, const char *psz_name,
+                    const char *psz_location, stream_t *s, es_out_t *out )
+{
+    return demux_NewAdvanced( p_obj, NULL,
+                              (s == NULL) ? psz_name : "",
+                              (s != NULL) ? psz_name : "",
+                              psz_location, s, out, false );
+}
+
+/*****************************************************************************
+ * demux_NewAdvanced:
+ *  if s is NULL then load a access_demux
+ *****************************************************************************/
+#undef demux_NewAdvanced
+demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_parent_input,
+                            const char *psz_access, const char *psz_demux,
+                            const char *psz_location,
+                            stream_t *s, es_out_t *out, bool b_quick )
 {
     demux_t *p_demux = vlc_custom_create( p_obj, sizeof( *p_demux ), "demux" );
     if( unlikely(p_demux == NULL) )
diff --git a/src/input/demux.h b/src/input/demux.h
index 3372f17..368d468 100644
--- a/src/input/demux.h
+++ b/src/input/demux.h
@@ -31,31 +31,8 @@
 #include "stream.h"
 
 /* stream_t *s could be null and then it mean a access+demux in one */
-demux_t *demux_New( vlc_object_t *p_obj, input_thread_t *p_parent_input, const char *psz_access, const char *psz_demux, const char *psz_path, stream_t *s, es_out_t *out, bool );
-#define demux_New( a, b, c, d, e, f, g, h ) demux_New(VLC_OBJECT(a),b,c,d,e,f,g,h)
-
-void demux_Delete( demux_t * );
-
-static inline int demux_Demux( demux_t *p_demux )
-{
-    if( !p_demux->pf_demux )
-        return 1;
-
-    return p_demux->pf_demux( p_demux );
-}
-static inline int demux_vaControl( demux_t *p_demux, int i_query, va_list args )
-{
-    return p_demux->pf_control( p_demux, i_query, args );
-}
-static inline int demux_Control( demux_t *p_demux, int i_query, ... )
-{
-    va_list args;
-    int     i_result;
-
-    va_start( args, i_query );
-    i_result = demux_vaControl( p_demux, i_query, args );
-    va_end( args );
-    return i_result;
-}
-
+demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_parent_input,
+                            const char *psz_access, const char *psz_demux,
+                            const char *psz_path, stream_t *s, es_out_t *out, bool );
+#define demux_NewAdvanced( a, b, c, d, e, f, g, h ) demux_NewAdvanced(VLC_OBJECT(a),b,c,d,e,f,g,h)
 #endif
diff --git a/src/input/input.c b/src/input/input.c
index 6b40a45..42aa157 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2169,8 +2169,8 @@ static int InputSourceInit( input_thread_t *p_input,
         }
 
         /* Try access_demux first */
-        in->p_demux = demux_New( p_input, p_input, psz_access, psz_demux,
-                                 psz_path, NULL, p_input->p->p_es_out, false );
+        in->p_demux = demux_NewAdvanced( p_input, p_input, psz_access, psz_demux,
+                                         psz_path, NULL, p_input->p->p_es_out, false );
     }
     else
     {
@@ -2341,9 +2341,9 @@ static int InputSourceInit( input_thread_t *p_input,
         if( psz_path == NULL )
             psz_path = "";
 
-        in->p_demux = demux_New( p_input, p_input, psz_access, psz_demux,
-                                 psz_path, p_stream, p_input->p->p_es_out,
-                                 p_input->b_preparsing );
+        in->p_demux = demux_NewAdvanced( p_input, p_input, psz_access, psz_demux,
+                                         psz_path, p_stream, p_input->p->p_es_out,
+                                         p_input->b_preparsing );
 
         if( in->p_demux == NULL )
         {
diff --git a/src/input/stream_demux.c b/src/input/stream_demux.c
index e25814c..76ca3e3 100644
--- a/src/input/stream_demux.c
+++ b/src/input/stream_demux.c
@@ -248,8 +248,8 @@ static void* DStreamThread( void *obj )
     demux_t *p_demux;
 
     /* Create the demuxer */
-    p_demux = demux_New( s, s->p_input, "", p_sys->psz_name, "", s, p_sys->out,
-                         false );
+    p_demux = demux_NewAdvanced( s, s->p_input, "", p_sys->psz_name, "",
+                                 s, p_sys->out, false );
     if( p_demux == NULL )
         return NULL;
 
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index a93ed58..31361c5 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -88,8 +88,10 @@ decoder_SynchroReset
 decoder_SynchroTrash
 decode_URI
 decode_URI_duplicate
+demux_Delete
 demux_PacketizerDestroy
 demux_PacketizerNew
+demux_New
 demux_vaControlHelper
 dialog_ExtensionUpdate
 dialog_Login



More information about the vlc-commits mailing list