# HG changeset patch # User michaelni # Date 1019916647 0 # Node ID c2f789fe49455c9fff1abbb94f74a013a0a4a4fd # Parent e05b357a398a44adf4552dad4b3e9a5dadf122c5 detecting xvid/divx4/opendivx and set low_delay flag diff -r e05b357a398a -r c2f789fe4945 h263.c --- a/h263.c Sat Apr 27 13:12:57 2002 +0000 +++ b/h263.c Sat Apr 27 14:10:47 2002 +0000 @@ -2584,6 +2584,7 @@ { int time_incr, startcode, state, v; int time_increment; + int vol_control=-1; redo: /* search next start code */ @@ -2627,7 +2628,7 @@ skip_bits(&s->gb, 8); // par_height } - if(get_bits1(&s->gb)){ /* vol control parameter */ + if(vol_control=get_bits1(&s->gb)){ /* vol control parameter */ int chroma_format= get_bits(&s->gb, 2); if(chroma_format!=1){ printf("illegal chroma format\n"); @@ -2943,8 +2944,17 @@ } } } + /* detect buggy encoders which dont set the low_delay flag (divx4/xvid/opendivx)*/ + // note we cannot detect divx5 without b-frames easyly (allthough its buggy too) + if(s->vo_type==0 && vol_control==0 && s->divx_version==0){ + if(s->picture_number==0) + printf("looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n"); + s->low_delay=1; + } + s->picture_number++; // better than pic number==0 allways ;) //printf("done\n"); + return 0; }