Commit 32d45977 authored by Steve Lhomme's avatar Steve Lhomme

input.c, vlc_demux.h: allow seeking back in the same chapter

mkv.cpp: handle the new DEMUX_GET_SEEKPOINT_TIME
parent 27220f26
...@@ -82,6 +82,7 @@ enum demux_query_e ...@@ -82,6 +82,7 @@ enum demux_query_e
/* TITLE/SEEKPOINT, only when TITLE_INFO succeed */ /* TITLE/SEEKPOINT, only when TITLE_INFO succeed */
DEMUX_SET_TITLE, /* arg1= int can fail */ DEMUX_SET_TITLE, /* arg1= int can fail */
DEMUX_SET_SEEKPOINT, /* arg1= int can fail */ DEMUX_SET_SEEKPOINT, /* arg1= int can fail */
DEMUX_GET_SEEKPOINT_TIME, /* arg1= int arg2 = mtime_t * res = can fail */
/* DEMUX_SET_GROUP only a hit for demuxer (mainly DVB) to allow not /* DEMUX_SET_GROUP only a hit for demuxer (mainly DVB) to allow not
* reading everything (you should not use this to call es_out_Control) * reading everything (you should not use this to call es_out_Control)
......
...@@ -1130,6 +1130,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -1130,6 +1130,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
int64_t *pi64; int64_t *pi64;
double *pf, f; double *pf, f;
int i_skp; int i_skp;
mtime_t *i_sk_time;
vlc_meta_t **pp_meta; vlc_meta_t **pp_meta;
...@@ -1206,6 +1207,15 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -1206,6 +1207,15 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
} }
return VLC_EGENERIC; return VLC_EGENERIC;
case DEMUX_GET_SEEKPOINT_TIME:
i_skp = (int)va_arg( args, int );
i_sk_time = (mtime_t *)va_arg( args, mtime_t * );
if( p_sys->title && i_skp < p_sys->title->i_seekpoint)
{
*i_sk_time = p_sys->title->seekpoint[i_skp]->i_time_offset;
return VLC_SUCCESS;
}
return VLC_EGENERIC;
case DEMUX_SET_TIME: case DEMUX_SET_TIME:
case DEMUX_GET_FPS: case DEMUX_GET_FPS:
......
...@@ -1493,9 +1493,21 @@ static vlc_bool_t Control( input_thread_t *p_input, int i_type, ...@@ -1493,9 +1493,21 @@ static vlc_bool_t Control( input_thread_t *p_input, int i_type,
{ {
demux_t *p_demux = p_input->input.p_demux; demux_t *p_demux = p_input->input.p_demux;
int i_seekpoint; int i_seekpoint;
mtime_t i_input_time;
mtime_t i_seekpoint_time;
if( i_type == INPUT_CONTROL_SET_SEEKPOINT_PREV ) if( i_type == INPUT_CONTROL_SET_SEEKPOINT_PREV )
i_seekpoint = p_demux->info.i_seekpoint - 1; {
i_seekpoint = p_demux->info.i_seekpoint;
if (demux2_Control( p_demux, DEMUX_GET_SEEKPOINT_TIME, p_demux->info.i_seekpoint, &i_seekpoint_time) == VLC_SUCCESS)
{
demux2_Control( p_demux, INPUT_GET_TIME, &i_input_time );
if ( i_input_time < i_seekpoint_time + 3000000 )
i_seekpoint--;
}
else
i_seekpoint--;
}
else if( i_type == INPUT_CONTROL_SET_SEEKPOINT_NEXT ) else if( i_type == INPUT_CONTROL_SET_SEEKPOINT_NEXT )
i_seekpoint = p_demux->info.i_seekpoint + 1; i_seekpoint = p_demux->info.i_seekpoint + 1;
else else
......
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