Mercurial > mplayer.hg
changeset 37188:32aab8a15bfc
bluray: Fix STREAM_CTRL_SEEK_TO_TIME for out-of-bound values.
author | reimar |
---|---|
date | Wed, 17 Sep 2014 18:16:22 +0000 |
parents | db6c0aa280ff |
children | baa61e26cf83 |
files | stream/stream_bluray.c |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/stream/stream_bluray.c Wed Sep 17 18:00:19 2014 +0000 +++ b/stream/stream_bluray.c Wed Sep 17 18:16:22 2014 +0000 @@ -219,7 +219,14 @@ *(double *)arg = bd_tell_time(b->bd) / 90000.0; return STREAM_OK; case STREAM_CTRL_SEEK_TO_TIME: { - int64_t res = bd_seek_time(b->bd, *(double*)arg * 90000.0); + int64_t res; + double target = *(double*)arg * 90000.0; + BLURAY_TITLE_INFO *ti = bd_get_title_info(b->bd, b->current_title, b->current_angle); + // clamp to ensure that out-of-bounds seeks do not simply do nothing. + target = FFMAX(target, 0); + if (ti && ti->duration > 1) + target = FFMIN(target, ti->duration - 1); + res = bd_seek_time(b->bd, target); if (res < 0) return STREAM_ERROR; s->pos = res;