From 00b261135248be957dd14ae9e8ca26430a39fae0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 26 Jan 2015 13:46:33 +0100 Subject: command: export more details about file seekability If a file is unseekable (consider e.g. a http server without resume functionality), but the stream cache is active, the player will enable seeking anyway. Until know, client API user couldn't know that this happens, and it has implications on how well seeking will work. So add a property which exports whether this situation applies. Fixes #1522. --- demux/demux.c | 2 ++ demux/demux.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'demux') diff --git a/demux/demux.c b/demux/demux.c index 51131dfd4c..e498895aaf 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -758,6 +758,7 @@ static void demux_copy(struct demuxer *dst, struct demuxer *src) dst->file_contents = src->file_contents; dst->playlist = src->playlist; dst->seekable = src->seekable; + dst->partially_seekable = src->partially_seekable; dst->filetype = src->filetype; dst->ts_resets_possible = src->ts_resets_possible; dst->rel_seeks = src->rel_seeks; @@ -905,6 +906,7 @@ static struct demuxer *open_given_type(struct mpv_global *global, if (!in->d_thread->seekable && stream->uncached_stream) { mp_verbose(log, "Enabling seeking because stream cache is active.\n"); in->d_thread->seekable = true; + in->d_thread->partially_seekable = true; } demux_init_cache(demuxer); demux_changed(in->d_thread, DEMUX_EVENT_ALL); diff --git a/demux/demux.h b/demux/demux.h index b53a30c805..e18c013a5b 100644 --- a/demux/demux.h +++ b/demux/demux.h @@ -185,7 +185,8 @@ typedef struct demuxer { int64_t filepos; // input stream current pos. char *filename; // same as stream->url enum demuxer_type type; - int seekable; // flag + bool seekable; + bool partially_seekable; // implies seekable=true double start_time; // File format allows PTS resets (even if the current file is without) bool ts_resets_possible; -- cgit v1.2.3