From 4bd75313d1cc213c2671ecb3370dd99cd9103300 Mon Sep 17 00:00:00 2001 From: tholin Date: Thu, 3 Jul 2014 23:19:12 +0200 Subject: stream_dvdnav: make sure seeking bounds are within range libdvdnav returns an error is the seek position is out of range. CC: @mpv-player/stable Signed-off-by: wm4 --- stream/stream_dvdnav.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'stream/stream_dvdnav.c') diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c index 59f10f6103..cc6c16ae9b 100644 --- a/stream/stream_dvdnav.c +++ b/stream/stream_dvdnav.c @@ -546,7 +546,11 @@ static int control(stream_t *stream, int cmd, void *arg) return STREAM_OK; } case STREAM_CTRL_SEEK_TO_TIME: { - uint64_t tm = (uint64_t) (*((double *)arg) * 90000); + int64_t tm = (int64_t) (*((double *)arg) * 90000); + if (tm < 0) + tm = 0; + if (priv->duration && tm >= (priv->duration * 90)) + tm = priv->duration * 90 - 1; MP_VERBOSE(stream, "seek to PTS %"PRId64"\n", tm); if (dvdnav_time_search(dvdnav, tm) != DVDNAV_STATUS_OK) break; -- cgit v1.2.3