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

demux: merge GetUpdateFlags() and ResetUpdateFlags()

parent 8a052fe3
......@@ -657,14 +657,11 @@ static bool SkipAPETag( demux_t *p_demux )
return true;
}
int demux_GetUpdateFlags( demux_t *p_demux )
unsigned demux_TestAndClearFlags( demux_t *p_demux, unsigned flags )
{
return p_demux->info.i_update;
}
void demux_ResetUpdateFlags( demux_t *p_demux, int i_flags )
{
p_demux->info.i_update &= ~i_flags;
unsigned ret = p_demux->info.i_update & flags;
p_demux->info.i_update &= ~flags;
return ret;
}
int demux_GetTitle( demux_t *p_demux )
......
......@@ -40,8 +40,7 @@ demux_t *input_DemuxNew( vlc_object_t *, const char *access, const char *demux,
const char *path, es_out_t *out, bool quick,
input_thread_t * );
int demux_GetUpdateFlags( demux_t * );
void demux_ResetUpdateFlags( demux_t *, int );
unsigned demux_TestAndClearFlags( demux_t *, unsigned );
int demux_GetTitle( demux_t * );
int demux_GetSeekpoint( demux_t * );
......
......@@ -562,20 +562,16 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed )
if( i_ret == VLC_DEMUXER_SUCCESS )
{
if( demux_GetUpdateFlags( p_demux ) )
if( demux_TestAndClearFlags( p_demux, INPUT_UPDATE_TITLE_LIST ) )
UpdateTitleListfromDemux( p_input );
if( p_input->p->master->b_title_demux )
{
if( demux_GetUpdateFlags( p_demux ) & INPUT_UPDATE_TITLE_LIST )
{
UpdateTitleListfromDemux( p_input );
demux_ResetUpdateFlags( p_demux, INPUT_UPDATE_TITLE_LIST );
}
if( p_input->p->master->b_title_demux )
{
i_ret = UpdateTitleSeekpointFromDemux( p_input );
*pb_changed = true;
}
UpdateGenericFromDemux( p_input );
i_ret = UpdateTitleSeekpointFromDemux( p_input );
*pb_changed = true;
}
UpdateGenericFromDemux( p_input );
}
if( i_ret == VLC_DEMUXER_EOF )
......@@ -2144,19 +2140,12 @@ static int UpdateTitleSeekpointFromDemux( input_thread_t *p_input )
demux_t *p_demux = p_input->p->master->p_demux;
/* TODO event-like */
if( demux_GetUpdateFlags( p_demux ) & INPUT_UPDATE_TITLE )
{
if( demux_TestAndClearFlags( p_demux, INPUT_UPDATE_TITLE ) )
input_SendEventTitle( p_input, demux_GetTitle( p_demux ) );
demux_ResetUpdateFlags( p_demux, INPUT_UPDATE_TITLE );
}
if( demux_GetUpdateFlags( p_demux ) & INPUT_UPDATE_SEEKPOINT )
{
input_SendEventSeekpoint( p_input,
demux_GetTitle( p_demux ), demux_GetSeekpoint( p_demux ) );
demux_ResetUpdateFlags( p_demux, INPUT_UPDATE_SEEKPOINT );
}
if( demux_TestAndClearFlags( p_demux, INPUT_UPDATE_SEEKPOINT ) )
input_SendEventSeekpoint( p_input, demux_GetTitle( p_demux ),
demux_GetSeekpoint( p_demux ) );
return UpdateTitleSeekpoint( p_input,
demux_GetTitle( p_demux ),
......@@ -2167,11 +2156,9 @@ static void UpdateGenericFromDemux( input_thread_t *p_input )
{
demux_t *p_demux = p_input->p->master->p_demux;
if( demux_GetUpdateFlags( p_demux ) & INPUT_UPDATE_META )
{
if( demux_TestAndClearFlags( p_demux, INPUT_UPDATE_META ) )
InputUpdateMeta( p_input, p_demux );
demux_ResetUpdateFlags( p_demux, INPUT_UPDATE_META );
}
{
double quality;
double strength;
......
......@@ -261,7 +261,8 @@ static void* DStreamThread( void *obj )
mtime_t next_update = 0;
while( atomic_load( &p_sys->active ) )
{
if( demux_GetUpdateFlags( p_demux ) || mdate() >= next_update )
if( demux_TestAndClearFlags( p_demux, UINT_MAX )
|| mdate() >= next_update )
{
double newpos;
int64_t newlen, newtime;
......@@ -279,7 +280,6 @@ static void* DStreamThread( void *obj )
p_sys->stats.time = newtime;
vlc_mutex_unlock( &p_sys->lock );
demux_ResetUpdateFlags( p_demux, 0xFFFF );
next_update = mdate() + (CLOCK_FREQ / 4);
}
......
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