Mercurial > mplayer.hg
changeset 10874:f75ec55301c4
Different decision making for seeking which takes the direction into account.
author | mosu |
---|---|
date | Mon, 15 Sep 2003 21:03:49 +0000 |
parents | 4b956204bed0 |
children | a0d3ce3d87af |
files | libmpdemux/demux_mkv.cpp |
diffstat | 1 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.cpp Mon Sep 15 20:22:27 2003 +0000 +++ b/libmpdemux/demux_mkv.cpp Mon Sep 15 21:03:49 2003 +0000 @@ -2426,9 +2426,28 @@ if (!index->entries[k].is_key) continue; diff = target_timecode - (int64_t)index->entries[k].timecode; - if ((diff > 0) && (diff < min_diff)) { + if ((target_timecode <= (mkv_d->last_pts * 1000)) && + (diff >= 0) && (diff < min_diff)) { min_diff = diff; - entry = & index->entries[k]; + entry = &index->entries[k]; + mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] seek BACK, solution: last_pts: " + "%d, target: %d, diff: %d, entry->timecode: %d, PREV diff: " + "%d, k: %d\n", (int)(mkv_d->last_pts * 1000), + (int)target_timecode, (int)diff, (int)entry->timecode, + k > 0 ? (int)(index->entries[k - 1].timecode - + target_timecode) : 0, k); + + } else if ((target_timecode > (mkv_d->last_pts * 1000)) && + (diff < 0) && (-diff < min_diff)) { + min_diff = -diff; + entry = &index->entries[k]; + mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] seek FORW, solution: last_pts: " + "%d, target: %d, diff: %d, entry->timecode: %d, NEXT diff: " + "%d, k: %d\n", (int)(mkv_d->last_pts * 1000), + (int)target_timecode, (int)diff, (int)entry->timecode, + k < index->num_entries ? + (int)(index->entries[k + 1].timecode - target_timecode) : + 0, k); } } break;