fix
[mplayer/glamo.git] / loader / vfl.c
blobc36c5d4a6f794146ab86d87a3056f83e0cc4ee8c
1 /*
2 * Copyright 1998 Marcus Meissner
4 * Modified for use with MPlayer, detailed CVS changelog at
5 * http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
6 * $Id$
8 */
9 #include <config.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
15 #include "win32.h"
16 #include "loader.h"
18 #include "wine/winbase.h"
19 #include "wine/windef.h"
20 #include "wine/winuser.h"
21 #include "wine/vfw.h"
22 #include "wine/winestring.h"
23 #include "wine/driver.h"
24 #include "wine/avifmt.h"
25 #include "driver.h"
27 #define OpenDriverA DrvOpen
28 #define CloseDriver DrvClose
30 /***********************************************************************
31 * VideoForWindowsVersion [MSVFW.2][MSVIDEO.2]
32 * Returns the version in major.minor form.
33 * In Windows95 this returns 0x040003b6 (4.950)
35 long VFWAPI VideoForWindowsVersion(void) {
36 return 0x040003B6; /* 4.950 */
39 /* system.ini: [drivers] */
41 /***********************************************************************
42 * ICInfo [MSVFW.33]
43 * Get information about an installable compressor. Return TRUE if there
44 * is one.
46 int VFWAPI
47 ICInfo(
48 long fccType, /* [in] type of compressor ('vidc') */
49 long fccHandler, /* [in] <n>th compressor */
50 ICINFO *lpicinfo /* [out] information about compressor */
51 ) {
52 /* does OpenDriver/CloseDriver */
53 lpicinfo->dwSize = sizeof(ICINFO);
54 lpicinfo->fccType = fccType;
55 lpicinfo->dwFlags = 0;
56 return TRUE;
59 /***********************************************************************
60 * ICOpen [MSVFW.37]
61 * Opens an installable compressor. Return special handle.
63 HIC VFWAPI
64 //ICOpen(long fccType,long fccHandler,unsigned int wMode) {
65 ICOpen(long filename,long fccHandler,unsigned int wMode) {
66 ICOPEN icopen;
67 HDRVR hdrv;
68 WINE_HIC *whic;
70 /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the
71 * same layout as ICOPEN
73 icopen.fccType = 0x63646976; // "vidc" //fccType;
74 icopen.fccHandler = fccHandler;
75 icopen.dwSize = sizeof(ICOPEN);
76 icopen.dwFlags = wMode;
77 icopen.pV1Reserved = (void*)filename;
78 /* FIXME: do we need to fill out the rest too? */
79 hdrv=OpenDriverA((long)&icopen);
80 if (!hdrv) return 0;
81 whic = (WINE_HIC*)malloc(sizeof(WINE_HIC));
82 whic->hdrv = hdrv;
83 whic->driverproc= ((DRVR*)hdrv)->DriverProc;
84 // whic->private = ICSendMessage((HIC)whic,DRV_OPEN,0,(long)&icopen);
85 whic->driverid = ((DRVR*)hdrv)->dwDriverID;
86 return (HIC)whic;
89 /***********************************************************************
90 * ICGetInfo [MSVFW.30]
92 LRESULT VFWAPI
93 ICGetInfo(HIC hic,ICINFO *picinfo,long cb) {
94 LRESULT ret;
96 ret = ICSendMessage(hic,ICM_GETINFO,(long)picinfo,cb);
98 return ret;
101 /***********************************************************************
102 * ICCompress [MSVFW.23]
104 long VFWAPIV
105 ICCompress(
106 HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpData,
107 LPBITMAPINFOHEADER lpbiInput,void* lpBits,long* lpckid,
108 long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality,
109 LPBITMAPINFOHEADER lpbiPrev,void* lpPrev
111 ICCOMPRESS iccmp;
113 iccmp.dwFlags = dwFlags;
115 iccmp.lpbiOutput = lpbiOutput;
116 iccmp.lpOutput = lpData;
117 iccmp.lpbiInput = lpbiInput;
118 iccmp.lpInput = lpBits;
120 iccmp.lpckid = lpckid;
121 iccmp.lpdwFlags = lpdwFlags;
122 iccmp.lFrameNum = lFrameNum;
123 iccmp.dwFrameSize = dwFrameSize;
124 iccmp.dwQuality = dwQuality;
125 iccmp.lpbiPrev = lpbiPrev;
126 iccmp.lpPrev = lpPrev;
127 return ICSendMessage(hic,ICM_COMPRESS,(long)&iccmp,sizeof(iccmp));
130 /***********************************************************************
131 * ICDecompress [MSVFW.26]
133 long VFWAPIV
134 ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits) {
135 ICDECOMPRESS icd;
136 int result;
137 icd.dwFlags = dwFlags;
138 icd.lpbiInput = lpbiFormat;
139 icd.lpInput = lpData;
141 icd.lpbiOutput = lpbi;
142 icd.lpOutput = lpBits;
143 icd.ckid = 0;
144 result=ICSendMessage(hic,ICM_DECOMPRESS,(long)&icd,sizeof(icd));
145 return result;
148 /***********************************************************************
149 * ICDecompressEx [MSVFW.26]
151 long VFWAPIV
152 ICDecompressEx(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits) {
153 ICDECOMPRESSEX icd;
154 int result;
156 icd.dwFlags = dwFlags;
158 icd.lpbiSrc = lpbiFormat;
159 icd.lpSrc = lpData;
161 icd.lpbiDst = lpbi;
162 icd.lpDst = lpBits;
164 icd.xSrc=icd.ySrc=0;
165 icd.dxSrc=lpbiFormat->biWidth;
166 icd.dySrc=abs(lpbiFormat->biHeight);
168 icd.xDst=icd.yDst=0;
169 icd.dxDst=lpbi->biWidth;
170 icd.dyDst=abs(lpbi->biHeight);
172 //icd.ckid = 0;
173 result=ICSendMessage(hic,ICM_DECOMPRESSEX,(long)&icd,sizeof(icd));
174 return result;
177 long VFWAPIV
178 ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPBITMAPINFOHEADER lpbi) {
179 ICDECOMPRESSEX icd;
180 int result;
182 icd.dwFlags = 0;
184 icd.lpbiSrc = lpbiFormat;
185 icd.lpSrc = 0;
187 icd.lpbiDst = lpbi;
188 icd.lpDst = 0;
190 icd.xSrc=icd.ySrc=0;
191 icd.dxSrc=lpbiFormat->biWidth;
192 icd.dySrc=abs(lpbiFormat->biHeight);
194 icd.xDst=icd.yDst=0;
195 icd.dxDst=lpbi->biWidth;
196 icd.dyDst=abs(lpbi->biHeight);
198 //icd.ckid = 0;
199 result=ICSendMessage(hic,command,(long)&icd,sizeof(icd));
200 return result;
204 /***********************************************************************
205 * ICSendMessage [MSVFW.40]
207 LRESULT VFWAPI
208 ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) {
209 WINE_HIC *whic = (WINE_HIC*)hic;
210 return SendDriverMessage(whic->hdrv, msg, lParam1,lParam2);
214 /***********************************************************************
215 * ICClose [MSVFW.22]
217 LRESULT VFWAPI ICClose(HIC hic) {
218 WINE_HIC *whic = (WINE_HIC*)hic;
219 /* FIXME: correct? */
220 // CloseDriver(whic->hdrv,0,0);
221 DrvClose(whic->hdrv);
222 //#warning FIXME: DrvClose
223 free(whic);
224 return 0;
227 int VFWAPI ICDoSomething()
229 return 0;