changeset 8282:b2c8b627d598

some fixes
author alex
date Mon, 25 Nov 2002 18:04:19 +0000
parents 74f4c42e2317
children f73469b47ede
files libmpcodecs/vd_qtvideo.c
diffstat 1 files changed, 54 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_qtvideo.c	Mon Nov 25 17:43:40 2002 +0000
+++ b/libmpcodecs/vd_qtvideo.c	Mon Nov 25 18:04:19 2002 +0000
@@ -18,6 +18,7 @@
 
 LIBVD_EXTERN(qtvideo)
 
+#include "../bswap.h"
 #include "qtx/qtxsdk/components.h"
 
 //#include "wine/windef.h"
@@ -131,11 +132,15 @@
 			(((unsigned char)'m')<<16)|
 			(((unsigned char)'d')<<8)|
 			(((unsigned char)'c'));
+#if 0
     desc.componentSubType= 
 		    (((unsigned char)'S'<<24))|
 			(((unsigned char)'V')<<16)|
 			(((unsigned char)'Q')<<8)|
 			(((unsigned char)'3'));
+#else
+    desc.componentSubType = bswap_32(sh->format);
+#endif
     desc.componentManufacturer=0;
     desc.componentFlags=0;
     desc.componentFlagsMask=0;
@@ -144,6 +149,7 @@
 #if 0
     memset(&desc,0,sizeof(desc));
     while((prev=FindNextComponent(prev,&desc))){
+	ComponentDescription desc2;
 	unsigned char* c1=&desc2.componentType;
 	unsigned char* c2=&desc2.componentSubType;
 	memset(&desc2,0,sizeof(desc2));
@@ -160,7 +166,7 @@
     prev=FindNextComponent(NULL,&desc);
     if(!prev){
 	printf("Cannot find requested component\n");
-	exit(1);
+	return(0);
     }
     printf("Found it! ID = 0x%X\n",prev);
 
@@ -201,7 +207,49 @@
 //    result = FindCodec ('SVQ1',anyCodec,&compressor,&decompressor );                 
 //    printf("FindCodec SVQ1 returned:%i compressor: 0x%X decompressor: 0x%X\n",result,compressor,decompressor);
 
+    sh->context = kYUVSPixelFormat;
+#if 0
+    {
+	int imgfmt = sh->codec->outfmt[sh->outfmtidx];
+	int qt_imgfmt;
+    switch(imgfmt)
+    {
+	case IMGFMT_YUY2:
+	    qt_imgfmt = kYUVSPixelFormat;
+	    break;
+	case IMGFMT_YVU9:
+	    qt_imgfmt = kYVU9PixelFormat;
+	    break;
+	case IMGFMT_UYVY:
+	    qt_imgfmt = kUYVY422PixelFormat;
+	    break;
+	case IMGFMT_YVYU:
+	    qt_imgfmt = kYVYU422PixelFormat;
+	    imgfmt = IMGFMT_YUY2;
+	    break;
+	case IMGFMT_RGB16:
+	    qt_imgfmt = k16LE555PixelFormat;
+	    break;
+	case IMGFMT_BGR24:
+	    qt_imgfmt = k24BGRPixelFormat;
+	    break;
+	case IMGFMT_BGR32:
+	    qt_imgfmt = k32BGRAPixelFormat;
+	    break;
+	case IMGFMT_RGB32:
+	    qt_imgfmt = k32RGBAPixelFormat;
+	    break;
+	default:
+	    printf("Unknown requested csp\n");
+	    return(0);    
+    }
+    printf("imgfmt: %s qt_imgfmt: %.4s\n", vo_format_name(imgfmt), &qt_imgfmt);
+    sh->context = qt_imgfmt;
+    if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,imgfmt)) return 0;
+    }
+#else
     if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0;
+#endif
 
     return 1;
 }
@@ -227,14 +275,17 @@
 if(!codec_inited){
     result = QTNewGWorldFromPtr(
         &OutBufferGWorld,  
-        kYUVSPixelFormat, //pixel format of new GWorld == YUY2
+//        kYUVSPixelFormat, //pixel format of new GWorld == YUY2
+	sh->context,
         &OutBufferRect,   //we should benchmark if yvu9 is faster for svq3, too
         0, 
         0, 
         0, 
         mpi->planes[0],
         mpi->stride[0]);
-    printf("NewGWorldFromPtr returned:%i\n",result);
+    printf("NewGWorldFromPtr returned:%d\n",65536-(result&0xffff));
+//    if (65536-(result&0xFFFF) != 10000)
+//	return NULL;
 
 //    printf("IDesc=%d\n",sizeof(ImageDescription));