# HG changeset patch # User michael # Date 1076280755 0 # Node ID 920e6381e1fe0d9f536aa8f76ae36fa067262e67 # Parent d133b4ad0620f567d11f627248b1acb4f3379970 2 byte shorter userdata for mpeg4 in the past it was startcode,string,00,7F,startcode now it is startcode,string,stratcode both are mpeg4 compliant, as according to the standard the userdata lasts until the next 00 00 01 (startcode prefix) but some very primitive decoders which simply skip until the first 00 byte and then expect the next valid startcode might fail with the old variant, just a theory though (didnt test if quicktime can decode it now) diff -r d133b4ad0620 -r 920e6381e1fe common.c --- a/common.c Sun Feb 08 02:16:48 2004 +0000 +++ b/common.c Sun Feb 08 22:52:35 2004 +0000 @@ -104,13 +104,14 @@ #ifdef CONFIG_ENCODERS -void put_string(PutBitContext * pbc, char *s) +void put_string(PutBitContext * pbc, char *s, int put_zero) { while(*s){ put_bits(pbc, 8, *s); s++; } - put_bits(pbc, 8, 0); + if(put_zero) + put_bits(pbc, 8, 0); } /* bit input functions */ diff -r d133b4ad0620 -r 920e6381e1fe common.h --- a/common.h Sun Feb 08 02:16:48 2004 +0000 +++ b/common.h Sun Feb 08 22:52:35 2004 +0000 @@ -291,7 +291,7 @@ int put_bits_count(PutBitContext *s); void align_put_bits(PutBitContext *s); void flush_put_bits(PutBitContext *s); -void put_string(PutBitContext * pbc, char *s); +void put_string(PutBitContext * pbc, char *s, int put_zero); /* bit input */ @@ -1142,7 +1142,7 @@ #define STOP_TIMER(id) \ tend= rdtsc();\ -if(tcount<2 || tend - tstart < 4*tsum/tcount){\ +if(tcount<2 || tend - tstart < 8*tsum/tcount){\ tsum+= tend - tstart;\ tcount++;\ }else\ diff -r d133b4ad0620 -r 920e6381e1fe h263.c --- a/h263.c Sun Feb 08 02:16:48 2004 +0000 +++ b/h263.c Sun Feb 08 22:52:35 2004 +0000 @@ -2326,8 +2326,7 @@ if(!(s->flags & CODEC_FLAG_BITEXACT)){ put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, 0x1B2); /* user_data */ - put_string(&s->pb, LIBAVCODEC_IDENT); - ff_mpeg4_stuffing(&s->pb); + put_string(&s->pb, LIBAVCODEC_IDENT, 0); } } diff -r d133b4ad0620 -r 920e6381e1fe mjpeg.c --- a/mjpeg.c Sun Feb 08 02:16:48 2004 +0000 +++ b/mjpeg.c Sun Feb 08 22:52:35 2004 +0000 @@ -378,7 +378,7 @@ /* JFIF header */ put_marker(p, APP0); put_bits(p, 16, 16); - put_string(p, "JFIF"); /* this puts the trailing zero-byte too */ + put_string(p, "JFIF", 1); /* this puts the trailing zero-byte too */ put_bits(p, 16, 0x0201); /* v 1.02 */ put_bits(p, 8, 0); /* units type: 0 - aspect ratio */ put_bits(p, 16, s->avctx->sample_aspect_ratio.num); @@ -393,7 +393,7 @@ flush_put_bits(p); ptr = pbBufPtr(p); put_bits(p, 16, 0); /* patched later */ - put_string(p, LIBAVCODEC_IDENT); + put_string(p, LIBAVCODEC_IDENT, 1); size = strlen(LIBAVCODEC_IDENT)+3; ptr[0] = size >> 8; ptr[1] = size;