[FFmpeg-devel] [PATCH] lavf/utils: extend dump_metadata() to take a loglevel argument
Stefano Sabatini
stefasab at gmail.com
Fri Jul 13 11:50:37 CEST 2012
---
libavformat/utils.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 39527a6..f94e5f8 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3724,27 +3724,27 @@ static void print_fps(double d, const char *postfix){
else av_log(NULL, AV_LOG_INFO, ", %1.0fk %s", d/1000, postfix);
}
-static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
+static void dump_metadata(void *ctx, AVDictionary *m, const char *indent, int loglevel)
{
if(m && !(m->count == 1 && av_dict_get(m, "language", NULL, 0))){
AVDictionaryEntry *tag=NULL;
- av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
+ av_log(ctx, loglevel, "%sMetadata:\n", indent);
while((tag=av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
if(strcmp("language", tag->key)){
const char *p = tag->value;
- av_log(ctx, AV_LOG_INFO, "%s %-16s: ", indent, tag->key);
+ av_log(ctx, loglevel, "%s %-16s: ", indent, tag->key);
while(*p) {
char tmp[256];
size_t len = strcspn(p, "\xd\xa");
av_strlcpy(tmp, p, FFMIN(sizeof(tmp), len+1));
- av_log(ctx, AV_LOG_INFO, "%s", tmp);
+ av_log(ctx, loglevel, "%s", tmp);
p += len;
- if (*p == 0xd) av_log(ctx, AV_LOG_INFO, " ");
- if (*p == 0xa) av_log(ctx, AV_LOG_INFO, "\n%s %-16s: ", indent, "");
+ if (*p == 0xd) av_log(ctx, loglevel, " ");
+ if (*p == 0xa) av_log(ctx, loglevel, "\n%s %-16s: ", indent, "");
if (*p) p++;
}
- av_log(ctx, AV_LOG_INFO, "\n");
+ av_log(ctx, loglevel, "\n");
}
}
}
@@ -3809,8 +3809,8 @@ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_out
av_log(NULL, AV_LOG_INFO, " (visual impaired)");
if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS)
av_log(NULL, AV_LOG_INFO, " (clean effects)");
- av_log(NULL, AV_LOG_INFO, "\n");
- dump_metadata(NULL, st->metadata, " ");
+ av_log(NULL, AV_LOG_VERBOSE, "\n");
+ dump_metadata(NULL, st->metadata, " ", AV_LOG_INFO);
}
void av_dump_format(AVFormatContext *ic,
@@ -3828,7 +3828,7 @@ void av_dump_format(AVFormatContext *ic,
index,
is_output ? ic->oformat->name : ic->iformat->name,
is_output ? "to" : "from", url);
- dump_metadata(NULL, ic->metadata, " ");
+ dump_metadata(NULL, ic->metadata, " ", AV_LOG_INFO);
if (!is_output) {
av_log(NULL, AV_LOG_INFO, " Duration: ");
if (ic->duration != AV_NOPTS_VALUE) {
@@ -3866,7 +3866,7 @@ void av_dump_format(AVFormatContext *ic,
av_log(NULL, AV_LOG_INFO, "start %f, ", ch->start * av_q2d(ch->time_base));
av_log(NULL, AV_LOG_INFO, "end %f\n", ch->end * av_q2d(ch->time_base));
- dump_metadata(NULL, ch->metadata, " ");
+ dump_metadata(NULL, ch->metadata, " ", AV_LOG_INFO);
}
if(ic->nb_programs) {
int j, k, total = 0;
@@ -3875,7 +3875,7 @@ void av_dump_format(AVFormatContext *ic,
"name", NULL, 0);
av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id,
name ? name->value : "");
- dump_metadata(NULL, ic->programs[j]->metadata, " ");
+ dump_metadata(NULL, ic->programs[j]->metadata, " ", AV_LOG_INFO);
for(k=0; k<ic->programs[j]->nb_stream_indexes; k++) {
dump_stream_format(ic, ic->programs[j]->stream_index[k], index, is_output);
printed[ic->programs[j]->stream_index[k]] = 1;
--
1.7.5.4
More information about the ffmpeg-devel
mailing list