aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-09-26 22:37:33 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-09-26 22:37:33 +0000
commit7f2bdb62d48886c62aadfdf0c1890a44d935c56d (patch)
treed5fd77d50cca4a1dd53b5f985ad7abc579ae7a71 /libavcodec
parent5482970b4bab536c4cbc642dca8e0ef5e63094ff (diff)
downloadffmpeg-7f2bdb62d48886c62aadfdf0c1890a44d935c56d.tar.gz
automatically detect broken opendivx codec and workaround, so bug=1 shouldnt be needed anymore for mpeg4 files, if there still are files which need bug=1 then tell me ...
Originally committed as revision 973 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h263.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/libavcodec/h263.c b/libavcodec/h263.c
index 26ada36623..86a6f071ef 100644
--- a/libavcodec/h263.c
+++ b/libavcodec/h263.c
@@ -4147,8 +4147,9 @@ int mpeg4_decode_picture_header(MpegEncContext * s)
}
s->scalability= get_bits1(&s->gb);
- if(s->workaround_bugs==1) s->scalability=0;
+
if (s->scalability) {
+ GetBitContext bak= s->gb;
int dummy= s->hierachy_type= get_bits1(&s->gb);
int ref_layer_id= get_bits(&s->gb, 4);
int ref_layer_sampling_dir= get_bits1(&s->gb);
@@ -4157,6 +4158,17 @@ int mpeg4_decode_picture_header(MpegEncContext * s)
int v_sampling_factor_n= get_bits(&s->gb, 5);
int v_sampling_factor_m= get_bits(&s->gb, 5);
s->enhancement_type= get_bits1(&s->gb);
+
+ if( h_sampling_factor_n==0 || h_sampling_factor_m==0
+ || v_sampling_factor_n==0 || v_sampling_factor_m==0 || s->workaround_bugs==1){
+
+ fprintf(stderr, "illegal scalability header (VERY broken encoder), trying to workaround\n");
+ s->scalability=0;
+
+ s->gb= bak;
+ goto redo;
+ }
+
// bin shape stuff FIXME
printf("scalability not supported\n");
}