[vlc-devel] [PATCH 03/11] demux: add control calls to read the demuxer title/seekpoint
Steve Lhomme
robux4 at videolabs.io
Mon Jun 6 16:49:59 CEST 2016
this will become handy with the demux filters
---
include/vlc_demux.h | 5 ++++
src/input/demux.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 70 insertions(+), 3 deletions(-)
diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index 5be93b9..8416cad 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -187,6 +187,11 @@ enum demux_query_e
* arg1= int */
DEMUX_SET_SEEKPOINT, /* arg1= int can fail */
+ DEMUX_GET_UPDATE_FLAGS, /* arg1= int* can fail */
+ DEMUX_CLEAR_UPDATE_FLAGS, /* arg1= const int* 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 baf1880..9178928 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -416,6 +416,58 @@ int demux_vaControl( demux_t *demux, int query, va_list args )
}
}
+ switch( query )
+ {
+ case DEMUX_GET_UPDATE_FLAGS:
+ {
+ int ret;
+ va_list ap;
+
+ va_copy( ap, args );
+ ret = demux->pf_control( demux, query, args );
+ if (ret != VLC_SUCCESS)
+ *va_arg( ap, int * ) = demux->info.i_update;
+ va_end( ap );
+ return VLC_SUCCESS;
+ }
+ case DEMUX_CLEAR_UPDATE_FLAGS:
+ {
+ int ret;
+ va_list ap;
+
+ va_copy( ap, args );
+ ret = demux->pf_control( demux, query, args );
+ if (ret != VLC_SUCCESS)
+ demux->info.i_update &= ~(*va_arg( ap, const int * ));
+ va_end( ap );
+ return VLC_SUCCESS;
+ }
+ case DEMUX_GET_TITLE:
+ {
+ int ret;
+ va_list ap;
+
+ va_copy( ap, args );
+ ret = demux->pf_control( demux, query, args );
+ if (ret != VLC_SUCCESS)
+ *va_arg( ap, int * ) = demux->info.i_title;
+ va_end( ap );
+ return VLC_SUCCESS;
+ }
+ case DEMUX_GET_SEEKPOINT:
+ {
+ int ret;
+ va_list ap;
+
+ va_copy( ap, args );
+ ret = demux->pf_control( demux, query, args );
+ if (ret != VLC_SUCCESS)
+ *va_arg( ap, int * ) = demux->info.i_seekpoint;
+ va_end( ap );
+ return VLC_SUCCESS;
+ }
+ }
+
return demux->pf_control( demux, query, args );
}
@@ -658,20 +710,30 @@ static bool SkipAPETag( demux_t *p_demux )
int demux_GetUpdateFlags( demux_t *p_demux )
{
+ int i_update;
+ if ( demux_Control( p_demux, DEMUX_GET_UPDATE_FLAGS, &i_update ) == VLC_SUCCESS )
+ return i_update;
return p_demux->info.i_update;
}
void demux_ResetUpdateFlags( demux_t *p_demux, int i_flags )
{
- p_demux->info.i_update &= ~i_flags;
+ if ( demux_Control( p_demux, DEMUX_CLEAR_UPDATE_FLAGS, &i_flags ) != VLC_SUCCESS )
+ p_demux->info.i_update &= ~i_flags;
}
int demux_GetTitle( demux_t *p_demux )
{
- return p_demux->info.i_title;
+ int i_title;
+ if ( demux_Control( p_demux, DEMUX_GET_TITLE, &i_title ) == VLC_SUCCESS )
+ return i_title;
+ return 0;
}
int demux_GetSeekpoint( demux_t *p_demux )
{
- return p_demux->info.i_seekpoint;
+ int i_seekpoint;
+ if ( demux_Control( p_demux, DEMUX_GET_SEEKPOINT, &i_seekpoint ) == VLC_SUCCESS )
+ return i_seekpoint;
+ return 0;
}
--
2.7.0
More information about the vlc-devel
mailing list