Second attempt to fix compilation of dvdread (I don't really like this but it might...
[vlc/asuraparaju-public.git] / libs / loader / vfl.c
blobcc3b866e22f58aa298a8645e29ddc5c3f7ead1cf
1 /*
2 * $Id$
4 * Copyright 1998 Marcus Meissner
6 * Modified for use with MPlayer, detailed CVS changelog at
7 * http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
9 * File now distributed as part of VLC media player with no modifications.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 #include <config.h>
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
31 #include "win32.h"
32 #include "loader.h"
34 #include "wine/winbase.h"
35 #include "wine/windef.h"
36 #include "wine/winuser.h"
37 #include "wine/vfw.h"
38 #include "wine/winestring.h"
39 #include "wine/driver.h"
40 #include "wine/avifmt.h"
41 #include "driver.h"
43 #define OpenDriverA DrvOpen
44 #define CloseDriver DrvClose
46 /***********************************************************************
47 * VideoForWindowsVersion [MSVFW.2][MSVIDEO.2]
48 * Returns the version in major.minor form.
49 * In Windows95 this returns 0x040003b6 (4.950)
51 long VFWAPI VideoForWindowsVersion(void) {
52 return 0x040003B6; /* 4.950 */
55 /* system.ini: [drivers] */
57 /***********************************************************************
58 * ICInfo [MSVFW.33]
59 * Get information about an installable compressor. Return TRUE if there
60 * is one.
62 int VFWAPI
63 ICInfo(
64 long fccType, /* [in] type of compressor ('vidc') */
65 long fccHandler, /* [in] <n>th compressor */
66 ICINFO *lpicinfo /* [out] information about compressor */
67 ) {
68 /* does OpenDriver/CloseDriver */
69 lpicinfo->dwSize = sizeof(ICINFO);
70 lpicinfo->fccType = fccType;
71 lpicinfo->dwFlags = 0;
72 return TRUE;
75 /***********************************************************************
76 * ICOpen [MSVFW.37]
77 * Opens an installable compressor. Return special handle.
79 HIC VFWAPI
80 //ICOpen(long fccType,long fccHandler,unsigned int wMode) {
81 ICOpen(long filename,long fccHandler,unsigned int wMode) {
82 ICOPEN icopen;
83 HDRVR hdrv;
84 WINE_HIC *whic;
86 /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the
87 * same layout as ICOPEN
89 icopen.fccType = 0x63646976; // "vidc" //fccType;
90 icopen.fccHandler = fccHandler;
91 icopen.dwSize = sizeof(ICOPEN);
92 icopen.dwFlags = wMode;
93 icopen.pV1Reserved = (void*)filename;
94 /* FIXME: do we need to fill out the rest too? */
95 hdrv=OpenDriverA((long)&icopen);
96 if (!hdrv) return 0;
97 whic = (WINE_HIC*)malloc(sizeof(WINE_HIC));
98 whic->hdrv = hdrv;
99 whic->driverproc= ((DRVR*)hdrv)->DriverProc;
100 // whic->private = ICSendMessage((HIC)whic,DRV_OPEN,0,(long)&icopen);
101 whic->driverid = ((DRVR*)hdrv)->dwDriverID;
102 return (HIC)whic;
105 /***********************************************************************
106 * ICGetInfo [MSVFW.30]
108 LRESULT VFWAPI
109 ICGetInfo(HIC hic,ICINFO *picinfo,long cb) {
110 LRESULT ret;
112 ret = ICSendMessage(hic,ICM_GETINFO,(long)picinfo,cb);
114 return ret;
117 /***********************************************************************
118 * ICCompress [MSVFW.23]
120 long VFWAPIV
121 ICCompress(
122 HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpData,
123 LPBITMAPINFOHEADER lpbiInput,void* lpBits,long* lpckid,
124 long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality,
125 LPBITMAPINFOHEADER lpbiPrev,void* lpPrev
127 ICCOMPRESS iccmp;
129 iccmp.dwFlags = dwFlags;
131 iccmp.lpbiOutput = lpbiOutput;
132 iccmp.lpOutput = lpData;
133 iccmp.lpbiInput = lpbiInput;
134 iccmp.lpInput = lpBits;
136 iccmp.lpckid = lpckid;
137 iccmp.lpdwFlags = lpdwFlags;
138 iccmp.lFrameNum = lFrameNum;
139 iccmp.dwFrameSize = dwFrameSize;
140 iccmp.dwQuality = dwQuality;
141 iccmp.lpbiPrev = lpbiPrev;
142 iccmp.lpPrev = lpPrev;
143 return ICSendMessage(hic,ICM_COMPRESS,(long)&iccmp,sizeof(iccmp));
146 /***********************************************************************
147 * ICDecompress [MSVFW.26]
149 long VFWAPIV
150 ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits) {
151 ICDECOMPRESS icd;
152 int result;
153 icd.dwFlags = dwFlags;
154 icd.lpbiInput = lpbiFormat;
155 icd.lpInput = lpData;
157 icd.lpbiOutput = lpbi;
158 icd.lpOutput = lpBits;
159 icd.ckid = 0;
160 result=ICSendMessage(hic,ICM_DECOMPRESS,(long)&icd,sizeof(icd));
161 return result;
164 /***********************************************************************
165 * ICDecompressEx [MSVFW.26]
167 long VFWAPIV
168 ICDecompressEx(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits) {
169 ICDECOMPRESSEX icd;
170 int result;
172 icd.dwFlags = dwFlags;
174 icd.lpbiSrc = lpbiFormat;
175 icd.lpSrc = lpData;
177 icd.lpbiDst = lpbi;
178 icd.lpDst = lpBits;
180 icd.xSrc=icd.ySrc=0;
181 icd.dxSrc=lpbiFormat->biWidth;
182 icd.dySrc=abs(lpbiFormat->biHeight);
184 icd.xDst=icd.yDst=0;
185 icd.dxDst=lpbi->biWidth;
186 icd.dyDst=abs(lpbi->biHeight);
188 //icd.ckid = 0;
189 result=ICSendMessage(hic,ICM_DECOMPRESSEX,(long)&icd,sizeof(icd));
190 return result;
193 long VFWAPIV
194 ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPBITMAPINFOHEADER lpbi) {
195 ICDECOMPRESSEX icd;
196 int result;
198 icd.dwFlags = 0;
200 icd.lpbiSrc = lpbiFormat;
201 icd.lpSrc = 0;
203 icd.lpbiDst = lpbi;
204 icd.lpDst = 0;
206 icd.xSrc=icd.ySrc=0;
207 icd.dxSrc=lpbiFormat->biWidth;
208 icd.dySrc=abs(lpbiFormat->biHeight);
210 icd.xDst=icd.yDst=0;
211 icd.dxDst=lpbi->biWidth;
212 icd.dyDst=abs(lpbi->biHeight);
214 //icd.ckid = 0;
215 result=ICSendMessage(hic,command,(long)&icd,sizeof(icd));
216 return result;
220 /***********************************************************************
221 * ICSendMessage [MSVFW.40]
223 LRESULT VFWAPI
224 ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) {
225 WINE_HIC *whic = (WINE_HIC*)hic;
226 return SendDriverMessage(whic->hdrv, msg, lParam1,lParam2);
230 /***********************************************************************
231 * ICClose [MSVFW.22]
233 LRESULT VFWAPI ICClose(HIC hic) {
234 WINE_HIC *whic = (WINE_HIC*)hic;
235 /* FIXME: correct? */
236 // CloseDriver(whic->hdrv,0,0);
237 DrvClose(whic->hdrv);
238 //#warning FIXME: DrvClose
239 free(whic);
240 return 0;
243 int VFWAPI ICDoSomething()
245 return 0;