[vlc-devel] [PATCH 1/2] demux: add control calls to read the demuxer title/seekpoint
Steve Lhomme
robux4 at videolabs.io
Tue Jun 14 08:45:14 CEST 2016
this is necessary to go through (coming) demux filters
--
replaces https://patches.videolan.org/patch/13684/ with more doc
---
include/vlc_demux.h | 23 +++++++++++++++++++++++
src/input/demux.c | 9 +++++++++
2 files changed, 32 insertions(+)
diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index a42998b..7b3b352 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -189,6 +189,29 @@ enum demux_query_e
* arg1= int */
DEMUX_SET_SEEKPOINT, /* arg1= int can fail */
+ /** Check which INPUT_UPDATE_XXX flag is set and reset the ones set.
+ *
+ * The unsigned* argument is set with the flags needed to be checked,
+ * on return it contains the values that were reset during the call
+ *
+ * This can can fail, in which case flags from demux_t.info.i_update
+ * are read/reset
+ *
+ * arg1= unsigned * */
+ DEMUX_TEST_AND_CLEAR_FLAGS, /* arg1= unsigned* can fail */
+ /** Read the title number currently playing
+ *
+ * Can fail, in which case demux_t.info.i_title is used
+ *
+ * arg1= int * */
+ DEMUX_GET_TITLE, /* arg1= int* can fail */
+ /* Read the seekpoint/chapter currently playing
+ *
+ * Can fail, in which case demux_t.info.i_seekpoint is used
+ *
+ * arg1= int * */
+ 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.8.2
More information about the vlc-devel
mailing list