summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-23 15:59:06 +0100
committerwm4 <wm4@nowhere>2015-01-23 15:59:06 +0100
commit9681d42a9427c8860f1a768a289de3679a9cd9e8 (patch)
tree87d91b0650a50253688372eca63164956d24dd6d /player/command.c
parenta0ed62fc1d427bc02af8a2865d491ebde73ad2f0 (diff)
downloadmpv-9681d42a9427c8860f1a768a289de3679a9cd9e8.tar.bz2
mpv-9681d42a9427c8860f1a768a289de3679a9cd9e8.tar.xz
command: export file format as property
Repurpose demuxer->filetype for this. It used to be used to print a human readable format description; change it to a symbolic format name and export it as property. Unfortunately, libavformat has its own weird conventions, which are reflected through the new property, e.g. the .mp4 case mentioned in the manpage. Fixes #1504.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 922734211c..e7ecb4d375 100644
--- a/player/command.c
+++ b/player/command.c
@@ -420,6 +420,17 @@ static int mp_property_demuxer(void *ctx, struct m_property *prop,
return m_property_strdup_ro(action, arg, demuxer->desc->name);
}
+static int mp_property_file_format(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ struct demuxer *demuxer = mpctx->master_demuxer;
+ if (!demuxer)
+ return M_PROPERTY_UNAVAILABLE;
+ const char *name = demuxer->filetype ? demuxer->filetype : demuxer->desc->name;
+ return m_property_strdup_ro(action, arg, name);
+}
+
/// Position in the stream (RW)
static int mp_property_stream_pos(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -3238,6 +3249,7 @@ static const struct m_property mp_properties[] = {
{"stream-path", mp_property_stream_path},
{"stream-capture", mp_property_stream_capture},
{"demuxer", mp_property_demuxer},
+ {"file-format", mp_property_file_format},
{"stream-pos", mp_property_stream_pos},
{"stream-end", mp_property_stream_end},
{"length", mp_property_length},