diff options
author | wm4 <wm4@nowhere> | 2014-10-28 15:28:46 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-28 20:30:11 +0100 |
commit | 0da9ee79e768dfb12e2eeabf5115642f1fb9da32 (patch) | |
tree | e6a8217ad5f60688411c59705933eed902c97fec /demux | |
parent | 98356b81b4e2c1c5d86c3f1a2969a6db90c0718a (diff) | |
download | mpv-0da9ee79e768dfb12e2eeabf5115642f1fb9da32.tar.bz2 mpv-0da9ee79e768dfb12e2eeabf5115642f1fb9da32.tar.xz |
demux: seek to position 0 when loading, instead of restoring it
This was originally done for DVD/BD/DVB, where the start position could
be something different from 0, and seeking back to 0 would mess it up
completely.
Since we're not quite sure that these streams are unseekable, we can
simplify this somewhat, and also make sure we also start at 0 for normal
files. Helps a little bit with the following edition reloading commit.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/demux/demux.c b/demux/demux.c index a24082a7da..01c03026f7 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -844,13 +844,18 @@ static struct demuxer *open_given_type(struct mpv_global *global, in->d_user->metadata = talloc_zero(in->d_user, struct mp_tags); in->d_buffer->metadata = talloc_zero(in->d_buffer, struct mp_tags); - int64_t start_pos = stream_tell(stream); - mp_verbose(log, "Trying demuxer: %s (force-level: %s)\n", desc->name, d_level(check)); in->d_thread->params = params; // temporary during open() + if (stream->seekable) // not for DVD/BD/DVB in particular + stream_seek(stream, 0); + + // Peek this much data to avoid that stream_read() run by some demuxers + // or stream filters will flush previous peeked data. + stream_peek(stream, STREAM_BUFFER_SIZE); + int ret = demuxer->desc->open(in->d_thread, check); if (ret >= 0) { in->d_thread->params = NULL; @@ -873,7 +878,6 @@ static struct demuxer *open_given_type(struct mpv_global *global, } free_demuxer(demuxer); - stream_seek(stream, start_pos); return NULL; } @@ -909,10 +913,6 @@ struct demuxer *demux_open(struct stream *stream, char *force_format, } } - // Peek this much data to avoid that stream_read() run by some demuxers - // or stream filters will flush previous peeked data. - stream_peek(stream, STREAM_BUFFER_SIZE); - // Test demuxers from first to last, one pass for each check_levels[] entry for (int pass = 0; check_levels[pass] != -1; pass++) { enum demux_check level = check_levels[pass]; |