| @@ -2004,6 +2004,13 @@ static int get_track_entry(int item, int action, void *arg, void *ctx) · 2003 unmodified lines |
| 2004 | 2004 | struct replaygain_data rg = has_rg ? *track->stream->codec->replaygain_data |
| 2005 | 2005 | : (struct replaygain_data){0}; |
| 2006 | 2006 | |
| 2007 | + struct mp_tags *tags = track->stream ? track->stream->tags : &(struct mp_tags){0}; |
| 2008 | + char **tag_list = talloc_zero_array(NULL, char *, tags->num_keys * 2 + 1); |
| 2009 | + for (int i = 0; i < tags->num_keys; i++) { |
| 2010 | + tag_list[2 * i] = talloc_strdup(tag_list, tags->keys[i]); |
| 2011 | + tag_list[2 * i + 1] = talloc_strdup(tag_list, tags->values[i]); |
| 2012 | + } |
| 2013 | + |
| 2007 | 2014 | double par = 0.0; |
| 2008 | 2015 | if (p.par_h) |
| 2009 | 2016 | par = p.par_w / (double) p.par_h; |
| @@ -2087,10 +2094,37 @@ static int get_track_entry(int item, int action, void *arg, void *ctx) · 77 unmodified lines |
| 2087 | 2094 | .unavailable = !p.dovi}, |
| 2088 | 2095 | {"dolby-vision-level", SUB_PROP_INT(p.dv_level), |
| 2089 | 2096 | .unavailable = !p.dovi}, |
| 2097 | + {"metadata", SUB_PROP_KEYVALUE_LIST(tag_list), |
| 2098 | + .unavailable = !tags->num_keys}, |
| 2090 | 2099 | {0} |
| 2091 | 2100 | }; |
| 2092 | 2101 | |
| 2093 | | − return m_property_read_sub(props, action, arg); |
| 2102 | + int ret = 0; |
| 2103 | + switch (action) { |
| 2104 | + case M_PROPERTY_KEY_ACTION: ; |
| 2105 | + struct m_property_action_arg *ka = arg; |
| 2106 | + if (!strncmp(ka->key, "metadata/", 9)) { |
| 2107 | + bstr key = {0}; |
| 2108 | + char *rem = ""; |
| 2109 | + m_property_split_path(ka->key, &key, &rem); |
| 2110 | + ka->key = !rem[0] ? "metadata" : rem; |
| 2111 | + if (rem[0]) { |
| 2112 | + if (!tags || tags->num_keys == 0) { |
| 2113 | + ret = M_PROPERTY_UNAVAILABLE; |
| 2114 | + } else { |
| 2115 | + ret = tag_property(action, (void *)ka, tags); |
| 2116 | + } |
| 2117 | + goto done; |
| 2118 | + } |
| 2119 | + } |
| 2120 | + MP_FALLTHROUGH; |
| 2121 | + default: |
| 2122 | + ret = m_property_read_sub(props, action, arg); |
| 2123 | + } |
| 2124 | + |
| 2125 | +done: |
| 2126 | + talloc_free(tag_list); |
| 2127 | + return ret; |
| 2094 | 2128 | } |
| 2095 | 2129 | |
| 2096 | 2130 | static const char *track_type_name(struct track *t) |