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

j at svn.xiph.org j at svn.xiph.org
Sun Dec 4 06:58:05 PST 2011


Author: j
Date: 2011-12-04 06:58:05 -0800 (Sun, 04 Dec 2011)
New Revision: 18143

Modified:
   trunk/ffmpeg2theora/src/avinfo.c
Log:
output metadata

Modified: trunk/ffmpeg2theora/src/avinfo.c
===================================================================
--- trunk/ffmpeg2theora/src/avinfo.c	2011-12-04 12:06:16 UTC (rev 18142)
+++ trunk/ffmpeg2theora/src/avinfo.c	2011-12-04 14:58:05 UTC (rev 18143)
@@ -386,12 +386,11 @@
 error:
   return i == n;
 }
-
-void json_metadata(FILE *output, const AVFormatContext *av)
+int _json_metadata(FILE *output, AVDictionary *m, int first, int indent)
 {
-    int first = 1, indent=2;
+    int i = 0;
     AVDictionaryEntry *tag = NULL;
-    while ((tag = av_dict_get(av->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
+    while ((tag = av_dict_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
         if (strlen(tag->value) && utf8_validate (tag->value, strlen(tag->value))) {
             if (first) {
                 first = 0;
@@ -405,6 +404,17 @@
             json_add_key_value(output, tag->key, tag->value, JSON_STRING, 1, indent);
         }
     }
+    return first;
+}
+
+void json_metadata(FILE *output, const AVFormatContext *av)
+{
+    int first = 1, indent=2, i=0;
+    first = _json_metadata(output, av->metadata, first, indent);
+
+    for(i=0;i<av->nb_streams;i++) {
+        first = _json_metadata(output, av->streams[i]->metadata, first, indent);
+    }
     if (!first) {
         do_indent(output, 1);
         fprintf(output, "},\n");



More information about the commits mailing list