comparison loader/vfl.c @ 7385:e2fcdd7608b1

- updated to use new stype ICopen (filename passed in the icopen struct) - ICSendMessage now calls SendDriverMessage instead of re-implementing it - simplified teh WINE_HIC mess - removed some unused and broken func, like ICLocate
author arpi
date Fri, 13 Sep 2002 19:42:33 +0000
parents ce45cce7f7a5
children f5537cc95b02
comparison
equal deleted inserted replaced
7384:114d0da0258b 7385:e2fcdd7608b1
17 #include "wine/winestring.h" 17 #include "wine/winestring.h"
18 #include "wine/driver.h" 18 #include "wine/driver.h"
19 #include "wine/avifmt.h" 19 #include "wine/avifmt.h"
20 #include "driver.h" 20 #include "driver.h"
21 21
22
23 #define FIXME_(X) printf
24 #define FIXME printf
25
26 #define OpenDriverA DrvOpen 22 #define OpenDriverA DrvOpen
27 #define CloseDriver DrvClose 23 #define CloseDriver DrvClose
28
29 long VFWAPI VideoForWindowsVersion(void);
30
31
32 #if 1
33 /*
34 * STORE_ALL/REST_ALL seems like an attempt to workaround problems due to
35 * WINAPI/no-WINAPI bustage.
36 *
37 * There should be no need for the STORE_ALL/REST_ALL hack once all
38 * function definitions agree with their prototypes (WINAPI-wise) and
39 * we make sure, that we do not call these functions without a proper
40 * prototype in scope.
41 */
42 #define STORE_ALL /**/
43 #define REST_ALL /**/
44 #else
45 #define STORE_ALL \
46 __asm__ ( \
47 "push %%ebx\n\t" \
48 "push %%ecx\n\t" \
49 "push %%edx\n\t" \
50 "push %%esi\n\t" \
51 "push %%edi\n\t"::)
52
53 #define REST_ALL \
54 __asm__ ( \
55 "pop %%edi\n\t" \
56 "pop %%esi\n\t" \
57 "pop %%edx\n\t" \
58 "pop %%ecx\n\t" \
59 "pop %%ebx\n\t"::)
60 #endif
61
62 24
63 /*********************************************************************** 25 /***********************************************************************
64 * VideoForWindowsVersion [MSVFW.2][MSVIDEO.2] 26 * VideoForWindowsVersion [MSVFW.2][MSVIDEO.2]
65 * Returns the version in major.minor form. 27 * Returns the version in major.minor form.
66 * In Windows95 this returns 0x040003b6 (4.950) 28 * In Windows95 this returns 0x040003b6 (4.950)
67 */ 29 */
68 long VideoForWindowsVersion(void) { 30 long VFWAPI VideoForWindowsVersion(void) {
69 return 0x040003B6; /* 4.950 */ 31 return 0x040003B6; /* 4.950 */
70 } 32 }
71 33
72 /* system.ini: [drivers] */ 34 /* system.ini: [drivers] */
73 35
80 ICInfo( 42 ICInfo(
81 long fccType, /* [in] type of compressor ('vidc') */ 43 long fccType, /* [in] type of compressor ('vidc') */
82 long fccHandler, /* [in] <n>th compressor */ 44 long fccHandler, /* [in] <n>th compressor */
83 ICINFO *lpicinfo /* [out] information about compressor */ 45 ICINFO *lpicinfo /* [out] information about compressor */
84 ) { 46 ) {
85 char type[5];
86
87 memcpy(type,&fccType,4);type[4]=0;
88
89 /* does OpenDriver/CloseDriver */ 47 /* does OpenDriver/CloseDriver */
90 lpicinfo->dwSize = sizeof(ICINFO); 48 lpicinfo->dwSize = sizeof(ICINFO);
91 lpicinfo->fccType = fccType; 49 lpicinfo->fccType = fccType;
92 lpicinfo->dwFlags = 0; 50 lpicinfo->dwFlags = 0;
93 /*
94 if (GetPrivateProfileStringA("drivers32",NULL,NULL,buf,2000,"system.ini")) {
95 char *s = buf;
96 while (*s) {
97 if (!lstrncmpiA(type,s,4)) {
98 if(!fccHandler--) {
99 lpicinfo->fccHandler = mmioStringToFOURCCA(s+5,0);
100 return TRUE;
101 }
102 }
103 s=s+lstrlenA(s)+1;
104 }
105 }
106 */
107 return TRUE; 51 return TRUE;
108 } 52 }
109 53
110 /*********************************************************************** 54 /***********************************************************************
111 * ICOpen [MSVFW.37] 55 * ICOpen [MSVFW.37]
112 * Opens an installable compressor. Return special handle. 56 * Opens an installable compressor. Return special handle.
113 */ 57 */
114 HIC VFWAPI 58 HIC VFWAPI
115 ICOpen(long fccType,long fccHandler,unsigned int wMode) { 59 //ICOpen(long fccType,long fccHandler,unsigned int wMode) {
116 char type[5],handler[5],codecname[20]; 60 ICOpen(long filename,long fccHandler,unsigned int wMode) {
117 ICOPEN icopen; 61 ICOPEN icopen;
118 HDRVR hdrv; 62 HDRVR hdrv;
119 WINE_HIC *whic; 63 WINE_HIC *whic;
120 64
121 memcpy(type,&fccType,4);type[4]=0;
122 memcpy(handler,&fccHandler,4);handler[4]=0;
123
124 snprintf(codecname,20,"%s.%s",type,handler);
125
126 /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the 65 /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the
127 * same layout as ICOPEN 66 * same layout as ICOPEN
128 */ 67 */
129 icopen.fccType = fccType; 68 icopen.fccType = 0x63646976; // "vidc" //fccType;
130 icopen.fccHandler = fccHandler; 69 icopen.fccHandler = fccHandler;
131 icopen.dwSize = sizeof(ICOPEN); 70 icopen.dwSize = sizeof(ICOPEN);
132 icopen.dwFlags = wMode; 71 icopen.dwFlags = wMode;
72 icopen.pV1Reserved = (void*)filename;
133 /* FIXME: do we need to fill out the rest too? */ 73 /* FIXME: do we need to fill out the rest too? */
134 // hdrv=OpenDriverA(codecname,"drivers32",(long)&icopen);
135 hdrv=OpenDriverA((long)&icopen); 74 hdrv=OpenDriverA((long)&icopen);
136 /* 75 if (!hdrv) return 0;
137 if (!hdrv) { 76 whic = (WINE_HIC*)malloc(sizeof(WINE_HIC));
138 if (!strcasecmp(type,"vids")) {
139 snprintf(codecname,20,"vidc.%s",handler);
140 fccType = mmioFOURCC('v','i','d','c');
141 }
142 // hdrv=OpenDriverA(codecname,"drivers32",(long)&icopen);
143 hdrv=OpenDriverA((long)&icopen);
144 */
145 if (!hdrv)
146 return 0;
147 // }
148 whic = (WINE_HIC*)my_mreq(sizeof(WINE_HIC), 0);
149 whic->hdrv = hdrv; 77 whic->hdrv = hdrv;
150 whic->driverproc= ((DRVR*)hdrv)->DriverProc; 78 whic->driverproc= ((DRVR*)hdrv)->DriverProc;
151 // whic->private = ICSendMessage((HIC)whic,DRV_OPEN,0,(long)&icopen); 79 // whic->private = ICSendMessage((HIC)whic,DRV_OPEN,0,(long)&icopen);
152 whic->private = ((DRVR*)hdrv)->dwDriverID; 80 whic->driverid = ((DRVR*)hdrv)->dwDriverID;
153 return (HIC)whic; 81 return (HIC)whic;
154 } 82 }
155
156 /***********************************************************************
157 * ICOpenFunction [MSVFW.38]
158 */
159 HIC VFWAPI ICOpenFunction(long fccType, long fccHandler, unsigned int wMode,
160 void* lpfnHandler) {
161 char type[5],handler[5];
162 HIC hic;
163 WINE_HIC *whic;
164
165 memcpy(type,&fccType,4);type[4]=0;
166 memcpy(handler,&fccHandler,4);handler[4]=0;
167 FIXME("(%s,%s,%d,%p), stub!\n",type,handler,wMode,lpfnHandler);
168 hic = ICOpen(fccType,fccHandler,wMode);
169 if (!hic)
170 return hic;
171 whic = (WINE_HIC*)hic;
172 whic->driverproc = (DRIVERPROC)lpfnHandler;
173 return hic;
174 }
175
176 83
177 /*********************************************************************** 84 /***********************************************************************
178 * ICGetInfo [MSVFW.30] 85 * ICGetInfo [MSVFW.30]
179 */ 86 */
180 LRESULT VFWAPI 87 LRESULT VFWAPI
182 LRESULT ret; 89 LRESULT ret;
183 90
184 ret = ICSendMessage(hic,ICM_GETINFO,(long)picinfo,cb); 91 ret = ICSendMessage(hic,ICM_GETINFO,(long)picinfo,cb);
185 92
186 return ret; 93 return ret;
187 }
188
189 /***********************************************************************
190 * ICLocate [MSVFW.35]
191 */
192 HIC VFWAPI
193 ICLocate(
194 long fccType, long fccHandler, LPBITMAPINFOHEADER lpbiIn,
195 LPBITMAPINFOHEADER lpbiOut, short wMode
196 ) {
197 char type[5],handler[5];
198 HIC hic;
199 long querymsg;
200
201 switch (wMode) {
202 case ICMODE_FASTCOMPRESS:
203 case ICMODE_COMPRESS:
204 querymsg = ICM_COMPRESS_QUERY;
205 break;
206 case ICMODE_DECOMPRESS:
207 case ICMODE_FASTDECOMPRESS:
208 querymsg = ICM_DECOMPRESS_QUERY;
209 break;
210 case ICMODE_DRAW:
211 querymsg = ICM_DRAW_QUERY;
212 break;
213 default:
214 FIXME("Unknown mode (%d)\n",wMode);
215 return 0;
216 }
217
218 /* Easy case: handler/type match, we just fire a query and return */
219 hic = ICOpen(fccType,fccHandler,wMode);
220 if (hic) {
221 if (!ICSendMessage(hic,querymsg,(long)lpbiIn,(long)lpbiOut))
222 return hic;
223 ICClose(hic);
224 }
225 type[4]='\0';memcpy(type,&fccType,4);
226 handler[4]='\0';memcpy(handler,&fccHandler,4);
227 if (fccType==streamtypeVIDEO) {
228 hic = ICLocate(ICTYPE_VIDEO,fccHandler,lpbiIn,lpbiOut,wMode);
229 if (hic)
230 return hic;
231 }
232 FIXME("(%s,%s,%p,%p,0x%04x),unhandled!\n",type,handler,lpbiIn,lpbiOut,wMode);
233 return 0;
234 } 94 }
235 95
236 /*********************************************************************** 96 /***********************************************************************
237 * ICCompress [MSVFW.23] 97 * ICCompress [MSVFW.23]
238 */ 98 */
274 icd.lpInput = lpData; 134 icd.lpInput = lpData;
275 135
276 icd.lpbiOutput = lpbi; 136 icd.lpbiOutput = lpbi;
277 icd.lpOutput = lpBits; 137 icd.lpOutput = lpBits;
278 icd.ckid = 0; 138 icd.ckid = 0;
279 STORE_ALL;
280 result=ICSendMessage(hic,ICM_DECOMPRESS,(long)&icd,sizeof(icd)); 139 result=ICSendMessage(hic,ICM_DECOMPRESS,(long)&icd,sizeof(icd));
281 REST_ALL;
282 return result; 140 return result;
283 } 141 }
284 142
285 /*********************************************************************** 143 /***********************************************************************
286 * ICDecompressEx [MSVFW.26] 144 * ICDecompressEx [MSVFW.26]
305 icd.xDst=icd.yDst=0; 163 icd.xDst=icd.yDst=0;
306 icd.dxDst=lpbi->biWidth; 164 icd.dxDst=lpbi->biWidth;
307 icd.dyDst=abs(lpbi->biHeight); 165 icd.dyDst=abs(lpbi->biHeight);
308 166
309 //icd.ckid = 0; 167 //icd.ckid = 0;
310 STORE_ALL;
311 result=ICSendMessage(hic,ICM_DECOMPRESSEX,(long)&icd,sizeof(icd)); 168 result=ICSendMessage(hic,ICM_DECOMPRESSEX,(long)&icd,sizeof(icd));
312 REST_ALL;
313 return result; 169 return result;
314 } 170 }
315 171
316 long VFWAPIV 172 long VFWAPIV
317 ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPBITMAPINFOHEADER lpbi) { 173 ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPBITMAPINFOHEADER lpbi) {
333 icd.xDst=icd.yDst=0; 189 icd.xDst=icd.yDst=0;
334 icd.dxDst=lpbi->biWidth; 190 icd.dxDst=lpbi->biWidth;
335 icd.dyDst=abs(lpbi->biHeight); 191 icd.dyDst=abs(lpbi->biHeight);
336 192
337 //icd.ckid = 0; 193 //icd.ckid = 0;
338 STORE_ALL;
339 result=ICSendMessage(hic,command,(long)&icd,sizeof(icd)); 194 result=ICSendMessage(hic,command,(long)&icd,sizeof(icd));
340 REST_ALL;
341 return result; 195 return result;
342 } 196 }
343 197
344 198
345 /*********************************************************************** 199 /***********************************************************************
346 * ICSendMessage [MSVFW.40] 200 * ICSendMessage [MSVFW.40]
347 */ 201 */
348 LRESULT VFWAPI 202 LRESULT VFWAPI
349 ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) { 203 ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) {
350 LRESULT ret; 204 WINE_HIC *whic = (WINE_HIC*)hic;
351 WINE_HIC *whic = (WINE_HIC*)hic; 205 return SendDriverMessage(whic->hdrv, msg, lParam1,lParam2);
352 char qw[200];
353
354 // printf("ICSendMessage.whic=%p\n",whic);
355
356 #if 0
357 __asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw));
358 #endif
359 STORE_ALL;
360 /*__asm__
361 (
362 "pushl %eax\n\t"
363 "movl $0xf,%eax\n\t"
364 "movw %ax, %fs\n\t"
365 "popl %eax\n\t"
366 );*/
367 ret = whic->driverproc(whic->private,1,msg,lParam1,lParam2);
368 REST_ALL;
369 #if 0
370 __asm__ __volatile__ ("frstor (%0)\n\t": :"r"(&qw));
371 #endif
372 // } else
373
374 // ret = SendDriverMessage(whic->hdrv,msg,lParam1,lParam2);
375 // TRACE(" -> 0x%08lx\n",ret);
376 return ret;
377 } 206 }
378 207
379 208
380 /*********************************************************************** 209 /***********************************************************************
381 * ICClose [MSVFW.22] 210 * ICClose [MSVFW.22]
384 WINE_HIC *whic = (WINE_HIC*)hic; 213 WINE_HIC *whic = (WINE_HIC*)hic;
385 /* FIXME: correct? */ 214 /* FIXME: correct? */
386 // CloseDriver(whic->hdrv,0,0); 215 // CloseDriver(whic->hdrv,0,0);
387 DrvClose(whic->hdrv); 216 DrvClose(whic->hdrv);
388 //#warning FIXME: DrvClose 217 //#warning FIXME: DrvClose
389 my_release(whic); 218 free(whic);
390 return 0; 219 return 0;
391 } 220 }
221
392 int VFWAPI ICDoSomething() 222 int VFWAPI ICDoSomething()
393 { 223 {
394 return 0; 224 return 0;
395 } 225 }
396 226