[FFmpeg-devel] [PATCH] ogg: discard vorbis metadata from extradata

Reimar Döffinger Reimar.Doeffinger
Sat Dec 11 18:34:52 CET 2010


Hello,
it is quite silly to keep the metadata in extradata when we already parsed
it.
This also avoids issues with remuxing: If coverart is included the metadata
can easily reach 100 kB, however e.g. wav and AVI support at most 64 kB of
extradata.
Below patch just throws the comment headers away when building extradata.
Not a particularly nice solution, but this file is so full of bugs it
is difficult to fix anything really cleanly (e.g. it does a mallocz
and directly after a memcpy with the mallocz size, wtf??).
Index: ffmpeg/libavformat/oggparsevorbis.c
===================================================================
--- ffmpeg/libavformat/oggparsevorbis.c (revision 25928)
+++ ffmpeg/libavformat/oggparsevorbis.c (working copy)
@@ -212,12 +222,14 @@
 
     if (priv->packet[pkt_type>>1])
         return -1;
-    if (pkt_type > 1 && !priv->packet[0] || pkt_type > 3 && !priv->packet[1])
+    if (pkt_type > 1 && !priv->packet[0])
         return -1;
 
+    if (pkt_type != 3) {
     priv->len[pkt_type >> 1] = os->psize;
     priv->packet[pkt_type >> 1] = av_mallocz(os->psize);
     memcpy(priv->packet[pkt_type >> 1], os->buf + os->pstart, os->psize);
+    }
     if (os->buf[os->pstart] == 1) {
         const uint8_t *p = os->buf + os->pstart + 7; /* skip "\001vorbis" tag */
         unsigned blocksize, bs0, bs1;




More information about the ffmpeg-devel mailing list