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