From 8048374a5c1eb3af80aa057dcfd20deed39447c8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 29 Dec 2014 22:51:18 +0100 Subject: player: filter tags, add --display-tags option This attempts to increase user-friendliness by excluding useless tags. It should be especially helpful with mp4 files, because the FFmpeg mp4 demuxer adds tons of completely useless information to the metadata. Fixes #1403. --- player/loadfile.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'player/loadfile.c') diff --git a/player/loadfile.c b/player/loadfile.c index 2f75a5bea9..96e34f5a95 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -168,9 +168,10 @@ void update_demuxer_properties(struct MPContext *mpctx) tracks->events &= ~DEMUX_EVENT_STREAMS; } if (events & DEMUX_EVENT_METADATA) { - struct mp_tags *info = demuxer->metadata; + struct mp_tags *info = + mp_tags_filtered(mpctx, demuxer->metadata, mpctx->opts->display_tags); // prev is used to attempt to print changed tags only (to some degree) - struct mp_tags *prev = mpctx->tags; + struct mp_tags *prev = mpctx->filtered_tags; int n_prev = 0; bool had_output = false; for (int n = 0; n < info->num_keys; n++) { @@ -186,8 +187,8 @@ void update_demuxer_properties(struct MPContext *mpctx) MP_INFO(mpctx, " %s: %s\n", info->keys[n], info->values[n]); had_output = true; } - talloc_free(mpctx->tags); - mpctx->tags = mp_tags_dup(mpctx, info); + talloc_free(mpctx->filtered_tags); + mpctx->filtered_tags = info; mp_notify(mpctx, MPV_EVENT_METADATA_UPDATE, NULL); } demuxer->events = 0; @@ -1223,8 +1224,8 @@ terminate_playback: m_config_restore_backups(mpctx->mconfig); - talloc_free(mpctx->tags); - mpctx->tags = NULL; + talloc_free(mpctx->filtered_tags); + mpctx->filtered_tags = NULL; mpctx->playback_initialized = false; -- cgit v1.2.3