summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-26 13:46:33 +0100
committerwm4 <wm4@nowhere>2015-01-26 13:46:33 +0100
commit00b261135248be957dd14ae9e8ca26430a39fae0 (patch)
tree4bf6d084daca59b6af930b1126d97ea6332c46af /player
parent792db4eee3173f15eb5003f571509d9eb7c12dcf (diff)
downloadmpv-00b261135248be957dd14ae9e8ca26430a39fae0.tar.bz2
mpv-00b261135248be957dd14ae9e8ca26430a39fae0.tar.xz
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.
Diffstat (limited to 'player')
-rw-r--r--player/command.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 556a0c4308..397e527ec9 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1438,6 +1438,15 @@ static int mp_property_seekable(void *ctx, struct m_property *prop,
return m_property_flag_ro(action, arg, mpctx->demuxer->seekable);
}
+static int mp_property_partially_seekable(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ if (!mpctx->demuxer)
+ return M_PROPERTY_UNAVAILABLE;
+ return m_property_flag_ro(action, arg, mpctx->demuxer->partially_seekable);
+}
+
/// Volume (RW)
static int mp_property_volume(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -3294,6 +3303,7 @@ static const struct m_property mp_properties[] = {
{"hr-seek", mp_property_generic_option},
{"clock", mp_property_clock},
{"seekable", mp_property_seekable},
+ {"partially-seekable", mp_property_partially_seekable},
{"idle", mp_property_idle},
{"chapter-list", mp_property_list_chapters},