]> git.sesse.net Git - vlc/blob - loader/vfl.c
don't use float32 by default (should fix sound issues under windows)
[vlc] / loader / vfl.c
1 /*
2  * Copyright 1998 Marcus Meissner
3  *
4  * Modified for use with MPlayer, detailed CVS changelog at
5  * http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
6  * $Id$
7  *
8  */
9 #include <config.h>
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14
15 #include "win32.h"
16 #include "loader.h"
17
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"
26
27 #define OpenDriverA DrvOpen
28 #define CloseDriver DrvClose
29
30 /***********************************************************************
31  *              VideoForWindowsVersion          [MSVFW.2][MSVIDEO.2]
32  * Returns the version in major.minor form.
33  * In Windows95 this returns 0x040003b6 (4.950)
34  */
35 long VFWAPI VideoForWindowsVersion(void) {
36         return 0x040003B6; /* 4.950 */
37 }
38
39 /* system.ini: [drivers] */
40
41 /***********************************************************************
42  *              ICInfo                          [MSVFW.33]
43  * Get information about an installable compressor. Return TRUE if there
44  * is one.
45  */
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;
57 }
58
59 /***********************************************************************
60  *              ICOpen                          [MSVFW.37]
61  * Opens an installable compressor. Return special handle.
62  */
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;
69
70         /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the 
71          * same layout as ICOPEN
72          */
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;
87 }
88
89 /***********************************************************************
90  *              ICGetInfo                       [MSVFW.30]
91  */
92 LRESULT VFWAPI
93 ICGetInfo(HIC hic,ICINFO *picinfo,long cb) {
94         LRESULT         ret;
95
96         ret = ICSendMessage(hic,ICM_GETINFO,(long)picinfo,cb);
97         
98         return ret;
99 }
100
101 /***********************************************************************
102  *              ICCompress                      [MSVFW.23]
103  */
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
110 ) {
111         ICCOMPRESS      iccmp;
112
113         iccmp.dwFlags           = dwFlags;
114
115         iccmp.lpbiOutput        = lpbiOutput;
116         iccmp.lpOutput          = lpData;
117         iccmp.lpbiInput         = lpbiInput;
118         iccmp.lpInput           = lpBits;
119
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));
128 }
129
130 /***********************************************************************
131  *              ICDecompress                    [MSVFW.26]
132  */
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;
140
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;
146 }
147
148 /***********************************************************************
149  *              ICDecompressEx                  [MSVFW.26]
150  */
151 long VFWAPIV 
152 ICDecompressEx(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER  lpbi,void* lpBits) {
153         ICDECOMPRESSEX  icd;
154         int result;
155         
156         icd.dwFlags     = dwFlags;
157
158         icd.lpbiSrc     = lpbiFormat;
159         icd.lpSrc       = lpData;
160
161         icd.lpbiDst     = lpbi;
162         icd.lpDst       = lpBits;
163         
164         icd.xSrc=icd.ySrc=0;
165         icd.dxSrc=lpbiFormat->biWidth;
166         icd.dySrc=abs(lpbiFormat->biHeight);
167
168         icd.xDst=icd.yDst=0;
169         icd.dxDst=lpbi->biWidth;
170         icd.dyDst=abs(lpbi->biHeight);
171         
172         //icd.ckid      = 0;
173         result=ICSendMessage(hic,ICM_DECOMPRESSEX,(long)&icd,sizeof(icd));
174         return result;
175 }
176
177 long VFWAPIV 
178 ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPBITMAPINFOHEADER lpbi) {
179         ICDECOMPRESSEX  icd;
180         int result;
181         
182         icd.dwFlags     = 0;
183
184         icd.lpbiSrc     = lpbiFormat;
185         icd.lpSrc       = 0;
186
187         icd.lpbiDst     = lpbi;
188         icd.lpDst       = 0;
189         
190         icd.xSrc=icd.ySrc=0;
191         icd.dxSrc=lpbiFormat->biWidth;
192         icd.dySrc=abs(lpbiFormat->biHeight);
193
194         icd.xDst=icd.yDst=0;
195         icd.dxDst=lpbi->biWidth;
196         icd.dyDst=abs(lpbi->biHeight);
197         
198         //icd.ckid      = 0;
199         result=ICSendMessage(hic,command,(long)&icd,sizeof(icd));
200         return result;
201 }
202
203
204 /***********************************************************************
205  *              ICSendMessage                   [MSVFW.40]
206  */
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);
211 }
212
213
214 /***********************************************************************
215  *              ICClose                 [MSVFW.22]
216  */
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;
225 }
226
227 int VFWAPI ICDoSomething()
228 {
229   return 0;
230 }
231