[vlc-devel] [PATCH 1/2] demux: add control calls to read the demuxer title/seekpoint

Steve Lhomme robux4 at videolabs.io
Sun Jun 12 08:21:59 CEST 2016


this will become handy with the demux filters
---
 include/vlc_demux.h | 4 ++++
 src/input/demux.c   | 9 +++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index a42998b..33f7df3 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -189,6 +189,10 @@ enum demux_query_e
      * arg1= int */
     DEMUX_SET_SEEKPOINT,        /* arg1= int            can fail */
 
+    DEMUX_TEST_AND_CLEAR_FLAGS, /* arg1= unsigned*      can fail */
+    DEMUX_GET_TITLE,            /* arg1= int*           can fail */
+    DEMUX_GET_SEEKPOINT,        /* arg1= int*           can fail */
+
     /* I. Common queries to access_demux and demux */
     /* POSITION double between 0.0 and 1.0 */
     DEMUX_GET_POSITION = 0x300, /* arg1= double *       res=    */
diff --git a/src/input/demux.c b/src/input/demux.c
index b159526..9d962f5 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -659,6 +659,9 @@ static bool SkipAPETag( demux_t *p_demux )
 
 unsigned demux_TestAndClearFlags( demux_t *p_demux, unsigned flags )
 {
+    unsigned i_update;
+    if ( demux_Control( p_demux, DEMUX_TEST_AND_CLEAR_FLAGS, &i_update ) == VLC_SUCCESS )
+        return i_update;
     unsigned ret = p_demux->info.i_update & flags;
     p_demux->info.i_update &= ~flags;
     return ret;
@@ -666,10 +669,16 @@ unsigned demux_TestAndClearFlags( demux_t *p_demux, unsigned flags )
 
 int demux_GetTitle( demux_t *p_demux )
 {
+    int i_title;
+    if ( demux_Control( p_demux, DEMUX_GET_TITLE, &i_title ) == VLC_SUCCESS )
+        return i_title;
     return p_demux->info.i_title;
 }
 
 int demux_GetSeekpoint( demux_t *p_demux )
 {
+    int i_seekpoint;
+    if ( demux_Control( p_demux, DEMUX_GET_SEEKPOINT, &i_seekpoint ) == VLC_SUCCESS  )
+        return i_seekpoint;
     return p_demux->info.i_seekpoint;
 }
-- 
2.7.0



More information about the vlc-devel mailing list