From a49ab7cc2f9548edcfdd8ad9874050bd41e0b551 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 3 Nov 2013 19:21:47 +0100 Subject: demux: make determining seek capability generic Instead of having each demuxer do it (only demux_mkv actually did...), let generic code determine whether the file is seekable. This requires adding exceptions to demuxers where the stream is not seekable, but the demuxer is. Sort-of try to improve handling of unseekable files in the player. Exit early if the file is determined to be unseekable, instead of resetting all decoders and then performing a pointless seek. Add an exception to allow seeking if the file is not seekable, but the stream cache is enabled. Print a warning in this case, because seeking outside the cache (which we can't prevent since the demuxer is not aware of this problem) still messes everything up. --- mpvcore/player/playloop.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mpvcore/player/playloop.c') diff --git a/mpvcore/player/playloop.c b/mpvcore/player/playloop.c index 9e5aa1e0b4..90525a5ca2 100644 --- a/mpvcore/player/playloop.c +++ b/mpvcore/player/playloop.c @@ -215,6 +215,11 @@ static int seek(MPContext *mpctx, struct seek_params seek, if (!mpctx->demuxer) return -1; + if (!mpctx->demuxer->seekable) { + MP_ERR(mpctx, "Can't seek in this file.\n"); + return -1; + } + if (mpctx->stop_play == AT_END_OF_FILE) mpctx->stop_play = KEEP_PLAYING; bool hr_seek = mpctx->demuxer->accurate_seek && opts->correct_pts; -- cgit v1.2.3