Parent Directory
|
Revision Log
Revision 611 - (view) (download)
1 : | Isibaar | 3 | /************************************************************************** |
2 : | * | ||
3 : | * XVID VFW FRONTEND | ||
4 : | * driverproc main | ||
5 : | * | ||
6 : | * This program is free software; you can redistribute it and/or modify | ||
7 : | * it under the terms of the GNU General Public License as published by | ||
8 : | * the Free Software Foundation; either version 2 of the License, or | ||
9 : | * (at your option) any later version. | ||
10 : | * | ||
11 : | * This program is distributed in the hope that it will be useful, | ||
12 : | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 : | * GNU General Public License for more details. | ||
15 : | * | ||
16 : | * You should have received a copy of the GNU General Public License | ||
17 : | * along with this program; if not, write to the Free Software | ||
18 : | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 : | * | ||
20 : | *************************************************************************/ | ||
21 : | |||
22 : | /************************************************************************** | ||
23 : | * | ||
24 : | * History: | ||
25 : | * | ||
26 : | suxen_drol | 385 | * 31.08.2002 Configure() export |
27 : | h | 526 | * 01.12.2001 inital version; (c)2001 peter ross <pross@xvid.org> |
28 : | Isibaar | 3 | * |
29 : | *************************************************************************/ | ||
30 : | |||
31 : | #include <windows.h> | ||
32 : | #include <vfw.h> | ||
33 : | |||
34 : | #include "codec.h" | ||
35 : | #include "config.h" | ||
36 : | #include "resource.h" | ||
37 : | |||
38 : | |||
39 : | suxen_drol | 385 | BOOL WINAPI DllMain( |
40 : | Isibaar | 3 | HANDLE hModule, |
41 : | DWORD ul_reason_for_call, | ||
42 : | LPVOID lpReserved) | ||
43 : | { | ||
44 : | hInst = (HINSTANCE) hModule; | ||
45 : | return TRUE; | ||
46 : | } | ||
47 : | |||
48 : | |||
49 : | |||
50 : | suxen_drol | 385 | /* __declspec(dllexport) */ LRESULT WINAPI DriverProc( |
51 : | Isibaar | 3 | DWORD dwDriverId, |
52 : | HDRVR hDriver, | ||
53 : | UINT uMsg, | ||
54 : | LPARAM lParam1, | ||
55 : | LPARAM lParam2) | ||
56 : | { | ||
57 : | CODEC * codec = (CODEC *)dwDriverId; | ||
58 : | |||
59 : | switch(uMsg) | ||
60 : | { | ||
61 : | |||
62 : | /* driver primitives */ | ||
63 : | |||
64 : | case DRV_LOAD : | ||
65 : | case DRV_FREE : | ||
66 : | suxen_drol | 383 | return DRV_OK; |
67 : | Isibaar | 3 | |
68 : | case DRV_OPEN : | ||
69 : | DEBUG("DRV_OPEN"); | ||
70 : | { | ||
71 : | ICOPEN * icopen = (ICOPEN *)lParam2; | ||
72 : | |||
73 : | h | 30 | if (icopen != NULL && icopen->fccType != ICTYPE_VIDEO) |
74 : | { | ||
75 : | Isibaar | 3 | return DRV_CANCEL; |
76 : | } | ||
77 : | h | 61 | |
78 : | Isibaar | 3 | codec = malloc(sizeof(CODEC)); |
79 : | h | 61 | |
80 : | Isibaar | 3 | if (codec == NULL) |
81 : | { | ||
82 : | h | 30 | if (icopen != NULL) |
83 : | { | ||
84 : | Isibaar | 3 | icopen->dwError = ICERR_MEMORY; |
85 : | } | ||
86 : | return 0; | ||
87 : | } | ||
88 : | h | 61 | |
89 : | Isibaar | 3 | codec->ehandle = codec->dhandle = NULL; |
90 : | h | 611 | codec->fbase = 25; |
91 : | codec->fincr = 1; | ||
92 : | Isibaar | 3 | config_reg_get(&codec->config); |
93 : | |||
94 : | h | 61 | /* bad things happen if this is uncommented |
95 : | if (lstrcmp(XVID_BUILD, codec->config.build)) | ||
96 : | { | ||
97 : | config_reg_default(&codec->config); | ||
98 : | } | ||
99 : | */ | ||
100 : | |||
101 : | h | 30 | if (icopen != NULL) |
102 : | { | ||
103 : | Isibaar | 3 | icopen->dwError = ICERR_OK; |
104 : | } | ||
105 : | return (LRESULT)codec; | ||
106 : | } | ||
107 : | |||
108 : | case DRV_CLOSE : | ||
109 : | DEBUG("DRV_CLOSE"); | ||
110 : | // compress_end/decompress_end don't always get called | ||
111 : | compress_end(codec); | ||
112 : | decompress_end(codec); | ||
113 : | free(codec); | ||
114 : | return DRV_OK; | ||
115 : | |||
116 : | case DRV_DISABLE : | ||
117 : | case DRV_ENABLE : | ||
118 : | return DRV_OK; | ||
119 : | |||
120 : | case DRV_INSTALL : | ||
121 : | case DRV_REMOVE : | ||
122 : | return DRV_OK; | ||
123 : | |||
124 : | case DRV_QUERYCONFIGURE : | ||
125 : | case DRV_CONFIGURE : | ||
126 : | return DRV_CANCEL; | ||
127 : | |||
128 : | |||
129 : | /* info */ | ||
130 : | |||
131 : | case ICM_GETINFO : | ||
132 : | DEBUG("ICM_GETINFO"); | ||
133 : | { | ||
134 : | ICINFO *icinfo = (ICINFO *)lParam1; | ||
135 : | |||
136 : | icinfo->fccType = ICTYPE_VIDEO; | ||
137 : | icinfo->fccHandler = FOURCC_XVID; | ||
138 : | icinfo->dwFlags = | ||
139 : | VIDCF_FASTTEMPORALC | | ||
140 : | VIDCF_FASTTEMPORALD | | ||
141 : | VIDCF_COMPRESSFRAMES; | ||
142 : | |||
143 : | icinfo->dwVersion = 0; | ||
144 : | icinfo->dwVersionICM = ICVERSION; | ||
145 : | |||
146 : | wcscpy(icinfo->szName, XVID_NAME_L); | ||
147 : | wcscpy(icinfo->szDescription, XVID_DESC_L); | ||
148 : | |||
149 : | return lParam2; /* size of struct */ | ||
150 : | } | ||
151 : | |||
152 : | /* state control */ | ||
153 : | |||
154 : | case ICM_ABOUT : | ||
155 : | h | 30 | DEBUG("ICM_ABOUT"); |
156 : | DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)lParam1, about_proc, 0); | ||
157 : | return ICERR_OK; | ||
158 : | Isibaar | 3 | |
159 : | h | 30 | case ICM_CONFIGURE : |
160 : | Isibaar | 3 | DEBUG("ICM_CONFIGURE"); |
161 : | h | 30 | if (lParam1 != -1) |
162 : | { | ||
163 : | CONFIG temp; | ||
164 : | Isibaar | 3 | |
165 : | h | 30 | codec->config.save = FALSE; |
166 : | memcpy(&temp, &codec->config, sizeof(CONFIG)); | ||
167 : | Isibaar | 3 | |
168 : | h | 30 | DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_MAIN), (HWND)lParam1, main_proc, (LPARAM)&temp); |
169 : | Isibaar | 3 | |
170 : | h | 30 | if (temp.save) |
171 : | { | ||
172 : | Isibaar | 3 | memcpy(&codec->config, &temp, sizeof(CONFIG)); |
173 : | h | 30 | config_reg_set(&codec->config); |
174 : | Isibaar | 3 | } |
175 : | } | ||
176 : | return ICERR_OK; | ||
177 : | |||
178 : | case ICM_GETSTATE : | ||
179 : | DEBUG("ICM_GETSTATE"); | ||
180 : | h | 30 | if ((void*)lParam1 == NULL) |
181 : | { | ||
182 : | Isibaar | 3 | return sizeof(CONFIG); |
183 : | } | ||
184 : | memcpy((void*)lParam1, &codec->config, sizeof(CONFIG)); | ||
185 : | return ICERR_OK; | ||
186 : | |||
187 : | case ICM_SETSTATE : | ||
188 : | DEBUG("ICM_SETSTATE"); | ||
189 : | h | 30 | if ((void*)lParam1 == NULL) |
190 : | { | ||
191 : | Isibaar | 3 | DEBUG("ICM_SETSTATE : DEFAULT"); |
192 : | config_reg_get(&codec->config); | ||
193 : | return 0; | ||
194 : | } | ||
195 : | memcpy(&codec->config,(void*)lParam1, sizeof(CONFIG)); | ||
196 : | return 0; // sizeof(CONFIG); | ||
197 : | |||
198 : | /* not sure the difference, private/public data? */ | ||
199 : | |||
200 : | case ICM_GET : | ||
201 : | case ICM_SET : | ||
202 : | return ICERR_OK; | ||
203 : | |||
204 : | |||
205 : | /* older-stype config */ | ||
206 : | |||
207 : | case ICM_GETDEFAULTQUALITY : | ||
208 : | case ICM_GETQUALITY : | ||
209 : | case ICM_SETQUALITY : | ||
210 : | case ICM_GETBUFFERSWANTED : | ||
211 : | case ICM_GETDEFAULTKEYFRAMERATE : | ||
212 : | return ICERR_UNSUPPORTED; | ||
213 : | |||
214 : | |||
215 : | /* compressor */ | ||
216 : | |||
217 : | case ICM_COMPRESS_QUERY : | ||
218 : | DEBUG("ICM_COMPRESS_QUERY"); | ||
219 : | return compress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
220 : | |||
221 : | case ICM_COMPRESS_GET_FORMAT : | ||
222 : | DEBUG("ICM_COMPRESS_GET_FORMAT"); | ||
223 : | return compress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
224 : | |||
225 : | case ICM_COMPRESS_GET_SIZE : | ||
226 : | DEBUG("ICM_COMPRESS_GET_SIZE"); | ||
227 : | return compress_get_size(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
228 : | |||
229 : | case ICM_COMPRESS_FRAMES_INFO : | ||
230 : | DEBUG("ICM_COMPRESS_FRAMES_INFO"); | ||
231 : | return compress_frames_info(codec, (ICCOMPRESSFRAMES *)lParam1); | ||
232 : | |||
233 : | case ICM_COMPRESS_BEGIN : | ||
234 : | DEBUG("ICM_COMPRESS_BEGIN"); | ||
235 : | return compress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
236 : | |||
237 : | case ICM_COMPRESS_END : | ||
238 : | DEBUG("ICM_COMPRESS_END"); | ||
239 : | return compress_end(codec); | ||
240 : | |||
241 : | case ICM_COMPRESS : | ||
242 : | DEBUG("ICM_COMPRESS"); | ||
243 : | return compress(codec, (ICCOMPRESS *)lParam1); | ||
244 : | |||
245 : | /* decompressor */ | ||
246 : | |||
247 : | case ICM_DECOMPRESS_QUERY : | ||
248 : | DEBUG("ICM_DECOMPRESS_QUERY"); | ||
249 : | return decompress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
250 : | |||
251 : | case ICM_DECOMPRESS_GET_FORMAT : | ||
252 : | DEBUG("ICM_DECOMPRESS_GET_FORMAT"); | ||
253 : | return decompress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
254 : | |||
255 : | case ICM_DECOMPRESS_BEGIN : | ||
256 : | DEBUG("ICM_DECOMPRESS_BEGIN"); | ||
257 : | return decompress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
258 : | |||
259 : | case ICM_DECOMPRESS_END : | ||
260 : | DEBUG("ICM_DECOMPRESS_END"); | ||
261 : | return decompress_end(codec); | ||
262 : | |||
263 : | case ICM_DECOMPRESS : | ||
264 : | DEBUG("ICM_DECOMPRESS"); | ||
265 : | return decompress(codec, (ICDECOMPRESS *)lParam1); | ||
266 : | |||
267 : | case ICM_DECOMPRESS_GET_PALETTE : | ||
268 : | case ICM_DECOMPRESS_SET_PALETTE : | ||
269 : | case ICM_DECOMPRESSEX_QUERY: | ||
270 : | case ICM_DECOMPRESSEX_BEGIN: | ||
271 : | case ICM_DECOMPRESSEX_END: | ||
272 : | case ICM_DECOMPRESSEX: | ||
273 : | return ICERR_UNSUPPORTED; | ||
274 : | |||
275 : | default: | ||
276 : | return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2); | ||
277 : | } | ||
278 : | } | ||
279 : | suxen_drol | 385 | |
280 : | |||
281 : | void WINAPI Configure(HWND hwnd, HINSTANCE hinst, LPTSTR lpCmdLine, int nCmdShow) | ||
282 : | { | ||
283 : | DWORD dwDriverId; | ||
284 : | |||
285 : | dwDriverId = DriverProc(0, 0, DRV_OPEN, 0, 0); | ||
286 : | if (dwDriverId != (DWORD)NULL) | ||
287 : | { | ||
288 : | DriverProc(dwDriverId, 0, ICM_CONFIGURE, 0, 0); | ||
289 : | DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0); | ||
290 : | } | ||
291 : | } |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |