aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vorbis_enc.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-10-01 15:40:29 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-10-01 15:40:29 +0000
commit43d7c6118d64a8b2772e2d9e0c13413968e776f1 (patch)
treef5e7d4b37da6f22275c2cad19b404ee0e5dba362 /libavcodec/vorbis_enc.c
parentec656755044d29e8f0b0a50ad1c9fd297bcae484 (diff)
downloadffmpeg-43d7c6118d64a8b2772e2d9e0c13413968e776f1.tar.gz
put_bits can only reliably write up to 31 bit bits, above it relies on
undefined shift behaviour. Document this, fix the assert and add a put_bits32 to handle writing 32 bits and use that where necessary. Originally committed as revision 20124 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vorbis_enc.c')
-rw-r--r--libavcodec/vorbis_enc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c
index 508a4f3fa3..61f78b576f 100644
--- a/libavcodec/vorbis_enc.c
+++ b/libavcodec/vorbis_enc.c
@@ -386,7 +386,7 @@ static void put_float(PutBitContext *pb, float f)
mant = -mant;
}
res |= mant | (exp << 21);
- put_bits(pb, 32, res);
+ put_bits32(pb, res);
}
static void put_codebook_header(PutBitContext *pb, vorbis_enc_codebook *cb)
@@ -531,12 +531,12 @@ static int put_main_header(vorbis_enc_context *venc, uint8_t **out)
init_put_bits(&pb, p, buffer_len);
put_bits(&pb, 8, 1); //magic
ff_put_string(&pb, "vorbis", 0);
- put_bits(&pb, 32, 0); // version
+ put_bits32(&pb, 0); // version
put_bits(&pb, 8, venc->channels);
- put_bits(&pb, 32, venc->sample_rate);
- put_bits(&pb, 32, 0); // bitrate
- put_bits(&pb, 32, 0); // bitrate
- put_bits(&pb, 32, 0); // bitrate
+ put_bits32(&pb, venc->sample_rate);
+ put_bits32(&pb, 0); // bitrate
+ put_bits32(&pb, 0); // bitrate
+ put_bits32(&pb, 0); // bitrate
put_bits(&pb, 4, venc->log2_blocksize[0]);
put_bits(&pb, 4, venc->log2_blocksize[1]);
put_bits(&pb, 1, 1); // framing
@@ -550,8 +550,8 @@ static int put_main_header(vorbis_enc_context *venc, uint8_t **out)
init_put_bits(&pb, p, buffer_len);
put_bits(&pb, 8, 3); //magic
ff_put_string(&pb, "vorbis", 0);
- put_bits(&pb, 32, 0); // vendor length TODO
- put_bits(&pb, 32, 0); // amount of comments
+ put_bits32(&pb, 0); // vendor length TODO
+ put_bits32(&pb, 0); // amount of comments
put_bits(&pb, 1, 1); // framing
flush_put_bits(&pb);