Mercurial > libavformat.hg
changeset 5455:df772456ed85 libavformat
Factorize dump_metadata() out.
Idea from ffmbc, code not, mine is a fraction of the size due to simpler
metadata API.
author | michael |
---|---|
date | Sun, 13 Dec 2009 23:19:24 +0000 |
parents | 01cad9ef4a57 |
children | 90b61b66076d |
files | utils.c |
diffstat | 1 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/utils.c Sun Dec 13 22:56:59 2009 +0000 +++ b/utils.c Sun Dec 13 23:19:24 2009 +0000 @@ -2852,6 +2852,18 @@ else av_log(NULL, AV_LOG_INFO, ", %1.0fk %s", d/1000, postfix); } +static void dump_metadata(void *ctx, AVMetadata *m, const char *indent) +{ + if(m){ + AVMetadataTag *tag=NULL; + + av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent); + while((tag=av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX))) { + av_log(ctx, AV_LOG_INFO, "%s %-16s: %s\n", indent, tag->key, tag->value); + } + } +} + /* "user interface" functions */ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) { @@ -2960,13 +2972,7 @@ if (!printed[i]) dump_stream_format(ic, i, index, is_output); - if (ic->metadata) { - AVMetadataTag *tag=NULL; - av_log(NULL, AV_LOG_INFO, " Metadata\n"); - while((tag=av_metadata_get(ic->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) { - av_log(NULL, AV_LOG_INFO, " %-16s: %s\n", tag->key, tag->value); - } - } + dump_metadata(NULL, ic->metadata, " "); av_free(printed); }