summaryrefslogtreecommitdiffstats
path: root/demux/demux.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-04 00:43:06 +0100
committerwm4 <wm4@nowhere>2013-11-04 00:43:06 +0100
commitf7b2d644eff7fae2d74259ae14ec2b05b00c9b9b (patch)
treeca5462391d6a8f7b8e254c51c88f30efea91b90f /demux/demux.c
parent37388ebb0ef9085c841d7f94e665a5a77cfe0e92 (diff)
parent25affdcc886ce010995804553396d81d90a321d3 (diff)
downloadmpv-f7b2d644eff7fae2d74259ae14ec2b05b00c9b9b.tar.bz2
mpv-f7b2d644eff7fae2d74259ae14ec2b05b00c9b9b.tar.xz
Merge branch 'master' into have_configure
Conflicts: configure
Diffstat (limited to 'demux/demux.c')
-rw-r--r--demux/demux.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/demux/demux.c b/demux/demux.c
index eeb979be9d..a0164d529a 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -533,9 +533,8 @@ static struct demuxer *open_given_type(struct MPOpts *opts,
.type = desc->type,
.stream = stream,
.stream_pts = MP_NOPTS_VALUE,
- .movi_start = stream->start_pos,
- .movi_end = stream->end_pos,
- .seekable = 1,
+ .seekable = (stream->flags & MP_STREAM_SEEK) == MP_STREAM_SEEK &&
+ stream->end_pos > 0,
.accurate_seek = true,
.filepos = -1,
.opts = opts,
@@ -566,6 +565,12 @@ static struct demuxer *open_given_type(struct MPOpts *opts,
add_stream_chapters(demuxer);
demuxer_sort_chapters(demuxer);
demux_info_update(demuxer);
+ // Pretend we can seek if we can't seek, but there's a cache.
+ if (!demuxer->seekable && stream->uncached_stream) {
+ mp_msg(MSGT_DEMUXER, MSGL_WARN,
+ "File is not seekable, but there's a cache: enabling seeking.\n");
+ demuxer->seekable = true;
+ }
return demuxer;
}
@@ -634,7 +639,7 @@ void demux_flush(demuxer_t *demuxer)
int demux_seek(demuxer_t *demuxer, float rel_seek_secs, int flags)
{
if (!demuxer->seekable) {
- mp_tmsg(MSGT_SEEK, MSGL_WARN, "Cannot seek in this file.\n");
+ mp_tmsg(MSGT_DEMUXER, MSGL_WARN, "Cannot seek in this file.\n");
return 0;
}