Commit 2c172d25 authored by Jan Gerber's avatar Jan Gerber
Browse files

fix json output for files with metadata

parent 68fcbb07
...@@ -389,7 +389,7 @@ error: ...@@ -389,7 +389,7 @@ error:
void json_metadata(FILE *output, const AVFormatContext *av) void json_metadata(FILE *output, const AVFormatContext *av)
{ {
int first = 1; int first = 1, indent=2;
AVMetadataTag *tag = NULL; AVMetadataTag *tag = NULL;
while ((tag = av_metadata_get(av->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) { while ((tag = av_metadata_get(av->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
char uc_key[16]; char uc_key[16];
...@@ -399,13 +399,17 @@ void json_metadata(FILE *output, const AVFormatContext *av) ...@@ -399,13 +399,17 @@ void json_metadata(FILE *output, const AVFormatContext *av)
first = 0; first = 0;
do_indent(output, 1); do_indent(output, 1);
fprintf(output, "\"metadata\": {\n"); fprintf(output, "\"metadata\": {\n");
} else {
do_indent(output, 2);
fprintf(output, ",");
indent=0;
} }
json_add_key_value(output, tag->key, tag->value, JSON_STRING, 0, 2); json_add_key_value(output, tag->key, tag->value, JSON_STRING, 1, indent);
} }
} }
if (!first) { if (!first) {
do_indent(output, 1); do_indent(output, 1);
fprintf(output, "}\n"); fprintf(output, "},\n");
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment