Mercurial > mplayer.hg
annotate libmpcodecs/vd_qtvideo.c @ 12250:4726cde0776e
missing names
author | diego |
---|---|
date | Thu, 22 Apr 2004 12:14:52 +0000 |
parents | 81f8e4f97b38 |
children | 6a61d694f7d3 |
rev | line source |
---|---|
8160 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 | |
4 #include "config.h" | |
5 | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
6 #if defined(USE_QTX_CODECS) || defined(MACOSX) |
8160 | 7 |
8 #include "mp_msg.h" | |
9 #include "vd_internal.h" | |
10 | |
9405
a4444e7ee56a
real cygwin support by Sascha Sommer <saschasommer@freenet.de>
alex
parents:
8473
diff
changeset
|
11 #ifdef WIN32_LOADER |
8451 | 12 #include "ldt_keeper.h" |
13 #endif | |
14 | |
8160 | 15 static vd_info_t info = { |
16 "Quicktime Video decoder", | |
17 "qtvideo", | |
18 "A'rpi", | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
19 "Sascha Sommer", |
8160 | 20 "win32" |
21 }; | |
22 | |
23 LIBVD_EXTERN(qtvideo) | |
24 | |
8282 | 25 #include "../bswap.h" |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
26 |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
27 #ifdef MACOSX |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
28 #include <QuickTime/ImageCodec.h> |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
29 #define dump_ImageDescription(x) |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
30 #else |
8270 | 31 #include "qtx/qtxsdk/components.h" |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
32 #endif |
8160 | 33 |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
34 #ifdef USE_QTX_CODECS |
8160 | 35 //#include "wine/windef.h" |
36 | |
37 HMODULE WINAPI LoadLibraryA(LPCSTR); | |
38 FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR); | |
39 int WINAPI FreeLibrary(HMODULE); | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
40 #endif |
8160 | 41 |
42 //static ComponentDescription desc; // for FindNextComponent() | |
43 static ComponentInstance ci=NULL; // codec handle | |
44 //static CodecInfo cinfo; // for ImageCodecGetCodecInfo() | |
45 //Component prev=NULL; | |
46 //ComponentResult cres; // | |
47 static CodecCapabilities codeccap; // for decpar | |
48 static CodecDecompressParams decpar; // for ImageCodecPreDecompress() | |
49 //static ImageSubCodecDecompressCapabilities icap; // for ImageCodecInitialize() | |
50 static Rect OutBufferRect; //the dimensions of our GWorld | |
51 | |
52 static GWorldPtr OutBufferGWorld = NULL;//a GWorld is some kind of description for a drawing environment | |
53 static ImageDescriptionHandle framedescHandle; | |
54 //static HINSTANCE qtml_dll; | |
55 static HMODULE handler; | |
56 | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
57 #ifdef USE_QTX_CODECS |
8160 | 58 static Component (*FindNextComponent)(Component prev,ComponentDescription* desc); |
59 static OSErr (*GetComponentInfo)(Component prev,ComponentDescription* desc,Handle h1,Handle h2,Handle h3); | |
60 static long (*CountComponents)(ComponentDescription* desc); | |
61 static OSErr (*InitializeQTML)(long flags); | |
62 static OSErr (*EnterMovies)(void); | |
63 static ComponentInstance (*OpenComponent)(Component c); | |
64 static ComponentResult (*ImageCodecInitialize)(ComponentInstance ci, | |
65 ImageSubCodecDecompressCapabilities * cap); | |
66 static ComponentResult (*ImageCodecBeginBand)(ComponentInstance ci, | |
67 CodecDecompressParams * params, | |
68 ImageSubCodecDecompressRecord * drp, | |
69 long flags); | |
70 static ComponentResult (*ImageCodecDrawBand)(ComponentInstance ci, | |
71 ImageSubCodecDecompressRecord * drp); | |
72 static ComponentResult (*ImageCodecEndBand)(ComponentInstance ci, | |
73 ImageSubCodecDecompressRecord * drp, | |
74 OSErr result, | |
75 long flags); | |
76 static ComponentResult (*ImageCodecGetCodecInfo)(ComponentInstance ci, | |
77 CodecInfo * info); | |
78 static ComponentResult (*ImageCodecPreDecompress)(ComponentInstance ci, | |
79 CodecDecompressParams * params); | |
80 static ComponentResult (*ImageCodecBandDecompress)(ComponentInstance ci, | |
81 CodecDecompressParams * params); | |
82 static PixMapHandle (*GetGWorldPixMap)(GWorldPtr offscreenGWorld); | |
83 static OSErr (*QTNewGWorldFromPtr)(GWorldPtr *gw, | |
84 OSType pixelFormat, | |
85 const Rect *boundsRect, | |
86 CTabHandle cTable, | |
87 /*GDHandle*/void* aGDevice, //unused anyway | |
88 GWorldFlags flags, | |
89 void *baseAddr, | |
90 long rowBytes); | |
91 static OSErr (*NewHandleClear)(Size byteCount); | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
92 #endif |
8160 | 93 |
94 // to set/get/query special features/parameters | |
95 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
96 return CONTROL_UNKNOWN; | |
97 } | |
98 | |
99 static int codec_inited=0; | |
100 | |
101 // init driver | |
102 static int init(sh_video_t *sh){ | |
103 long result = 1; | |
104 ComponentResult cres; | |
105 ComponentDescription desc; | |
106 Component prev=NULL; | |
107 CodecInfo cinfo; // for ImageCodecGetCodecInfo() | |
108 ImageSubCodecDecompressCapabilities icap; // for ImageCodecInitialize() | |
109 | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
110 #ifdef MACOSX |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
111 EnterMovies(); |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
112 #else |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
113 |
9405
a4444e7ee56a
real cygwin support by Sascha Sommer <saschasommer@freenet.de>
alex
parents:
8473
diff
changeset
|
114 #ifdef WIN32_LOADER |
8270 | 115 Setup_LDT_Keeper(); |
116 #endif | |
117 | |
8160 | 118 handler = LoadLibraryA("qtmlClient.dll"); |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
119 if(!handler){ |
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
120 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"unable to load qtmlClient.dll\n"); |
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
121 return 0; |
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
122 } |
8160 | 123 |
8451 | 124 InitializeQTML = (OSErr (*)(long))GetProcAddress(handler, "InitializeQTML"); |
125 EnterMovies = (OSErr (*)(void))GetProcAddress(handler, "EnterMovies"); | |
126 FindNextComponent = (Component (*)(Component,ComponentDescription*))GetProcAddress(handler, "FindNextComponent"); | |
127 CountComponents = (long (*)(ComponentDescription*))GetProcAddress(handler, "CountComponents"); | |
128 GetComponentInfo = (OSErr (*)(Component,ComponentDescription*,Handle,Handle,Handle))GetProcAddress(handler, "GetComponentInfo"); | |
129 OpenComponent = (ComponentInstance (*)(Component))GetProcAddress(handler, "OpenComponent"); | |
130 ImageCodecInitialize = (ComponentResult (*)(ComponentInstance,ImageSubCodecDecompressCapabilities *))GetProcAddress(handler, "ImageCodecInitialize"); | |
131 ImageCodecGetCodecInfo = (ComponentResult (*)(ComponentInstance,CodecInfo *))GetProcAddress(handler, "ImageCodecGetCodecInfo"); | |
132 ImageCodecBeginBand = (ComponentResult (*)(ComponentInstance,CodecDecompressParams *,ImageSubCodecDecompressRecord *,long))GetProcAddress(handler, "ImageCodecBeginBand"); | |
133 ImageCodecPreDecompress = (ComponentResult (*)(ComponentInstance,CodecDecompressParams *))GetProcAddress(handler, "ImageCodecPreDecompress"); | |
134 ImageCodecBandDecompress = (ComponentResult (*)(ComponentInstance,CodecDecompressParams *))GetProcAddress(handler, "ImageCodecBandDecompress"); | |
135 GetGWorldPixMap = (PixMapHandle (*)(GWorldPtr))GetProcAddress(handler, "GetGWorldPixMap"); | |
136 QTNewGWorldFromPtr = (OSErr(*)(GWorldPtr *,OSType,const Rect *,CTabHandle,void*,GWorldFlags,void *,long))GetProcAddress(handler, "QTNewGWorldFromPtr"); | |
137 NewHandleClear = (OSErr(*)(Size))GetProcAddress(handler, "NewHandleClear"); | |
8160 | 138 // = GetProcAddress(handler, ""); |
139 | |
140 if(!InitializeQTML || !EnterMovies || !FindNextComponent || !ImageCodecBandDecompress){ | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
141 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"invalid qtmlClient.dll!\n"); |
8160 | 142 return 0; |
143 } | |
144 | |
8162
98951b7331e1
no need to EnterMovies(), do minimal InitializeQTML only
arpi
parents:
8160
diff
changeset
|
145 result=InitializeQTML(6+16); |
98951b7331e1
no need to EnterMovies(), do minimal InitializeQTML only
arpi
parents:
8160
diff
changeset
|
146 // result=InitializeQTML(0); |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
147 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"InitializeQTML returned %i\n",result); |
8162
98951b7331e1
no need to EnterMovies(), do minimal InitializeQTML only
arpi
parents:
8160
diff
changeset
|
148 // result=EnterMovies(); |
98951b7331e1
no need to EnterMovies(), do minimal InitializeQTML only
arpi
parents:
8160
diff
changeset
|
149 // printf("EnterMovies->%d\n",result); |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
150 #endif /* !MACOSX */ |
8160 | 151 |
8428 | 152 #if 0 |
153 memset(&desc,0,sizeof(desc)); | |
154 while((prev=FindNextComponent(prev,&desc))){ | |
155 ComponentDescription desc2; | |
156 unsigned char* c1=&desc2.componentType; | |
157 unsigned char* c2=&desc2.componentSubType; | |
158 memset(&desc2,0,sizeof(desc2)); | |
159 // printf("juhee %p (%p)\n",prev,&desc); | |
160 GetComponentInfo(prev,&desc2,NULL,NULL,NULL); | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
161 mp_msg(MSGT_DECVIDEO,MSGL_DGB2,"DESC: %c%c%c%c/%c%c%c%c [0x%X/0x%X] 0x%X\n", |
8428 | 162 c1[3],c1[2],c1[1],c1[0], |
163 c2[3],c2[2],c2[1],c2[0], | |
164 desc2.componentType,desc2.componentSubType, | |
165 desc2.componentFlags); | |
166 } | |
167 #endif | |
168 | |
169 | |
8160 | 170 memset(&desc,0,sizeof(desc)); |
171 desc.componentType= (((unsigned char)'i')<<24)| | |
172 (((unsigned char)'m')<<16)| | |
173 (((unsigned char)'d')<<8)| | |
174 (((unsigned char)'c')); | |
8282 | 175 #if 0 |
8160 | 176 desc.componentSubType= |
177 (((unsigned char)'S'<<24))| | |
178 (((unsigned char)'V')<<16)| | |
179 (((unsigned char)'Q')<<8)| | |
180 (((unsigned char)'3')); | |
8282 | 181 #else |
182 desc.componentSubType = bswap_32(sh->format); | |
183 #endif | |
8160 | 184 desc.componentManufacturer=0; |
185 desc.componentFlags=0; | |
186 desc.componentFlagsMask=0; | |
187 | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
188 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Count = %d\n",CountComponents(&desc)); |
8160 | 189 prev=FindNextComponent(NULL,&desc); |
190 if(!prev){ | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
191 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Cannot find requested component\n"); |
8282 | 192 return(0); |
8160 | 193 } |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
194 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Found it! ID = 0x%X\n",prev); |
8160 | 195 |
196 ci=OpenComponent(prev); | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
197 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ci=%p\n",ci); |
8160 | 198 |
199 memset(&icap,0,sizeof(icap)); | |
200 cres=ImageCodecInitialize(ci,&icap); | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
201 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecInitialize->%p size=%d (%d)\n",cres,icap.recordSize,icap.decompressRecordSize); |
8160 | 202 |
203 memset(&cinfo,0,sizeof(cinfo)); | |
204 cres=ImageCodecGetCodecInfo(ci,&cinfo); | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
205 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Flags: compr: 0x%X decomp: 0x%X format: 0x%X\n", |
8160 | 206 cinfo.compressFlags, cinfo.decompressFlags, cinfo.formatFlags); |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
207 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Codec name: %.*s\n",((unsigned char*)&cinfo.typeName)[0], |
8160 | 208 ((unsigned char*)&cinfo.typeName)+1); |
209 | |
210 //make a yuy2 gworld | |
211 OutBufferRect.top=0; | |
212 OutBufferRect.left=0; | |
213 OutBufferRect.right=sh->disp_w; | |
214 OutBufferRect.bottom=sh->disp_h; | |
215 | |
216 //Fill the imagedescription for our SVQ3 frame | |
217 //we can probably get this from Demuxer | |
218 #if 0 | |
219 framedescHandle=(ImageDescriptionHandle)NewHandleClear(sizeof(ImageDescription)+200); | |
220 printf("framedescHandle=%p *p=%p\n",framedescHandle,*framedescHandle); | |
221 { FILE* f=fopen("/root/.wine/fake_windows/IDesc","r"); | |
222 if(!f) printf("filenot found: IDesc\n"); | |
223 fread(*framedescHandle,sizeof(ImageDescription)+200,1,f); | |
224 fclose(f); | |
225 } | |
226 #else | |
8471 | 227 if(!sh->ImageDesc) sh->ImageDesc=(sh->bih+1); // hack for SVQ3-in-AVI |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
228 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageDescription size: %d\n",((ImageDescription*)(sh->ImageDesc))->idSize); |
8301 | 229 framedescHandle=(ImageDescriptionHandle)NewHandleClear(((ImageDescription*)(sh->ImageDesc))->idSize); |
230 memcpy(*framedescHandle,sh->ImageDesc,((ImageDescription*)(sh->ImageDesc))->idSize); | |
8471 | 231 dump_ImageDescription(*framedescHandle); |
8160 | 232 #endif |
233 //Find codecscomponent for video decompression | |
234 // result = FindCodec ('SVQ1',anyCodec,&compressor,&decompressor ); | |
235 // printf("FindCodec SVQ1 returned:%i compressor: 0x%X decompressor: 0x%X\n",result,compressor,decompressor); | |
236 | |
8282 | 237 sh->context = kYUVSPixelFormat; |
8301 | 238 #if 1 |
8282 | 239 { |
240 int imgfmt = sh->codec->outfmt[sh->outfmtidx]; | |
241 int qt_imgfmt; | |
242 switch(imgfmt) | |
243 { | |
244 case IMGFMT_YUY2: | |
245 qt_imgfmt = kYUVSPixelFormat; | |
246 break; | |
247 case IMGFMT_YVU9: | |
8301 | 248 qt_imgfmt = 0x73797639; //kYVU9PixelFormat; |
249 break; | |
250 case IMGFMT_YV12: | |
251 qt_imgfmt = 0x79343230; | |
8282 | 252 break; |
253 case IMGFMT_UYVY: | |
254 qt_imgfmt = kUYVY422PixelFormat; | |
255 break; | |
256 case IMGFMT_YVYU: | |
257 qt_imgfmt = kYVYU422PixelFormat; | |
258 imgfmt = IMGFMT_YUY2; | |
259 break; | |
260 case IMGFMT_RGB16: | |
261 qt_imgfmt = k16LE555PixelFormat; | |
262 break; | |
263 case IMGFMT_BGR24: | |
264 qt_imgfmt = k24BGRPixelFormat; | |
265 break; | |
266 case IMGFMT_BGR32: | |
267 qt_imgfmt = k32BGRAPixelFormat; | |
268 break; | |
269 case IMGFMT_RGB32: | |
270 qt_imgfmt = k32RGBAPixelFormat; | |
271 break; | |
272 default: | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
273 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unknown requested csp\n"); |
8282 | 274 return(0); |
275 } | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
276 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"imgfmt: %s qt_imgfmt: %.4s\n", vo_format_name(imgfmt), &qt_imgfmt); |
8282 | 277 sh->context = qt_imgfmt; |
278 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,imgfmt)) return 0; | |
279 } | |
280 #else | |
8160 | 281 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; |
8282 | 282 #endif |
8160 | 283 |
284 return 1; | |
285 } | |
286 | |
287 // uninit driver | |
288 static void uninit(sh_video_t *sh){ | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
289 #ifdef MACOSX |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
290 ExitMovies(); |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
291 #endif |
8160 | 292 } |
293 | |
294 // decode a frame | |
295 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
296 long result = 1; | |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
297 int i; |
8160 | 298 mp_image_t* mpi; |
299 ComponentResult cres; | |
8473 | 300 |
301 if(len<=0) return NULL; // skipped frame | |
8160 | 302 |
303 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE, | |
304 sh->disp_w, sh->disp_h); | |
305 if(!mpi) return NULL; | |
306 | |
307 decpar.data = (char*)data; | |
308 decpar.bufferSize = len; | |
309 (**framedescHandle).dataSize=len; | |
310 | |
311 if(!codec_inited){ | |
312 result = QTNewGWorldFromPtr( | |
313 &OutBufferGWorld, | |
8282 | 314 // kYUVSPixelFormat, //pixel format of new GWorld == YUY2 |
315 sh->context, | |
8160 | 316 &OutBufferRect, //we should benchmark if yvu9 is faster for svq3, too |
317 0, | |
318 0, | |
319 0, | |
320 mpi->planes[0], | |
321 mpi->stride[0]); | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
322 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"NewGWorldFromPtr returned:%d\n",65536-(result&0xffff)); |
8282 | 323 // if (65536-(result&0xFFFF) != 10000) |
324 // return NULL; | |
8160 | 325 |
326 // printf("IDesc=%d\n",sizeof(ImageDescription)); | |
327 | |
328 decpar.imageDescription = framedescHandle; | |
329 decpar.startLine=0; | |
330 decpar.stopLine=(**framedescHandle).height; | |
331 decpar.frameNumber = 1; //1 | |
332 // decpar.conditionFlags=0xFFD; // first | |
333 // decpar.callerFlags=0x2001; // first | |
334 decpar.matrixFlags = 0; | |
335 decpar.matrixType = 0; | |
336 decpar.matrix = 0; | |
337 decpar.capabilities=&codeccap; | |
338 // decpar.accuracy = 0x1680000; //codecNormalQuality; | |
339 decpar.accuracy = codecNormalQuality; | |
8431 | 340 // decpar.port = OutBufferGWorld; |
8160 | 341 // decpar.preferredOffscreenPixelSize=17207; |
342 | |
343 // decpar.sequenceID=malloc(1000); | |
344 // memset(decpar.sequenceID,0,1000); | |
345 | |
346 // SrcRect.top=17207; | |
347 // SrcRect.left=0; | |
348 // SrcRect.right=0;//image_width; | |
349 // SrcRect.bottom=0;//image_height; | |
350 | |
351 // decpar.srcRect = SrcRect; | |
352 decpar.srcRect = OutBufferRect; | |
353 | |
354 decpar.transferMode = srcCopy; | |
355 decpar.dstPixMap = **GetGWorldPixMap( OutBufferGWorld);//destPixmap; | |
356 | |
357 cres=ImageCodecPreDecompress(ci,&decpar); | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
358 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecPreDecompress cres=0x%X\n",cres); |
8430 | 359 |
360 if(decpar.wantedDestinationPixelTypes) | |
361 { OSType *p=*(decpar.wantedDestinationPixelTypes); | |
362 if(p) while(*p){ | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
363 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"supported csp: 0x%08X %.4s\n",*p,p); |
8430 | 364 ++p; |
365 } | |
366 } | |
367 | |
8160 | 368 |
369 // decpar.conditionFlags=0x10FFF; // first | |
370 // decpar.preferredOffscreenPixelSize=17207; | |
371 | |
372 // decpar.conditionFlags=0x10FFD; // first | |
373 | |
374 // cres=ImageCodecPreDecompress(ci,&decpar); | |
375 // printf("ImageCodecPreDecompress cres=0x%X\n",cres); | |
376 | |
377 | |
378 codec_inited=1; | |
379 } | |
380 | |
381 #if 0 | |
382 if(decpar.frameNumber==124){ | |
383 decpar.frameNumber=1; | |
384 cres=ImageCodecPreDecompress(ci,&decpar); | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
385 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecPreDecompress cres=0x%X\n",cres); |
8160 | 386 } |
387 #endif | |
388 | |
389 cres=ImageCodecBandDecompress(ci,&decpar); | |
390 | |
391 ++decpar.frameNumber; | |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
392 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
393 if(cres&0xFFFF){ |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
394 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecBandDecompress cres=0x%X (-0x%X) %d\n",cres,-cres,cres); |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
395 return NULL; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
396 } |
8160 | 397 |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
398 // for(i=0;i<8;i++) |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
399 // printf("img_base[%d]=%p\n",i,((int*)decpar.dstPixMap.baseAddr)[i]); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
400 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
401 if((int)sh->context==0x73797639){ // Sorenson 16-bit YUV -> std YVU9 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
402 |
8451 | 403 short *src0=(short *)((char*)decpar.dstPixMap.baseAddr+0x20); |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
404 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
405 for(i=0;i<mpi->h;i++){ |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
406 int x; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
407 unsigned char* dst=mpi->planes[0]+i*mpi->stride[0]; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
408 unsigned short* src=src0+i*((mpi->w+15)&(~15)); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
409 for(x=0;x<mpi->w;x++) dst[x]=src[x]; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
410 } |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
411 src0+=((mpi->w+15)&(~15))*((mpi->h+15)&(~15)); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
412 for(i=0;i<mpi->h/4;i++){ |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
413 int x; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
414 unsigned char* dst=mpi->planes[1]+i*mpi->stride[1]; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
415 unsigned short* src=src0+i*(((mpi->w+63)&(~63))/4); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
416 for(x=0;x<mpi->w/4;x++) dst[x]=src[x]; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
417 src+=((mpi->w+63)&(~63))/4; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
418 } |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
419 src0+=(((mpi->w+63)&(~63))/4)*(((mpi->h+63)&(~63))/4); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
420 for(i=0;i<mpi->h/4;i++){ |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
421 int x; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
422 unsigned char* dst=mpi->planes[2]+i*mpi->stride[2]; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
423 unsigned short* src=src0+i*(((mpi->w+63)&(~63))/4); |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
424 for(x=0;x<mpi->w/4;x++) dst[x]=src[x]; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
425 src+=((mpi->w+63)&(~63))/4; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
426 } |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
427 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
428 } |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
429 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
430 |
8160 | 431 return mpi; |
432 } | |
433 #endif |