summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/h263.c18
-rw-r--r--libavcodec/h263dec.c4
-rw-r--r--libavcodec/mpegvideo.h1
3 files changed, 15 insertions, 8 deletions
diff --git a/libavcodec/h263.c b/libavcodec/h263.c
index b9b94efc9c..76a421a707 100644
--- a/libavcodec/h263.c
+++ b/libavcodec/h263.c
@@ -4566,6 +4566,7 @@ static int decode_user_data(MpegEncContext *s, GetBitContext *gb){
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 @@ static int decode_user_data(MpegEncContext *s, GetBitContext *gb){
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");
}
}
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 9c2d26b9b6..2b9443908b 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -128,7 +128,7 @@ int ff_h263_decode_end(AVCodecContext *avctx)
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 @@ retry:
}
/* 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
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 83ae0f1697..ab2dd5176c 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -499,6 +499,7 @@ typedef struct MpegEncContext {
/* 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;