From 85450d06a1b1a08fce277f7f14d5ee33b12f8eab Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 16 Nov 2015 23:15:59 +0100 Subject: player: use demuxer ts offset to simplify timeline ts handling Use the demux_set_ts_offset() added in the previous commit to base each timeline segment to use timestamps according to its relative position within the overall timeline. As a consequence we don't need to care about these timestamps anymore, and everything becomes simpler. (Another minor but delicious nugget of sanity.) --- player/playloop.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'player/playloop.c') diff --git a/player/playloop.c b/player/playloop.c index 6fa7b62292..da21c64d34 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -229,10 +229,9 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek, double demuxer_amount = seek.amount; if (mpctx->timeline) { - bool need_reset = false; - demuxer_amount = timeline_set_from_time(mpctx, seek.amount, - &need_reset); - if (need_reset) { + int segment = timeline_get_for_time(mpctx, seek.amount); + if (segment != mpctx->timeline_part) { + timeline_set_part(mpctx, segment, false); reinit_video_chain(mpctx); reinit_audio_chain(mpctx); reinit_subs(mpctx, 0); @@ -268,7 +267,6 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek, double main_new_pos = seek.amount; if (seek.type != MPSEEK_ABSOLUTE) main_new_pos = get_main_demux_pts(mpctx); - main_new_pos -= get_track_video_offset(mpctx, track); demux_seek(track->demuxer, main_new_pos, SEEK_ABSOLUTE | SEEK_BACKWARD); } } -- cgit v1.2.3