Commit 0a8a30e8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

mpeg: provide test-and-clear-flags control

parent eed411b0
......@@ -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
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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) */
......
......@@ -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 );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment