1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 01:22:30 +00:00

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 <wm4@nowhere>
This commit is contained in:
tholin 2014-07-03 23:19:12 +02:00 committed by wm4
parent fe4fbb5775
commit 4bd75313d1

View File

@ -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;