Browse Source

Ogg: discard non-essential metadata from Vorbis header when creating extradata

The first part of the metadata, the "vendor" string, is required by
libvorbis, it will refuse to play when it is not available.
Also we do not currently parse that part into metadata so it would also
be lost if we removed it as well.

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 8cb3c557a9)
tags/n0.8
Reimar Döffinger Michael Niedermayer 15 years ago
parent
commit
403fa3cf07
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      libavformat/oggparsevorbis.c

+ 10
- 2
libavformat/oggparsevorbis.c View File

@@ -256,8 +256,16 @@ vorbis_header (AVFormatContext * s, int idx)
st->time_base.den = srate; st->time_base.den = srate;
} }
} else if (os->buf[os->pstart] == 3) { } else if (os->buf[os->pstart] == 3) {
if (os->psize > 8)
ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8);
if (os->psize > 8 &&
ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8) >= 0) {
// drop all metadata we parsed and which is not required by libvorbis
unsigned new_len = 7 + 4 + AV_RL32(priv->packet[1] + 7) + 4 + 1;
if (new_len >= 16 && new_len < os->psize) {
AV_WL32(priv->packet[1] + new_len - 5, 0);
priv->packet[1][new_len - 1] = 1;
priv->len[1] = new_len;
}
}
} else { } else {
st->codec->extradata_size = st->codec->extradata_size =
fixup_vorbis_headers(s, priv, &st->codec->extradata); fixup_vorbis_headers(s, priv, &st->codec->extradata);


Loading…
Cancel
Save