Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2011-01-31 22:16:38 +0300
committerMichael Niedermayer <michaelni@gmx.at>2011-02-02 05:40:48 +0300
commit403fa3cf07db6aba070eef262f10d0616088025f (patch)
tree224844988a2befab970c37fac2bb32809c1ad4de /libavformat/oggparsevorbis.c
parente98b8e2f2fae3e75f87d0d87098a8faee691a514 (diff)
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 8cb3c557a9f3b24bc55325e3f64a2150b983305c)
Diffstat (limited to 'libavformat/oggparsevorbis.c')
-rw-r--r--libavformat/oggparsevorbis.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index d743d25e2d..34ae2fc4f0 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -256,8 +256,16 @@ vorbis_header (AVFormatContext * s, int idx)
st->time_base.den = srate;
}
} 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 {
st->codec->extradata_size =
fixup_vorbis_headers(s, priv, &st->codec->extradata);