Parent Directory
|
Revision Log
Revision 526 - (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 : | config_reg_get(&codec->config); | ||
91 : | |||
92 : | h | 61 | /* bad things happen if this is uncommented |
93 : | if (lstrcmp(XVID_BUILD, codec->config.build)) | ||
94 : | { | ||
95 : | config_reg_default(&codec->config); | ||
96 : | } | ||
97 : | */ | ||
98 : | |||
99 : | h | 30 | if (icopen != NULL) |
100 : | { | ||
101 : | Isibaar | 3 | icopen->dwError = ICERR_OK; |
102 : | } | ||
103 : | return (LRESULT)codec; | ||
104 : | } | ||
105 : | |||
106 : | case DRV_CLOSE : | ||
107 : | DEBUG("DRV_CLOSE"); | ||
108 : | // compress_end/decompress_end don't always get called | ||
109 : | compress_end(codec); | ||
110 : | decompress_end(codec); | ||
111 : | free(codec); | ||
112 : | return DRV_OK; | ||
113 : | |||
114 : | case DRV_DISABLE : | ||
115 : | case DRV_ENABLE : | ||
116 : | return DRV_OK; | ||
117 : | |||
118 : | case DRV_INSTALL : | ||
119 : | case DRV_REMOVE : | ||
120 : | return DRV_OK; | ||
121 : | |||
122 : | case DRV_QUERYCONFIGURE : | ||
123 : | case DRV_CONFIGURE : | ||
124 : | return DRV_CANCEL; | ||
125 : | |||
126 : | |||
127 : | /* info */ | ||
128 : | |||
129 : | case ICM_GETINFO : | ||
130 : | DEBUG("ICM_GETINFO"); | ||
131 : | { | ||
132 : | ICINFO *icinfo = (ICINFO *)lParam1; | ||
133 : | |||
134 : | icinfo->fccType = ICTYPE_VIDEO; | ||
135 : | icinfo->fccHandler = FOURCC_XVID; | ||
136 : | icinfo->dwFlags = | ||
137 : | VIDCF_FASTTEMPORALC | | ||
138 : | VIDCF_FASTTEMPORALD | | ||
139 : | VIDCF_COMPRESSFRAMES; | ||
140 : | |||
141 : | icinfo->dwVersion = 0; | ||
142 : | icinfo->dwVersionICM = ICVERSION; | ||
143 : | |||
144 : | wcscpy(icinfo->szName, XVID_NAME_L); | ||
145 : | wcscpy(icinfo->szDescription, XVID_DESC_L); | ||
146 : | |||
147 : | return lParam2; /* size of struct */ | ||
148 : | } | ||
149 : | |||
150 : | /* state control */ | ||
151 : | |||
152 : | case ICM_ABOUT : | ||
153 : | h | 30 | DEBUG("ICM_ABOUT"); |
154 : | DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)lParam1, about_proc, 0); | ||
155 : | return ICERR_OK; | ||
156 : | Isibaar | 3 | |
157 : | h | 30 | case ICM_CONFIGURE : |
158 : | Isibaar | 3 | DEBUG("ICM_CONFIGURE"); |
159 : | h | 30 | if (lParam1 != -1) |
160 : | { | ||
161 : | CONFIG temp; | ||
162 : | Isibaar | 3 | |
163 : | h | 30 | codec->config.save = FALSE; |
164 : | memcpy(&temp, &codec->config, sizeof(CONFIG)); | ||
165 : | Isibaar | 3 | |
166 : | h | 30 | DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_MAIN), (HWND)lParam1, main_proc, (LPARAM)&temp); |
167 : | Isibaar | 3 | |
168 : | h | 30 | if (temp.save) |
169 : | { | ||
170 : | Isibaar | 3 | memcpy(&codec->config, &temp, sizeof(CONFIG)); |
171 : | h | 30 | config_reg_set(&codec->config); |
172 : | Isibaar | 3 | } |
173 : | } | ||
174 : | return ICERR_OK; | ||
175 : | |||
176 : | case ICM_GETSTATE : | ||
177 : | DEBUG("ICM_GETSTATE"); | ||
178 : | h | 30 | if ((void*)lParam1 == NULL) |
179 : | { | ||
180 : | Isibaar | 3 | return sizeof(CONFIG); |
181 : | } | ||
182 : | memcpy((void*)lParam1, &codec->config, sizeof(CONFIG)); | ||
183 : | return ICERR_OK; | ||
184 : | |||
185 : | case ICM_SETSTATE : | ||
186 : | DEBUG("ICM_SETSTATE"); | ||
187 : | h | 30 | if ((void*)lParam1 == NULL) |
188 : | { | ||
189 : | Isibaar | 3 | DEBUG("ICM_SETSTATE : DEFAULT"); |
190 : | config_reg_get(&codec->config); | ||
191 : | return 0; | ||
192 : | } | ||
193 : | memcpy(&codec->config,(void*)lParam1, sizeof(CONFIG)); | ||
194 : | return 0; // sizeof(CONFIG); | ||
195 : | |||
196 : | /* not sure the difference, private/public data? */ | ||
197 : | |||
198 : | case ICM_GET : | ||
199 : | case ICM_SET : | ||
200 : | return ICERR_OK; | ||
201 : | |||
202 : | |||
203 : | /* older-stype config */ | ||
204 : | |||
205 : | case ICM_GETDEFAULTQUALITY : | ||
206 : | case ICM_GETQUALITY : | ||
207 : | case ICM_SETQUALITY : | ||
208 : | case ICM_GETBUFFERSWANTED : | ||
209 : | case ICM_GETDEFAULTKEYFRAMERATE : | ||
210 : | return ICERR_UNSUPPORTED; | ||
211 : | |||
212 : | |||
213 : | /* compressor */ | ||
214 : | |||
215 : | case ICM_COMPRESS_QUERY : | ||
216 : | DEBUG("ICM_COMPRESS_QUERY"); | ||
217 : | return compress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
218 : | |||
219 : | case ICM_COMPRESS_GET_FORMAT : | ||
220 : | DEBUG("ICM_COMPRESS_GET_FORMAT"); | ||
221 : | return compress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
222 : | |||
223 : | case ICM_COMPRESS_GET_SIZE : | ||
224 : | DEBUG("ICM_COMPRESS_GET_SIZE"); | ||
225 : | return compress_get_size(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
226 : | |||
227 : | case ICM_COMPRESS_FRAMES_INFO : | ||
228 : | DEBUG("ICM_COMPRESS_FRAMES_INFO"); | ||
229 : | return compress_frames_info(codec, (ICCOMPRESSFRAMES *)lParam1); | ||
230 : | |||
231 : | case ICM_COMPRESS_BEGIN : | ||
232 : | DEBUG("ICM_COMPRESS_BEGIN"); | ||
233 : | return compress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
234 : | |||
235 : | case ICM_COMPRESS_END : | ||
236 : | DEBUG("ICM_COMPRESS_END"); | ||
237 : | return compress_end(codec); | ||
238 : | |||
239 : | case ICM_COMPRESS : | ||
240 : | DEBUG("ICM_COMPRESS"); | ||
241 : | return compress(codec, (ICCOMPRESS *)lParam1); | ||
242 : | |||
243 : | /* decompressor */ | ||
244 : | |||
245 : | case ICM_DECOMPRESS_QUERY : | ||
246 : | DEBUG("ICM_DECOMPRESS_QUERY"); | ||
247 : | return decompress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
248 : | |||
249 : | case ICM_DECOMPRESS_GET_FORMAT : | ||
250 : | DEBUG("ICM_DECOMPRESS_GET_FORMAT"); | ||
251 : | return decompress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
252 : | |||
253 : | case ICM_DECOMPRESS_BEGIN : | ||
254 : | DEBUG("ICM_DECOMPRESS_BEGIN"); | ||
255 : | return decompress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); | ||
256 : | |||
257 : | case ICM_DECOMPRESS_END : | ||
258 : | DEBUG("ICM_DECOMPRESS_END"); | ||
259 : | return decompress_end(codec); | ||
260 : | |||
261 : | case ICM_DECOMPRESS : | ||
262 : | DEBUG("ICM_DECOMPRESS"); | ||
263 : | return decompress(codec, (ICDECOMPRESS *)lParam1); | ||
264 : | |||
265 : | case ICM_DECOMPRESS_GET_PALETTE : | ||
266 : | case ICM_DECOMPRESS_SET_PALETTE : | ||
267 : | case ICM_DECOMPRESSEX_QUERY: | ||
268 : | case ICM_DECOMPRESSEX_BEGIN: | ||
269 : | case ICM_DECOMPRESSEX_END: | ||
270 : | case ICM_DECOMPRESSEX: | ||
271 : | return ICERR_UNSUPPORTED; | ||
272 : | |||
273 : | default: | ||
274 : | return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2); | ||
275 : | } | ||
276 : | } | ||
277 : | suxen_drol | 385 | |
278 : | |||
279 : | void WINAPI Configure(HWND hwnd, HINSTANCE hinst, LPTSTR lpCmdLine, int nCmdShow) | ||
280 : | { | ||
281 : | DWORD dwDriverId; | ||
282 : | |||
283 : | dwDriverId = DriverProc(0, 0, DRV_OPEN, 0, 0); | ||
284 : | if (dwDriverId != (DWORD)NULL) | ||
285 : | { | ||
286 : | DriverProc(dwDriverId, 0, ICM_CONFIGURE, 0, 0); | ||
287 : | DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0); | ||
288 : | } | ||
289 : | } |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |