Browse Source

mkv: add DEMUX_GET_(TITLE|SEEKPOINT)

pull/62/head
Rémi Denis-Courmont 9 years ago
parent
commit
db33e6a2ed
  1. 2
      modules/demux/mkv/demux.hpp
  2. 13
      modules/demux/mkv/mkv.cpp
  3. 8
      modules/demux/mkv/virtual_segment.cpp

2
modules/demux/mkv/demux.hpp

@ -337,6 +337,7 @@ public:
,i_mk_chapter_time(0) ,i_mk_chapter_time(0)
,meta(NULL) ,meta(NULL)
,i_current_title(0) ,i_current_title(0)
,i_current_seekpoint(0)
,p_current_vsegment(NULL) ,p_current_vsegment(NULL)
,dvd_interpretor( *this ) ,dvd_interpretor( *this )
,f_duration(-1.0) ,f_duration(-1.0)
@ -360,6 +361,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;
std::vector<matroska_stream_c*> streams; std::vector<matroska_stream_c*> streams;
std::vector<attachment_c*> stored_attachments; std::vector<attachment_c*> stored_attachments;

13
modules/demux/mkv/mkv.cpp

@ -394,8 +394,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
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_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT|INPUT_UPDATE_TITLE;
p_demux->info.i_seekpoint = 0; p_sys->i_current_seekpoint = 0;
p_demux->info.i_title = i_idx;
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;
} }
@ -417,12 +416,20 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if( i_ret == VLC_SUCCESS ) if( i_ret == VLC_SUCCESS )
{ {
p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT; p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
p_demux->info.i_seekpoint = i_skp; p_sys->i_current_seekpoint = i_skp;
} }
return i_ret; return i_ret;
} }
return VLC_EGENERIC; return VLC_EGENERIC;
case DEMUX_GET_TITLE:
*va_arg( args, int * ) = p_sys->i_current_title;
return VLC_SUCCESS;
case DEMUX_GET_SEEKPOINT:
*va_arg( args, int * ) = p_sys->i_current_seekpoint;
return VLC_SUCCESS;
case DEMUX_GET_FPS: case DEMUX_GET_FPS:
pf = va_arg( args, double * ); pf = va_arg( args, double * );
*pf = 0.0; *pf = 0.0;

8
modules/demux/mkv/virtual_segment.cpp

@ -474,8 +474,8 @@ bool virtual_segment_c::UpdateCurrentToChapter( demux_t & demux )
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; demux.info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
demux.info.i_title = sys.i_current_title = i_sys_title; sys.i_current_title = i_sys_title;
demux.info.i_seekpoint = p_cur_vchapter->i_seekpoint_num - 1; sys.i_current_seekpoint = p_cur_vchapter->i_seekpoint_num - 1;
} }
return b_has_seeked; return b_has_seeked;
@ -531,8 +531,8 @@ bool virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_mk_date,
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; demuxer.info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
demuxer.info.i_title = p_sys->i_current_title = i_sys_title; p_sys->i_current_title = i_sys_title;
demuxer.info.i_seekpoint = p_vchapter->i_seekpoint_num - 1; p_sys->i_current_seekpoint = p_vchapter->i_seekpoint_num - 1;
} }
if( p_current_vchapter == NULL || &p_current_vchapter->segment != &p_vchapter->segment ) if( p_current_vchapter == NULL || &p_current_vchapter->segment != &p_vchapter->segment )

Loading…
Cancel
Save