]> git.sesse.net Git - vlc/blob - libs/loader/vfl.c
Create a modules-like directory for libraries
[vlc] / libs / loader / vfl.c
1 /*
2  * $Id$
3  *
4  * Copyright 1998 Marcus Meissner
5  *
6  * Modified for use with MPlayer, detailed CVS changelog at
7  * http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
8  *
9  * File now distributed as part of VLC media player with no modifications.
10  *
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.
15  *
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.
20  *
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.
24  */
25 #include <config.h>
26
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30
31 #include "win32.h"
32 #include "loader.h"
33
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"
42
43 #define OpenDriverA DrvOpen
44 #define CloseDriver DrvClose
45
46 /***********************************************************************
47  *              VideoForWindowsVersion          [MSVFW.2][MSVIDEO.2]
48  * Returns the version in major.minor form.
49  * In Windows95 this returns 0x040003b6 (4.950)
50  */
51 long VFWAPI VideoForWindowsVersion(void) {
52         return 0x040003B6; /* 4.950 */
53 }
54
55 /* system.ini: [drivers] */
56
57 /***********************************************************************
58  *              ICInfo                          [MSVFW.33]
59  * Get information about an installable compressor. Return TRUE if there
60  * is one.
61  */
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;
73 }
74
75 /***********************************************************************
76  *              ICOpen                          [MSVFW.37]
77  * Opens an installable compressor. Return special handle.
78  */
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;
85
86         /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the 
87          * same layout as ICOPEN
88          */
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;
103 }
104
105 /***********************************************************************
106  *              ICGetInfo                       [MSVFW.30]
107  */
108 LRESULT VFWAPI
109 ICGetInfo(HIC hic,ICINFO *picinfo,long cb) {
110         LRESULT         ret;
111
112         ret = ICSendMessage(hic,ICM_GETINFO,(long)picinfo,cb);
113         
114         return ret;
115 }
116
117 /***********************************************************************
118  *              ICCompress                      [MSVFW.23]
119  */
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
126 ) {
127         ICCOMPRESS      iccmp;
128
129         iccmp.dwFlags           = dwFlags;
130
131         iccmp.lpbiOutput        = lpbiOutput;
132         iccmp.lpOutput          = lpData;
133         iccmp.lpbiInput         = lpbiInput;
134         iccmp.lpInput           = lpBits;
135
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));
144 }
145
146 /***********************************************************************
147  *              ICDecompress                    [MSVFW.26]
148  */
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;
156
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;
162 }
163
164 /***********************************************************************
165  *              ICDecompressEx                  [MSVFW.26]
166  */
167 long VFWAPIV 
168 ICDecompressEx(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER  lpbi,void* lpBits) {
169         ICDECOMPRESSEX  icd;
170         int result;
171         
172         icd.dwFlags     = dwFlags;
173
174         icd.lpbiSrc     = lpbiFormat;
175         icd.lpSrc       = lpData;
176
177         icd.lpbiDst     = lpbi;
178         icd.lpDst       = lpBits;
179         
180         icd.xSrc=icd.ySrc=0;
181         icd.dxSrc=lpbiFormat->biWidth;
182         icd.dySrc=abs(lpbiFormat->biHeight);
183
184         icd.xDst=icd.yDst=0;
185         icd.dxDst=lpbi->biWidth;
186         icd.dyDst=abs(lpbi->biHeight);
187         
188         //icd.ckid      = 0;
189         result=ICSendMessage(hic,ICM_DECOMPRESSEX,(long)&icd,sizeof(icd));
190         return result;
191 }
192
193 long VFWAPIV 
194 ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPBITMAPINFOHEADER lpbi) {
195         ICDECOMPRESSEX  icd;
196         int result;
197         
198         icd.dwFlags     = 0;
199
200         icd.lpbiSrc     = lpbiFormat;
201         icd.lpSrc       = 0;
202
203         icd.lpbiDst     = lpbi;
204         icd.lpDst       = 0;
205         
206         icd.xSrc=icd.ySrc=0;
207         icd.dxSrc=lpbiFormat->biWidth;
208         icd.dySrc=abs(lpbiFormat->biHeight);
209
210         icd.xDst=icd.yDst=0;
211         icd.dxDst=lpbi->biWidth;
212         icd.dyDst=abs(lpbi->biHeight);
213         
214         //icd.ckid      = 0;
215         result=ICSendMessage(hic,command,(long)&icd,sizeof(icd));
216         return result;
217 }
218
219
220 /***********************************************************************
221  *              ICSendMessage                   [MSVFW.40]
222  */
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);
227 }
228
229
230 /***********************************************************************
231  *              ICClose                 [MSVFW.22]
232  */
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;
241 }
242
243 int VFWAPI ICDoSomething()
244 {
245   return 0;
246 }
247