changeset 31860:32a214ee10e5

Restore hunk previously removed in r31354. This fixes a crash with http://samples.mplayerhq.hu/MPEG2/libmpeg2-crash.vob
author diego
date Fri, 06 Aug 2010 23:44:31 +0000
parents 44f8d08901fe
children ec2388db0566
files libmpeg2/decode.c libmpeg2/libmpeg2_changes.diff
diffstat 2 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpeg2/decode.c	Fri Aug 06 23:31:39 2010 +0000
+++ b/libmpeg2/decode.c	Fri Aug 06 23:44:31 2010 +0000
@@ -345,6 +345,13 @@
     fbuf->buf[1] = buf[1];
     fbuf->buf[2] = buf[2];
     fbuf->id = id;
+    // HACK! FIXME! At first I frame, copy pointers to prediction frame too!
+    if (mpeg2dec->custom_fbuf && !mpeg2dec->fbuf[1]->buf[0]) {
+	mpeg2dec->fbuf[1]->buf[0] = buf[0];
+	mpeg2dec->fbuf[1]->buf[1] = buf[1];
+	mpeg2dec->fbuf[1]->buf[2] = buf[2];
+	mpeg2dec->fbuf[1]->id     = NULL;
+    }
 }
 
 void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf)
--- a/libmpeg2/libmpeg2_changes.diff	Fri Aug 06 23:31:39 2010 +0000
+++ b/libmpeg2/libmpeg2_changes.diff	Fri Aug 06 23:44:31 2010 +0000
@@ -128,7 +128,7 @@
  	mpeg2_cpu_state_restore = state_restore_altivec;
 --- libmpeg2/header.c	2006-06-16 20:12:26.000000000 +0200
 +++ libmpeg2/header.c	2006-06-16 20:12:50.000000000 +0200
-@@ -872,6 +879,7 @@
+@@ -872,6 +876,7 @@
  	mpeg2dec->scaled[idx] = decoder->q_scale_type;
  	for (i = 0; i < 32; i++) {
  	    k = decoder->q_scale_type ? non_linear_scale[i] : (i << 1);
@@ -355,7 +355,7 @@
  };
 
  typedef struct {
-@@ -226,7 +238,7 @@
+@@ -226,7 +235,7 @@
  };
 
  typedef struct {
@@ -399,3 +399,19 @@
      decoder->offset += 16;						\
      if (decoder->offset == decoder->width) {				\
  	do { /* just so we can use the break statement */		\
+--- libmpeg2/decode.c	(revision 31938)
++++ libmpeg2/decode.c	(working copy)
+@@ -345,6 +345,13 @@
+     fbuf->buf[1] = buf[1];
+     fbuf->buf[2] = buf[2];
+     fbuf->id = id;
++    // HACK! FIXME! At first I frame, copy pointers to prediction frame too!
++    if (mpeg2dec->custom_fbuf && !mpeg2dec->fbuf[1]->buf[0]) {
++	mpeg2dec->fbuf[1]->buf[0] = buf[0];
++	mpeg2dec->fbuf[1]->buf[1] = buf[1];
++	mpeg2dec->fbuf[1]->buf[2] = buf[2];
++	mpeg2dec->fbuf[1]->id     = NULL;
++    }
+ }
+ 
+ void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf)