Skip to content

Commit 0584642

Browse files
committed
command: allow metadata to be set manually
1 parent 5f9e1bc commit 0584642

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

player/command.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,18 +1293,22 @@ static int tag_property(int action, void *arg, struct mp_tags *tags)
12931293
// Direct access without this prefix is allowed for compatibility.
12941294
bstr k = bstr0(ka->key);
12951295
bstr_eatstart0(&k, "by-key/");
1296-
char *meta = mp_tags_get_bstr(tags, k);
1297-
if (!meta)
1298-
return M_PROPERTY_UNKNOWN;
12991296
switch (ka->action) {
1300-
case M_PROPERTY_GET:
1297+
case M_PROPERTY_GET: {
1298+
char *meta = mp_tags_get_bstr(tags, k);
1299+
if (!meta)
1300+
return M_PROPERTY_UNKNOWN;
13011301
*(char **)ka->arg = talloc_strdup(NULL, meta);
13021302
return M_PROPERTY_OK;
1303+
}
13031304
case M_PROPERTY_GET_TYPE:
13041305
*(struct m_option *)ka->arg = (struct m_option){
13051306
.type = CONF_TYPE_STRING,
13061307
};
13071308
return M_PROPERTY_OK;
1309+
case M_PROPERTY_SET:
1310+
mp_tags_set_bstr(tags, k, bstr0(*(char **)ka->arg));
1311+
return M_PROPERTY_OK;
13081312
}
13091313
}
13101314
}

0 commit comments

Comments
 (0)