[svn] / trunk / vfw / src / driverproc.c Repository:
ViewVC logotype

Annotation of /trunk/vfw/src/driverproc.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 383 - (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 :     * 01.12.2001 inital version; (c)2001 peter ross <suxen_drol@hotmail.com>
27 :     *
28 :     *************************************************************************/
29 :    
30 :     #include <windows.h>
31 :     #include <vfw.h>
32 :    
33 :     #include "codec.h"
34 :     #include "config.h"
35 :     #include "resource.h"
36 :    
37 :    
38 :     BOOL APIENTRY DllMain(
39 :     HANDLE hModule,
40 :     DWORD ul_reason_for_call,
41 :     LPVOID lpReserved)
42 :     {
43 :     hInst = (HINSTANCE) hModule;
44 :     return TRUE;
45 :     }
46 :    
47 :    
48 :    
49 :     __declspec(dllexport) LRESULT WINAPI DriverProc(
50 :     DWORD dwDriverId,
51 :     HDRVR hDriver,
52 :     UINT uMsg,
53 :     LPARAM lParam1,
54 :     LPARAM lParam2)
55 :     {
56 :     CODEC * codec = (CODEC *)dwDriverId;
57 :    
58 :     switch(uMsg)
59 :     {
60 :    
61 :     /* driver primitives */
62 :    
63 :     case DRV_LOAD :
64 :     case DRV_FREE :
65 : suxen_drol 383 return DRV_OK;
66 : Isibaar 3
67 :     case DRV_OPEN :
68 :     DEBUG("DRV_OPEN");
69 :     {
70 :     ICOPEN * icopen = (ICOPEN *)lParam2;
71 :    
72 : h 30 if (icopen != NULL && icopen->fccType != ICTYPE_VIDEO)
73 :     {
74 : Isibaar 3 return DRV_CANCEL;
75 :     }
76 : h 61
77 : Isibaar 3 codec = malloc(sizeof(CODEC));
78 : h 61
79 : Isibaar 3 if (codec == NULL)
80 :     {
81 : h 30 if (icopen != NULL)
82 :     {
83 : Isibaar 3 icopen->dwError = ICERR_MEMORY;
84 :     }
85 :     return 0;
86 :     }
87 : h 61
88 : Isibaar 3 codec->ehandle = codec->dhandle = NULL;
89 :     config_reg_get(&codec->config);
90 :    
91 : h 61 /* bad things happen if this is uncommented
92 :     if (lstrcmp(XVID_BUILD, codec->config.build))
93 :     {
94 :     config_reg_default(&codec->config);
95 :     }
96 :     */
97 :    
98 : h 30 if (icopen != NULL)
99 :     {
100 : Isibaar 3 icopen->dwError = ICERR_OK;
101 :     }
102 :     return (LRESULT)codec;
103 :     }
104 :    
105 :     case DRV_CLOSE :
106 :     DEBUG("DRV_CLOSE");
107 :     // compress_end/decompress_end don't always get called
108 :     compress_end(codec);
109 :     decompress_end(codec);
110 :     free(codec);
111 :     return DRV_OK;
112 :    
113 :     case DRV_DISABLE :
114 :     case DRV_ENABLE :
115 :     return DRV_OK;
116 :    
117 :     case DRV_INSTALL :
118 :     case DRV_REMOVE :
119 :     return DRV_OK;
120 :    
121 :     case DRV_QUERYCONFIGURE :
122 :     case DRV_CONFIGURE :
123 :     return DRV_CANCEL;
124 :    
125 :    
126 :     /* info */
127 :    
128 :     case ICM_GETINFO :
129 :     DEBUG("ICM_GETINFO");
130 :     {
131 :     ICINFO *icinfo = (ICINFO *)lParam1;
132 :    
133 :     icinfo->fccType = ICTYPE_VIDEO;
134 :     icinfo->fccHandler = FOURCC_XVID;
135 :     icinfo->dwFlags =
136 :     VIDCF_FASTTEMPORALC |
137 :     VIDCF_FASTTEMPORALD |
138 :     VIDCF_COMPRESSFRAMES;
139 :    
140 :     icinfo->dwVersion = 0;
141 :     icinfo->dwVersionICM = ICVERSION;
142 :    
143 :     wcscpy(icinfo->szName, XVID_NAME_L);
144 :     wcscpy(icinfo->szDescription, XVID_DESC_L);
145 :    
146 :     return lParam2; /* size of struct */
147 :     }
148 :    
149 :     /* state control */
150 :    
151 :     case ICM_ABOUT :
152 : h 30 DEBUG("ICM_ABOUT");
153 :     DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)lParam1, about_proc, 0);
154 :     return ICERR_OK;
155 : Isibaar 3
156 : h 30 case ICM_CONFIGURE :
157 : Isibaar 3 DEBUG("ICM_CONFIGURE");
158 : h 30 if (lParam1 != -1)
159 :     {
160 :     CONFIG temp;
161 : Isibaar 3
162 : h 30 codec->config.save = FALSE;
163 :     memcpy(&temp, &codec->config, sizeof(CONFIG));
164 : Isibaar 3
165 : h 30 DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_MAIN), (HWND)lParam1, main_proc, (LPARAM)&temp);
166 : Isibaar 3
167 : h 30 if (temp.save)
168 :     {
169 : Isibaar 3 memcpy(&codec->config, &temp, sizeof(CONFIG));
170 : h 30 config_reg_set(&codec->config);
171 : Isibaar 3 }
172 :     }
173 :     return ICERR_OK;
174 :    
175 :     case ICM_GETSTATE :
176 :     DEBUG("ICM_GETSTATE");
177 : h 30 if ((void*)lParam1 == NULL)
178 :     {
179 : Isibaar 3 return sizeof(CONFIG);
180 :     }
181 :     memcpy((void*)lParam1, &codec->config, sizeof(CONFIG));
182 :     return ICERR_OK;
183 :    
184 :     case ICM_SETSTATE :
185 :     DEBUG("ICM_SETSTATE");
186 : h 30 if ((void*)lParam1 == NULL)
187 :     {
188 : Isibaar 3 DEBUG("ICM_SETSTATE : DEFAULT");
189 :     config_reg_get(&codec->config);
190 :     return 0;
191 :     }
192 :     memcpy(&codec->config,(void*)lParam1, sizeof(CONFIG));
193 :     return 0; // sizeof(CONFIG);
194 :    
195 :     /* not sure the difference, private/public data? */
196 :    
197 :     case ICM_GET :
198 :     case ICM_SET :
199 :     return ICERR_OK;
200 :    
201 :    
202 :     /* older-stype config */
203 :    
204 :     case ICM_GETDEFAULTQUALITY :
205 :     case ICM_GETQUALITY :
206 :     case ICM_SETQUALITY :
207 :     case ICM_GETBUFFERSWANTED :
208 :     case ICM_GETDEFAULTKEYFRAMERATE :
209 :     return ICERR_UNSUPPORTED;
210 :    
211 :    
212 :     /* compressor */
213 :    
214 :     case ICM_COMPRESS_QUERY :
215 :     DEBUG("ICM_COMPRESS_QUERY");
216 :     return compress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
217 :    
218 :     case ICM_COMPRESS_GET_FORMAT :
219 :     DEBUG("ICM_COMPRESS_GET_FORMAT");
220 :     return compress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
221 :    
222 :     case ICM_COMPRESS_GET_SIZE :
223 :     DEBUG("ICM_COMPRESS_GET_SIZE");
224 :     return compress_get_size(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
225 :    
226 :     case ICM_COMPRESS_FRAMES_INFO :
227 :     DEBUG("ICM_COMPRESS_FRAMES_INFO");
228 :     return compress_frames_info(codec, (ICCOMPRESSFRAMES *)lParam1);
229 :    
230 :     case ICM_COMPRESS_BEGIN :
231 :     DEBUG("ICM_COMPRESS_BEGIN");
232 :     return compress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
233 :    
234 :     case ICM_COMPRESS_END :
235 :     DEBUG("ICM_COMPRESS_END");
236 :     return compress_end(codec);
237 :    
238 :     case ICM_COMPRESS :
239 :     DEBUG("ICM_COMPRESS");
240 :     return compress(codec, (ICCOMPRESS *)lParam1);
241 :    
242 :     /* decompressor */
243 :    
244 :     case ICM_DECOMPRESS_QUERY :
245 :     DEBUG("ICM_DECOMPRESS_QUERY");
246 :     return decompress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
247 :    
248 :     case ICM_DECOMPRESS_GET_FORMAT :
249 :     DEBUG("ICM_DECOMPRESS_GET_FORMAT");
250 :     return decompress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
251 :    
252 :     case ICM_DECOMPRESS_BEGIN :
253 :     DEBUG("ICM_DECOMPRESS_BEGIN");
254 :     return decompress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
255 :    
256 :     case ICM_DECOMPRESS_END :
257 :     DEBUG("ICM_DECOMPRESS_END");
258 :     return decompress_end(codec);
259 :    
260 :     case ICM_DECOMPRESS :
261 :     DEBUG("ICM_DECOMPRESS");
262 :     return decompress(codec, (ICDECOMPRESS *)lParam1);
263 :    
264 :     case ICM_DECOMPRESS_GET_PALETTE :
265 :     case ICM_DECOMPRESS_SET_PALETTE :
266 :     case ICM_DECOMPRESSEX_QUERY:
267 :     case ICM_DECOMPRESSEX_BEGIN:
268 :     case ICM_DECOMPRESSEX_END:
269 :     case ICM_DECOMPRESSEX:
270 :     return ICERR_UNSUPPORTED;
271 :    
272 :     default:
273 :     return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2);
274 :     }
275 :     }

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4