flvdec: Don't export metadata entries that aren't proper metadata
authorMartin Storsjö <martin@martin.st>
Tue, 11 Oct 2011 21:03:20 +0000 (00:03 +0300)
committerMartin Storsjö <martin@martin.st>
Wed, 12 Oct 2011 07:19:47 +0000 (10:19 +0300)
This avoids writing these entries doubly if transcoding from
flv to flv, since the muxer blindly writes any and all metadata
keys set, in addition to the fixed fields that the muxer
always writes.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/flvdec.c

index 815618d5f8bbb7c09fc63b3257867e36e2a193fa..d2f3f51d2866a20bec0fd434bf9c1df5d17b72bb 100644 (file)
@@ -296,6 +296,20 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
                 acodec->bit_rate = num_val * 1024.0;
         }
 
+        if (!strcmp(key, "duration")        ||
+            !strcmp(key, "filesize")        ||
+            !strcmp(key, "width")           ||
+            !strcmp(key, "height")          ||
+            !strcmp(key, "videodatarate")   ||
+            !strcmp(key, "framerate")       ||
+            !strcmp(key, "videocodecid")    ||
+            !strcmp(key, "audiodatarate")   ||
+            !strcmp(key, "audiosamplerate") ||
+            !strcmp(key, "audiosamplesize") ||
+            !strcmp(key, "stereo")          ||
+            !strcmp(key, "audiocodecid"))
+            return 0;
+
         if(amf_type == AMF_DATA_TYPE_BOOL) {
             av_strlcpy(str_val, num_val > 0 ? "true" : "false", sizeof(str_val));
             av_dict_set(&s->metadata, key, str_val, 0);