From 43d7c6118d64a8b2772e2d9e0c13413968e776f1 Mon Sep 17 00:00:00 2001 From: Reimar Döffinger Date: Thu, 1 Oct 2009 15:40:29 +0000 Subject: 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 --- libavformat/mpegenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libavformat/mpegenc.c') diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index df4c9919a4..a471b38bb9 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -89,7 +89,7 @@ static int put_pack_header(AVFormatContext *ctx, init_put_bits(&pb, buf, 128); - put_bits(&pb, 32, PACK_START_CODE); + put_bits32(&pb, PACK_START_CODE); if (s->is_mpeg2) { put_bits(&pb, 2, 0x1); } else { @@ -125,7 +125,7 @@ static int put_system_header(AVFormatContext *ctx, uint8_t *buf,int only_for_str init_put_bits(&pb, buf, 128); - put_bits(&pb, 32, SYSTEM_HEADER_START_CODE); + put_bits32(&pb, SYSTEM_HEADER_START_CODE); put_bits(&pb, 16, 0); put_bits(&pb, 1, 1); -- cgit v1.2.3