summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2014-04-13 07:08:58 -0700
committerwm4 <wm4@nowhere>2014-04-13 18:03:01 +0200
commit9eb061a72b66702d394584fac371358050f7ad18 (patch)
tree56493ad73652a68e06cabc35211fcbcf1f2a8c64 /player
parentf09134b76d9dfda8001de82fa33bc1aab967cae7 (diff)
downloadmpv-9eb061a72b66702d394584fac371358050f7ad18.tar.bz2
mpv-9eb061a72b66702d394584fac371358050f7ad18.tar.xz
command: add vf-metadata property
This is a read-only property that uses VFCTRL_GET_METADATA to retrieve mp_tags metadata from a filter specified by label Signed-off-by: wm4 <wm4@nowhere>
Diffstat (limited to 'player')
-rw-r--r--player/command.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/player/command.c b/player/command.c
index 8891fdd3f3..cc4cc0892a 100644
--- a/player/command.c
+++ b/player/command.c
@@ -617,7 +617,6 @@ static int mp_property_edition(m_option_t *prop, int action, void *arg,
return M_PROPERTY_NOT_IMPLEMENTED;
}
-
static int get_edition_entry(int item, int action, void *arg, void *ctx)
{
struct MPContext *mpctx = ctx;
@@ -933,6 +932,42 @@ static int mp_property_chapter_metadata(m_option_t *prop, int action, void *arg,
return tag_property(prop, action, arg, demuxer->chapters[chapter].metadata);
}
+static int mp_property_vf_metadata(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
+{
+ if (!(mpctx->d_video && mpctx->d_video->vfilter))
+ return M_PROPERTY_UNAVAILABLE;
+ struct vf_chain *vf = mpctx->d_video->vfilter;
+
+ switch(action) {
+ case M_PROPERTY_GET_TYPE:
+ case M_PROPERTY_GET:
+ case M_PROPERTY_GET_NODE:
+ return M_PROPERTY_NOT_IMPLEMENTED;
+ case M_PROPERTY_KEY_ACTION: {
+ struct m_property_action_arg *ka = arg;
+ bstr key;
+ char *rem;
+ m_property_split_path(ka->key, &key, &rem);
+ struct mp_tags vf_metadata;
+ if (vf_control_by_label(vf, VFCTRL_GET_METADATA, &vf_metadata, key)
+ == CONTROL_UNKNOWN)
+ return M_PROPERTY_UNKNOWN;
+
+ if (strlen(rem)) {
+ struct m_property_action_arg next_ka = *ka;
+ next_ka.key = rem;
+ return tag_property(prop, M_PROPERTY_KEY_ACTION, &next_ka,
+ &vf_metadata);
+ } else {
+ return tag_property(prop, ka->action, ka->arg, &vf_metadata);
+ }
+ return M_PROPERTY_OK;
+ }
+ }
+ return M_PROPERTY_UNAVAILABLE;
+}
+
static int mp_property_pause(m_option_t *prop, int action, void *arg,
void *ctx)
{
@@ -2206,6 +2241,7 @@ static const m_option_t mp_properties[] = {
{ "angle", mp_property_angle, &m_option_type_dummy },
M_PROPERTY("metadata", mp_property_metadata),
M_PROPERTY("chapter-metadata", mp_property_chapter_metadata),
+ M_PROPERTY( "vf-metadata", mp_property_vf_metadata),
M_OPTION_PROPERTY_CUSTOM("pause", mp_property_pause),
{ "cache", mp_property_cache, CONF_TYPE_INT },
{ "cache-size", mp_property_cache_size, CONF_TYPE_INT, M_OPT_MIN, 0 },