changeset 30812:4c3685b029f7

Fix QuickTime emulated OSErr type. The OSErr type on Mac OS X is int16_t, not int32_t (see http://developer.apple.com/mac/library/documentation/QuickTime/Reference/QTRef_DataTypes/Reference/reference.html). The upper 16 bits will typically be something random (they're entirely undefined). Change the type so it's right; a few places tried to compensate for this by masking out the upper bits, but a few places also missed them, which made for unpredictable behavior.
author sesse
date Sat, 06 Mar 2010 11:12:32 +0000
parents 50e0f6942e43
children 87acb5d9e4aa
files libmpcodecs/vd_qtvideo.c libmpcodecs/ve_qtvideo.c loader/qtx/qtxsdk/components.h
diffstat 3 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_qtvideo.c	Sat Mar 06 10:13:37 2010 +0000
+++ b/libmpcodecs/vd_qtvideo.c	Sat Mar 06 11:12:32 2010 +0000
@@ -90,7 +90,7 @@
                                GWorldFlags flags,
                                void *baseAddr,
                                long rowBytes);
-static    OSErr           (*NewHandleClear)(Size byteCount);
+static    Handle          (*NewHandleClear)(Size byteCount);
 #endif /* #ifndef CONFIG_QUICKTIME */
 
 // to set/get/query special features/parameters
@@ -103,7 +103,7 @@
 // init driver
 static int init(sh_video_t *sh){
 #ifndef CONFIG_QUICKTIME
-    long result = 1;
+    OSErr result = 1;
 #endif
     ComponentResult cres;
     ComponentDescription desc;
@@ -156,7 +156,7 @@
 
     result=InitializeQTML(6+16);
 //    result=InitializeQTML(0);
-    mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"InitializeQTML returned %li\n",result);
+    mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"InitializeQTML returned %d\n",result);
 //    result=EnterMovies();
 //    printf("EnterMovies->%d\n",result);
 #endif /* CONFIG_QUICKTIME */
@@ -305,7 +305,7 @@
 
 // decode a frame
 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
-    long result = 1;
+    OSErr result = 1;
     int i;
     mp_image_t* mpi;
     ComponentResult cres;
@@ -335,7 +335,7 @@
         0,
         mpi->planes[0],
         mpi->stride[0]);
-    mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"NewGWorldFromPtr returned:%ld\n",65536-(result&0xffff));
+    mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"NewGWorldFromPtr returned:%d\n",result);
 //    if (65536-(result&0xFFFF) != 10000)
 //	return NULL;
 
@@ -406,7 +406,7 @@
 
     ++decpar.frameNumber;
 
-    if(cres&0xFFFF){
+    if(cres) {
 	mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecBandDecompress cres=0x%X (-0x%X) %d\n",cres,-cres,cres);
 	return NULL;
     }
--- a/libmpcodecs/ve_qtvideo.c	Sat Mar 06 10:13:37 2010 +0000
+++ b/libmpcodecs/ve_qtvideo.c	Sat Mar 06 11:12:32 2010 +0000
@@ -69,7 +69,7 @@
                         GWorldFlags flags,
                         void *baseAddr,
                         long rowBytes);
-static OSErr        (*NewHandleClear)(Size byteCount);
+static Handle       (*NewHandleClear)(Size byteCount);
 static OSErr        (*CompressSequenceBegin) (
      ImageSequence             *seqID,
      PixMapHandle              src,
--- a/loader/qtx/qtxsdk/components.h	Sat Mar 06 10:13:37 2010 +0000
+++ b/loader/qtx/qtxsdk/components.h	Sat Mar 06 11:12:32 2010 +0000
@@ -12,7 +12,7 @@
 typedef unsigned char                   Str31[32];
 typedef int32_t                         Fixed;
 
-typedef int32_t OSErr;
+typedef int16_t OSErr;
 typedef int OSType;
 
 typedef int32_t ComponentResult;