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