From: Steve Lhomme Date: Sat, 5 Mar 2005 12:55:02 +0000 (+0000) Subject: input.c, vlc_demux.h: allow seeking back in the same chapter X-Git-Tag: 0.8.2~970 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=32d45977759b0339d0df6968162b70c6232a9d0d;p=vlc input.c, vlc_demux.h: allow seeking back in the same chapter mkv.cpp: handle the new DEMUX_GET_SEEKPOINT_TIME --- diff --git a/include/vlc_demux.h b/include/vlc_demux.h index 7c4385ba9b..2eefcb8cf8 100644 --- a/include/vlc_demux.h +++ b/include/vlc_demux.h @@ -82,6 +82,7 @@ enum demux_query_e /* TITLE/SEEKPOINT, only when TITLE_INFO succeed */ DEMUX_SET_TITLE, /* 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 * reading everything (you should not use this to call es_out_Control) diff --git a/modules/demux/mkv.cpp b/modules/demux/mkv.cpp index 45db1d56e4..438a0f0853 100644 --- a/modules/demux/mkv.cpp +++ b/modules/demux/mkv.cpp @@ -1130,6 +1130,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) int64_t *pi64; double *pf, f; int i_skp; + mtime_t *i_sk_time; vlc_meta_t **pp_meta; @@ -1206,6 +1207,15 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) } 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_GET_FPS: @@ -1420,7 +1430,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts, } #endif - // TODO implement correct timestamping when B frames are used + // TODO implement correct timestamping when B frames are used if( tk.fmt.i_cat != VIDEO_ES ) { p_block->i_dts = p_block->i_pts = i_pts; diff --git a/src/input/input.c b/src/input/input.c index 436bff7911..bcefedca52 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -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; int i_seekpoint; + mtime_t i_input_time; + mtime_t i_seekpoint_time; 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 ) i_seekpoint = p_demux->info.i_seekpoint + 1; else