Mercurial > libavcodec.hg
comparison h263dec.c @ 1145:79e8ed620b17 libavcodec
better non conformant divx packed bitstream detection, so unpacked (no b frames) divx MPEG4-ES streams can be read
author | michaelni |
---|---|
date | Thu, 20 Mar 2003 17:52:30 +0000 |
parents | 21c85c4ab2f0 |
children | d2fd27d01df8 |
comparison
equal
deleted
inserted
replaced
1144:21c85c4ab2f0 | 1145:79e8ed620b17 |
---|---|
126 * retunrs the number of bytes consumed for building the current frame | 126 * retunrs the number of bytes consumed for building the current frame |
127 */ | 127 */ |
128 static int get_consumed_bytes(MpegEncContext *s, int buf_size){ | 128 static int get_consumed_bytes(MpegEncContext *s, int buf_size){ |
129 int pos= (get_bits_count(&s->gb)+7)>>3; | 129 int pos= (get_bits_count(&s->gb)+7)>>3; |
130 | 130 |
131 if(s->divx_version>=500){ | 131 if(s->divx_packed){ |
132 //we would have to scan through the whole buf to handle the weird reordering ... | 132 //we would have to scan through the whole buf to handle the weird reordering ... |
133 return buf_size; | 133 return buf_size; |
134 }else if(s->flags&CODEC_FLAG_TRUNCATED){ | 134 }else if(s->flags&CODEC_FLAG_TRUNCATED){ |
135 pos -= s->parse_context.last_index; | 135 pos -= s->parse_context.last_index; |
136 if(pos<0) pos=0; // padding is not really read so this might be -1 | 136 if(pos<0) pos=0; // padding is not really read so this might be -1 |
673 if(msmpeg4_decode_ext_header(s, buf_size) < 0){ | 673 if(msmpeg4_decode_ext_header(s, buf_size) < 0){ |
674 s->error_status_table[s->mb_num-1]= AC_ERROR|DC_ERROR|MV_ERROR; | 674 s->error_status_table[s->mb_num-1]= AC_ERROR|DC_ERROR|MV_ERROR; |
675 } | 675 } |
676 | 676 |
677 /* divx 5.01+ bistream reorder stuff */ | 677 /* divx 5.01+ bistream reorder stuff */ |
678 if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0 && s->divx_version>=500){ | 678 if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0 && s->divx_packed){ |
679 int current_pos= get_bits_count(&s->gb)>>3; | 679 int current_pos= get_bits_count(&s->gb)>>3; |
680 | 680 |
681 if( buf_size - current_pos > 5 | 681 if( buf_size - current_pos > 5 |
682 && buf_size - current_pos < BITSTREAM_BUFFER_SIZE){ | 682 && buf_size - current_pos < BITSTREAM_BUFFER_SIZE){ |
683 int i; | 683 int i; |