constant qscale was broken due to libavcodec changes, fix taken from ve_lavc.c
[mplayer/greg.git] / loader / vfl.c
blob0ed95d71a72b47e4131dcca8f053d08e3eebe069
1 /*
2 * Copyright 1998 Marcus Meissner
3 */
4 #include <config.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
10 #include "win32.h"
11 #include "loader.h"
13 #include "wine/winbase.h"
14 #include "wine/windef.h"
15 #include "wine/winuser.h"
16 #include "wine/vfw.h"
17 #include "wine/winestring.h"
18 #include "wine/driver.h"
19 #include "wine/avifmt.h"
20 #include "driver.h"
22 #define OpenDriverA DrvOpen
23 #define CloseDriver DrvClose
25 /***********************************************************************
26 * VideoForWindowsVersion [MSVFW.2][MSVIDEO.2]
27 * Returns the version in major.minor form.
28 * In Windows95 this returns 0x040003b6 (4.950)
30 long VFWAPI VideoForWindowsVersion(void) {
31 return 0x040003B6; /* 4.950 */
34 /* system.ini: [drivers] */
36 /***********************************************************************
37 * ICInfo [MSVFW.33]
38 * Get information about an installable compressor. Return TRUE if there
39 * is one.
41 int VFWAPI
42 ICInfo(
43 long fccType, /* [in] type of compressor ('vidc') */
44 long fccHandler, /* [in] <n>th compressor */
45 ICINFO *lpicinfo /* [out] information about compressor */
46 ) {
47 /* does OpenDriver/CloseDriver */
48 lpicinfo->dwSize = sizeof(ICINFO);
49 lpicinfo->fccType = fccType;
50 lpicinfo->dwFlags = 0;
51 return TRUE;
54 /***********************************************************************
55 * ICOpen [MSVFW.37]
56 * Opens an installable compressor. Return special handle.
58 HIC VFWAPI
59 //ICOpen(long fccType,long fccHandler,unsigned int wMode) {
60 ICOpen(long filename,long fccHandler,unsigned int wMode) {
61 ICOPEN icopen;
62 HDRVR hdrv;
63 WINE_HIC *whic;
65 /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the
66 * same layout as ICOPEN
68 icopen.fccType = 0x63646976; // "vidc" //fccType;
69 icopen.fccHandler = fccHandler;
70 icopen.dwSize = sizeof(ICOPEN);
71 icopen.dwFlags = wMode;
72 icopen.pV1Reserved = (void*)filename;
73 /* FIXME: do we need to fill out the rest too? */
74 hdrv=OpenDriverA((long)&icopen);
75 if (!hdrv) return 0;
76 whic = (WINE_HIC*)malloc(sizeof(WINE_HIC));
77 whic->hdrv = hdrv;
78 whic->driverproc= ((DRVR*)hdrv)->DriverProc;
79 // whic->private = ICSendMessage((HIC)whic,DRV_OPEN,0,(long)&icopen);
80 whic->driverid = ((DRVR*)hdrv)->dwDriverID;
81 return (HIC)whic;
84 /***********************************************************************
85 * ICGetInfo [MSVFW.30]
87 LRESULT VFWAPI
88 ICGetInfo(HIC hic,ICINFO *picinfo,long cb) {
89 LRESULT ret;
91 ret = ICSendMessage(hic,ICM_GETINFO,(long)picinfo,cb);
93 return ret;
96 /***********************************************************************
97 * ICCompress [MSVFW.23]
99 long VFWAPIV
100 ICCompress(
101 HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpData,
102 LPBITMAPINFOHEADER lpbiInput,void* lpBits,long* lpckid,
103 long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality,
104 LPBITMAPINFOHEADER lpbiPrev,void* lpPrev
106 ICCOMPRESS iccmp;
108 iccmp.dwFlags = dwFlags;
110 iccmp.lpbiOutput = lpbiOutput;
111 iccmp.lpOutput = lpData;
112 iccmp.lpbiInput = lpbiInput;
113 iccmp.lpInput = lpBits;
115 iccmp.lpckid = lpckid;
116 iccmp.lpdwFlags = lpdwFlags;
117 iccmp.lFrameNum = lFrameNum;
118 iccmp.dwFrameSize = dwFrameSize;
119 iccmp.dwQuality = dwQuality;
120 iccmp.lpbiPrev = lpbiPrev;
121 iccmp.lpPrev = lpPrev;
122 return ICSendMessage(hic,ICM_COMPRESS,(long)&iccmp,sizeof(iccmp));
125 /***********************************************************************
126 * ICDecompress [MSVFW.26]
128 long VFWAPIV
129 ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits) {
130 ICDECOMPRESS icd;
131 int result;
132 icd.dwFlags = dwFlags;
133 icd.lpbiInput = lpbiFormat;
134 icd.lpInput = lpData;
136 icd.lpbiOutput = lpbi;
137 icd.lpOutput = lpBits;
138 icd.ckid = 0;
139 result=ICSendMessage(hic,ICM_DECOMPRESS,(long)&icd,sizeof(icd));
140 return result;
143 /***********************************************************************
144 * ICDecompressEx [MSVFW.26]
146 long VFWAPIV
147 ICDecompressEx(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits) {
148 ICDECOMPRESSEX icd;
149 int result;
151 icd.dwFlags = dwFlags;
153 icd.lpbiSrc = lpbiFormat;
154 icd.lpSrc = lpData;
156 icd.lpbiDst = lpbi;
157 icd.lpDst = lpBits;
159 icd.xSrc=icd.ySrc=0;
160 icd.dxSrc=lpbiFormat->biWidth;
161 icd.dySrc=abs(lpbiFormat->biHeight);
163 icd.xDst=icd.yDst=0;
164 icd.dxDst=lpbi->biWidth;
165 icd.dyDst=abs(lpbi->biHeight);
167 //icd.ckid = 0;
168 result=ICSendMessage(hic,ICM_DECOMPRESSEX,(long)&icd,sizeof(icd));
169 return result;
172 long VFWAPIV
173 ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPBITMAPINFOHEADER lpbi) {
174 ICDECOMPRESSEX icd;
175 int result;
177 icd.dwFlags = 0;
179 icd.lpbiSrc = lpbiFormat;
180 icd.lpSrc = 0;
182 icd.lpbiDst = lpbi;
183 icd.lpDst = 0;
185 icd.xSrc=icd.ySrc=0;
186 icd.dxSrc=lpbiFormat->biWidth;
187 icd.dySrc=abs(lpbiFormat->biHeight);
189 icd.xDst=icd.yDst=0;
190 icd.dxDst=lpbi->biWidth;
191 icd.dyDst=abs(lpbi->biHeight);
193 //icd.ckid = 0;
194 result=ICSendMessage(hic,command,(long)&icd,sizeof(icd));
195 return result;
199 /***********************************************************************
200 * ICSendMessage [MSVFW.40]
202 LRESULT VFWAPI
203 ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) {
204 WINE_HIC *whic = (WINE_HIC*)hic;
205 return SendDriverMessage(whic->hdrv, msg, lParam1,lParam2);
209 /***********************************************************************
210 * ICClose [MSVFW.22]
212 LRESULT VFWAPI ICClose(HIC hic) {
213 WINE_HIC *whic = (WINE_HIC*)hic;
214 /* FIXME: correct? */
215 // CloseDriver(whic->hdrv,0,0);
216 DrvClose(whic->hdrv);
217 //#warning FIXME: DrvClose
218 free(whic);
219 return 0;
222 int VFWAPI ICDoSomething()
224 return 0;