diff options
author | wm4 <wm4@nowhere> | 2014-12-29 22:51:18 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-12-29 22:51:18 +0100 |
commit | 8048374a5c1eb3af80aa057dcfd20deed39447c8 (patch) | |
tree | 311150ab89f3362a1203da1fd39d47b9dcd58d36 /player/loadfile.c | |
parent | 6618e5d69ab2f1eef70769e46f4129d13bd7ff29 (diff) | |
download | mpv-8048374a5c1eb3af80aa057dcfd20deed39447c8.tar.bz2 mpv-8048374a5c1eb3af80aa057dcfd20deed39447c8.tar.xz |
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.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r-- | player/loadfile.c | 13 |
1 files changed, 7 insertions, 6 deletions
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; |