[xiph-commits] r16739 - trunk/ffmpeg2theora/src

j at svn.xiph.org j at svn.xiph.org
Fri Nov 27 17:56:41 PST 2009


Author: j
Date: 2009-11-27 17:56:40 -0800 (Fri, 27 Nov 2009)
New Revision: 16739

Modified:
   trunk/ffmpeg2theora/src/avinfo.c
Log:
fix json output for files with metadata

Modified: trunk/ffmpeg2theora/src/avinfo.c
===================================================================
--- trunk/ffmpeg2theora/src/avinfo.c	2009-11-27 17:07:57 UTC (rev 16738)
+++ trunk/ffmpeg2theora/src/avinfo.c	2009-11-28 01:56:40 UTC (rev 16739)
@@ -389,7 +389,7 @@
 
 void json_metadata(FILE *output, const AVFormatContext *av)
 {
-    int first = 1;
+    int first = 1, indent=2;
     AVMetadataTag *tag = NULL;
     while ((tag = av_metadata_get(av->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
         char uc_key[16];
@@ -399,13 +399,17 @@
                 first = 0;
                 do_indent(output, 1);
                 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) {
         do_indent(output, 1);
-        fprintf(output, "}\n");
+        fprintf(output, "},\n");
     }
 }
 



More information about the commits mailing list