diff mpegenc.c @ 5244:8c0b5c6d0f17 libavformat

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.
author reimar
date Thu, 01 Oct 2009 15:40:29 +0000
parents 573d181e477c
children 536e5527c1e0
line wrap: on
line diff
--- a/mpegenc.c	Thu Oct 01 10:24:02 2009 +0000
+++ b/mpegenc.c	Thu Oct 01 15:40:29 2009 +0000
@@ -89,7 +89,7 @@
 
     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 @@
 
     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);