[vlc-commits] mpeg: provide test-and-clear-flags control
Rémi Denis-Courmont
git at videolan.org
Sun Jan 28 15:18:35 CET 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Dec 17 21:44:23 2017 +0200| [0a8a30e8dbcce6176d0263d10902e70282656d63] | committer: Rémi Denis-Courmont
mpeg: provide test-and-clear-flags control
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0a8a30e8dbcce6176d0263d10902e70282656d63
---
include/vlc_demux.h | 10 ++++++----
modules/demux/mpeg/ps.c | 10 ++++++++++
modules/demux/mpeg/ts.c | 8 ++++++++
modules/demux/mpeg/ts.h | 1 +
modules/demux/mpeg/ts_si.c | 2 +-
5 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index b27703e480..e49d4a54a3 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -370,7 +370,8 @@ static inline int demux_Control( demux_t *p_demux, int i_query, ... )
#ifndef __cplusplus
static inline void demux_UpdateTitleFromStream( demux_t *demux,
- int *restrict titlep, int *restrict seekpointp )
+ int *restrict titlep, int *restrict seekpointp,
+ unsigned *restrict updatep )
{
stream_t *s = demux->s;
unsigned title, seekpoint;
@@ -379,7 +380,7 @@ static inline void demux_UpdateTitleFromStream( demux_t *demux,
&& title != (unsigned)*titlep )
{
*titlep = title;
- demux->info.i_update |= INPUT_UPDATE_TITLE;
+ *updatep |= INPUT_UPDATE_TITLE;
}
if( vlc_stream_Control( s, STREAM_GET_SEEKPOINT,
@@ -387,13 +388,14 @@ static inline void demux_UpdateTitleFromStream( demux_t *demux,
&& seekpoint != (unsigned)*seekpointp )
{
*seekpointp = seekpoint;
- demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
+ *updatep |= INPUT_UPDATE_SEEKPOINT;
}
}
# define demux_UpdateTitleFromStream(demux) \
demux_UpdateTitleFromStream(demux, \
&((demux_sys_t *)((demux)->p_sys))->current_title, \
- &((demux_sys_t *)((demux)->p_sys))->current_seekpoint)
+ &((demux_sys_t *)((demux)->p_sys))->current_seekpoint, \
+ &((demux_sys_t *)((demux)->p_sys))->updates)
#endif
VLC_USED
diff --git a/modules/demux/mpeg/ps.c b/modules/demux/mpeg/ps.c
index f94c96e626..6a18e43bd6 100644
--- a/modules/demux/mpeg/ps.c
+++ b/modules/demux/mpeg/ps.c
@@ -113,6 +113,7 @@ struct demux_sys_t
int current_title;
int current_seekpoint;
+ unsigned updates;
};
static int Demux ( demux_t *p_demux );
@@ -228,6 +229,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_force )
p_sys->format = format;
p_sys->current_title = 0;
p_sys->current_seekpoint = 0;
+ p_sys->updates = 0;
vlc_stream_Control( p_demux->s, STREAM_CAN_SEEK, &p_sys->b_seekable );
@@ -781,6 +783,14 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
return vlc_stream_vaControl( p_demux->s, STREAM_SET_SEEKPOINT,
args );
+ case DEMUX_TEST_AND_CLEAR_FLAGS:
+ {
+ unsigned *restrict flags = va_arg(args, unsigned *);
+ *flags &= p_sys->updates;
+ p_sys->updates = ~*flags;
+ return VLC_SUCCESS;
+ }
+
case DEMUX_GET_META:
return vlc_stream_vaControl( p_demux->s, STREAM_GET_META, args );
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index f1291d5d18..5dd741ae33 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -1131,6 +1131,14 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
return vlc_stream_vaControl( p_sys->stream, STREAM_SET_SEEKPOINT,
args );
+ case DEMUX_TEST_AND_CLEAR_FLAGS:
+ {
+ unsigned *restrict flags = va_arg(args, unsigned *);
+ *flags &= p_sys->updates;
+ p_sys->updates = ~*flags;
+ return VLC_SUCCESS;
+ }
+
case DEMUX_GET_META:
return vlc_stream_vaControl( p_sys->stream, STREAM_GET_META, args );
diff --git a/modules/demux/mpeg/ts.h b/modules/demux/mpeg/ts.h
index 9f98aba936..389bf465e3 100644
--- a/modules/demux/mpeg/ts.h
+++ b/modules/demux/mpeg/ts.h
@@ -51,6 +51,7 @@ struct demux_sys_t
bool b_canfastseek;
int current_title;
int current_seekpoint;
+ unsigned updates;
vlc_mutex_t csa_lock;
/* TS packet size (188, 192, 204) */
diff --git a/modules/demux/mpeg/ts_si.c b/modules/demux/mpeg/ts_si.c
index 0bc6357913..aa06176839 100644
--- a/modules/demux/mpeg/ts_si.c
+++ b/modules/demux/mpeg/ts_si.c
@@ -743,7 +743,7 @@ static void ARIB_CDT_RawCallback( dvbpsi_t *p_handle, const dvbpsi_psi_section_t
if( p_att )
{
vlc_dictionary_insert( &p_sys->attachments, psz_name, p_att );
- p_demux->info.i_update |= INPUT_UPDATE_META;
+ p_sys->updates |= INPUT_UPDATE_META;
}
free( p_png );
}
More information about the vlc-commits
mailing list