command: add filtered-metadata property

Goes in hand with the previous commit; the main purpose is to easily
show on OSD what is shown on terminal.
This commit is contained in:
wm4 2014-12-29 23:03:39 +01:00
parent 8048374a5c
commit 97ab40290e
2 changed files with 16 additions and 1 deletions

View File

@ -903,6 +903,10 @@ Property list
MPV_FORMAT_NODE_MAP
(key and string value for each metadata entry)
``filtered-metadata``
Like ``metadata``, but includes only fields listed in the ``--display-tags``
option. This is the same set of tags that is printed to the terminal.
``chapter-metadata``
Metadata of current chapter. Works similar to ``metadata`` property. It
also allows the same access methods (using sub-properties).

View File

@ -1122,6 +1122,16 @@ static int mp_property_metadata(void *ctx, struct m_property *prop,
return tag_property(action, arg, demuxer->metadata);
}
static int mp_property_filtered_metadata(void *ctx, struct m_property *prop,
int action, void *arg)
{
MPContext *mpctx = ctx;
if (!mpctx->filtered_tags)
return M_PROPERTY_UNAVAILABLE;
return tag_property(action, arg, mpctx->filtered_tags);
}
static int mp_property_chapter_metadata(void *ctx, struct m_property *prop,
int action, void *arg)
{
@ -3246,6 +3256,7 @@ static const struct m_property mp_properties[] = {
{"editions", mp_property_editions},
{"angle", mp_property_angle},
{"metadata", mp_property_metadata},
{"filtered-metadata", mp_property_filtered_metadata},
{"chapter-metadata", mp_property_chapter_metadata},
{"vf-metadata", mp_property_vf_metadata},
{"pause", mp_property_pause},
@ -3429,7 +3440,7 @@ static const char *const *const mp_event_property_change[] = {
"samplerate", "channels", "audio"),
E(MPV_EVENT_SEEK, "seeking"),
E(MPV_EVENT_PLAYBACK_RESTART, "seeking"),
E(MPV_EVENT_METADATA_UPDATE, "metadata"),
E(MPV_EVENT_METADATA_UPDATE, "metadata", "filtered-metadata"),
E(MPV_EVENT_CHAPTER_CHANGE, "chapter", "chapter-metadata"),
E(MP_EVENT_CACHE_UPDATE, "cache", "cache-free", "cache-used", "cache-idle",
"demuxer-cache-duration", "demuxer-cache-idle"),