summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-30 14:04:53 +0100
committerwm4 <wm4@nowhere>2014-12-30 14:04:53 +0100
commit63a414c708ea2986386639124fdfa9cdbd58e520 (patch)
tree74ab67696e067e492b149d7b9f480266bd9a293f /player/command.c
parentf2d6c8cb1cb51f05867f3c20b5c8b77213d64b80 (diff)
downloadmpv-63a414c708ea2986386639124fdfa9cdbd58e520.tar.bz2
mpv-63a414c708ea2986386639124fdfa9cdbd58e520.tar.xz
command: make empty vf-metadata not an error
If a filter exists, but has no metadata, just return success. This allows the user to distinguish between no metadata available, and filter not inserted. See #1408.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/player/command.c b/player/command.c
index 97b890af5c..1739da76cb 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1075,8 +1075,10 @@ static int tag_property(int action, void *arg, struct mp_tags *tags)
res = talloc_asprintf_append_buffer(res, "%s: %s\n",
tags->keys[n], tags->values[n]);
}
+ if (!res)
+ res = talloc_strdup(NULL, "(empty)");
*(char **)arg = res;
- return res ? M_PROPERTY_OK : M_PROPERTY_UNAVAILABLE;
+ return M_PROPERTY_OK;
}
case M_PROPERTY_KEY_ACTION: {
struct m_property_action_arg *ka = arg;
@@ -1153,22 +1155,16 @@ static int mp_property_vf_metadata(void *ctx, struct m_property *prop,
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: {
+ if (action == 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;
+ struct mp_tags vf_metadata = {0};
switch (vf_control_by_label(vf, VFCTRL_GET_METADATA, &vf_metadata, key)) {
- case CONTROL_NA:
- return M_PROPERTY_UNAVAILABLE;
case CONTROL_UNKNOWN:
return M_PROPERTY_UNKNOWN;
+ case CONTROL_NA: // empty
case CONTROL_OK:
if (strlen(rem)) {
struct m_property_action_arg next_ka = *ka;
@@ -1182,7 +1178,6 @@ static int mp_property_vf_metadata(void *ctx, struct m_property *prop,
return M_PROPERTY_ERROR;
}
}
- }
return M_PROPERTY_NOT_IMPLEMENTED;
}