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

Måns Rullgård mans
Thu Jan 20 23:37:15 CET 2011


Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:

> 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;

Why are you changing this?

> +    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);
> +    }

IIRC there are apps which expect to find the metadata header in the
extradata in order to send it to libvorbis (which _insists_ on having
it).  This will break such apps unless a dummy metadata header is
inserted here instead.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list