summaryrefslogtreecommitdiffstats
path: root/demux/demux.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-12-23 22:28:08 +0100
committerMartin Herkt <652892+lachs0r@users.noreply.github.com>2017-12-24 21:45:12 +0100
commitc12d897a3a79fbe4531988a3853b67a5e6042668 (patch)
tree25322760923bffb4bda0746aff2b747826b03287 /demux/demux.h
parentbf111f9c3cccf0a4aefb998558cce67f9b0d6d25 (diff)
downloadmpv-c12d897a3a79fbe4531988a3853b67a5e6042668.tar.bz2
mpv-c12d897a3a79fbe4531988a3853b67a5e6042668.tar.xz
player: allow seeking in cached parts of unseekable streams
Before this change and before the seekable stream cache became a thing, we could possibly seek using the stream cache. But we couldn't know whether the seek would succeed. We knew the available byte range, but could in general not tell whether a demuxer would stay within the range when trying to seek to a specific time position. We preferred to have safe defaults, so seeking in streams that were detected as unseekable were not honored. We allowed overriding this via --force-seekable=yes, in which case it depended on your luck whether the seek would work, or the player crapped its pants. With the demuxer packet cache, we can tell exactly whether a seek will work (at least if there's only 1 seek range). We can just let seeks go through. Everything to allow this is already in place, and this commit just moves around some minor things. Note that the demux_seek() return value was not used before, because low level (i.e. network level) seeks are usually asynchronous, and if they fail, the state is pretty much undefined. We simply repurpose the return value to signal whether cache seeking worked. If it didn't, we can just resume playback normally, because demuxing continues unaffected, and no decoder are reset. This should be particularly helpful to people who for some reason stream data into stdin via streamlink and such.
Diffstat (limited to 'demux/demux.h')
-rw-r--r--demux/demux.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/demux/demux.h b/demux/demux.h
index aeabd36e99..ab8edb7aa0 100644
--- a/demux/demux.h
+++ b/demux/demux.h
@@ -68,6 +68,7 @@ struct demux_ctrl_stream_ctrl {
#define SEEK_FACTOR (1 << 1) // argument is in range [0,1]
#define SEEK_FORWARD (1 << 2) // prefer later time if not exact
// (if unset, prefer earlier time)
+#define SEEK_CACHED (1 << 3) // allow packet cache seeks only
#define SEEK_HR (1 << 5) // hr-seek (this is a weak hint only)
// Strictness of the demuxer open format check.