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

mkv: provide test-and-clear-flags control

parent cadf225b
...@@ -340,6 +340,7 @@ public: ...@@ -340,6 +340,7 @@ public:
,meta(NULL) ,meta(NULL)
,i_current_title(0) ,i_current_title(0)
,i_current_seekpoint(0) ,i_current_seekpoint(0)
,i_updates(0)
,p_current_vsegment(NULL) ,p_current_vsegment(NULL)
,dvd_interpretor( *this ) ,dvd_interpretor( *this )
,f_duration(-1.0) ,f_duration(-1.0)
...@@ -366,6 +367,7 @@ public: ...@@ -366,6 +367,7 @@ public:
std::vector<input_title_t*> titles; // matroska editions std::vector<input_title_t*> titles; // matroska editions
size_t i_current_title; size_t i_current_title;
size_t i_current_seekpoint; size_t i_current_seekpoint;
unsigned i_updates;
std::vector<matroska_stream_c*> streams; std::vector<matroska_stream_c*> streams;
std::vector<attachment_c*> stored_attachments; std::vector<attachment_c*> stored_attachments;
......
...@@ -379,7 +379,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -379,7 +379,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if( VLC_SUCCESS == if( VLC_SUCCESS ==
Seek( p_demux, static_cast<int64_t>( p_sys->titles[i_idx]->seekpoint[0]->i_time_offset ), -1, NULL) ) Seek( p_demux, static_cast<int64_t>( p_sys->titles[i_idx]->seekpoint[0]->i_time_offset ), -1, NULL) )
{ {
p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT|INPUT_UPDATE_TITLE; p_sys->i_updates |= INPUT_UPDATE_SEEKPOINT|INPUT_UPDATE_TITLE;
p_sys->i_current_seekpoint = 0; p_sys->i_current_seekpoint = 0;
p_sys->f_duration = (float) p_sys->titles[i_idx]->i_length / 1000.f; p_sys->f_duration = (float) p_sys->titles[i_idx]->i_length / 1000.f;
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -401,13 +401,21 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -401,13 +401,21 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
int i_ret = Seek( p_demux, static_cast<int64_t>( p_sys->titles[p_sys->i_current_title]->seekpoint[i_skp]->i_time_offset ), -1, NULL); int i_ret = Seek( p_demux, static_cast<int64_t>( p_sys->titles[p_sys->i_current_title]->seekpoint[i_skp]->i_time_offset ), -1, NULL);
if( i_ret == VLC_SUCCESS ) if( i_ret == VLC_SUCCESS )
{ {
p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT; p_sys->i_updates |= INPUT_UPDATE_SEEKPOINT;
p_sys->i_current_seekpoint = i_skp; p_sys->i_current_seekpoint = i_skp;
} }
return i_ret; return i_ret;
} }
return VLC_EGENERIC; return VLC_EGENERIC;
case DEMUX_TEST_AND_CLEAR_FLAGS:
{
unsigned *restrict flags = va_arg( args, unsigned * );
*flags &= p_sys->i_updates;
p_sys->i_updates &= ~*flags;
break;
}
case DEMUX_GET_TITLE: case DEMUX_GET_TITLE:
*va_arg( args, int * ) = p_sys->i_current_title; *va_arg( args, int * ) = p_sys->i_current_title;
return VLC_SUCCESS; return VLC_SUCCESS;
......
...@@ -467,7 +467,7 @@ bool virtual_segment_c::UpdateCurrentToChapter( demux_t & demux ) ...@@ -467,7 +467,7 @@ bool virtual_segment_c::UpdateCurrentToChapter( demux_t & demux )
p_current_vchapter = p_cur_vchapter; p_current_vchapter = p_cur_vchapter;
if ( p_cur_vchapter->i_seekpoint_num > 0 ) if ( p_cur_vchapter->i_seekpoint_num > 0 )
{ {
demux.info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT; sys.i_updates |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
sys.i_current_title = i_sys_title; sys.i_current_title = i_sys_title;
sys.i_current_seekpoint = p_cur_vchapter->i_seekpoint_num - 1; sys.i_current_seekpoint = p_cur_vchapter->i_seekpoint_num - 1;
} }
...@@ -524,7 +524,7 @@ bool virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_mk_date, ...@@ -524,7 +524,7 @@ bool virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_mk_date,
p_sys->i_mk_chapter_time = i_mk_time_offset - p_vchapter->segment.i_mk_start_time /* + VLC_TS_0 */; p_sys->i_mk_chapter_time = i_mk_time_offset - p_vchapter->segment.i_mk_start_time /* + VLC_TS_0 */;
if ( p_vchapter->p_chapter && p_vchapter->i_seekpoint_num > 0 ) if ( p_vchapter->p_chapter && p_vchapter->i_seekpoint_num > 0 )
{ {
demuxer.info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT; p_sys->i_updates |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
p_sys->i_current_title = i_sys_title; p_sys->i_current_title = i_sys_title;
p_sys->i_current_seekpoint = p_vchapter->i_seekpoint_num - 1; p_sys->i_current_seekpoint = p_vchapter->i_seekpoint_num - 1;
} }
......
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