Mercurial > libavcodec.hg
changeset 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 | 868650fc345a |
files | h263.c h263dec.c mpegvideo.h |
diffstat | 3 files changed, 15 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/h263.c Thu Mar 20 01:00:57 2003 +0000 +++ b/h263.c Thu Mar 20 17:52:30 2003 +0000 @@ -4566,6 +4566,7 @@ int i; int e; int ver, build, ver2, ver3; + char last; buf[0]= show_bits(gb, 8); for(i=1; i<256; i++){ @@ -4574,16 +4575,21 @@ skip_bits(gb, 8); } buf[255]=0; - + /* divx detection */ - e=sscanf(buf, "DivX%dBuild%d", &ver, &build); - if(e!=2) - e=sscanf(buf, "DivX%db%d", &ver, &build); - if(e==2){ + e=sscanf(buf, "DivX%dBuild%d%c", &ver, &build, &last); + if(e<2) + e=sscanf(buf, "DivX%db%d%c", &ver, &build, &last); + if(e>=2){ s->divx_version= ver; s->divx_build= build; + s->divx_packed= e==3 && last=='p'; if(s->picture_number==0){ - printf("This file was encoded with DivX%d Build%d\n", ver, build); + printf("This file was encoded with DivX%d Build%d", ver, build); + if(s->divx_packed) + printf("p\n"); + else + printf("\n"); } }
--- a/h263dec.c Thu Mar 20 01:00:57 2003 +0000 +++ b/h263dec.c Thu Mar 20 17:52:30 2003 +0000 @@ -128,7 +128,7 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size){ int pos= (get_bits_count(&s->gb)+7)>>3; - if(s->divx_version>=500){ + if(s->divx_packed){ //we would have to scan through the whole buf to handle the weird reordering ... return buf_size; }else if(s->flags&CODEC_FLAG_TRUNCATED){ @@ -675,7 +675,7 @@ } /* divx 5.01+ bistream reorder stuff */ - if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0 && s->divx_version>=500){ + if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0 && s->divx_packed){ int current_pos= get_bits_count(&s->gb)>>3; if( buf_size - current_pos > 5
--- a/mpegvideo.h Thu Mar 20 01:00:57 2003 +0000 +++ b/mpegvideo.h Thu Mar 20 17:52:30 2003 +0000 @@ -499,6 +499,7 @@ /* divx specific, used to workaround (many) bugs in divx5 */ int divx_version; int divx_build; + int divx_packed; #define BITSTREAM_BUFFER_SIZE 1024*256 uint8_t *bitstream_buffer; //Divx 5.01 puts several frames in a single one, this is used to reorder them int bitstream_buffer_size;