1 |
/************************************************************************** |
/***************************************************************************** |
2 |
* |
* |
3 |
* XVID VFW FRONTEND |
* XVID MPEG-4 VFW FRONTEND |
4 |
* driverproc main |
* - driverproc main - |
5 |
|
* |
6 |
|
* Copyright(C) 2001-2003 Peter Ross <pross@xvid.org> |
7 |
* |
* |
8 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
17 |
* |
* |
18 |
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
19 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
20 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
* |
|
|
*************************************************************************/ |
|
|
|
|
|
/************************************************************************** |
|
21 |
* |
* |
22 |
* History: |
* $Id: driverproc.c,v 1.1.2.7 2004-01-03 12:06:11 syskin Exp $ |
23 |
* |
* |
24 |
* 31.08.2002 Configure() export |
****************************************************************************/ |
|
* 01.12.2001 inital version; (c)2001 peter ross <pross@xvid.org> |
|
|
* |
|
|
*************************************************************************/ |
|
25 |
|
|
26 |
#include <windows.h> |
#include <windows.h> |
27 |
#include <vfw.h> |
#include <vfw.h> |
28 |
|
#include "vfwext.h" |
29 |
|
|
30 |
#include "debug.h" |
#include "debug.h" |
31 |
#include "codec.h" |
#include "codec.h" |
32 |
#include "config.h" |
#include "config.h" |
33 |
|
#include "status.h" |
34 |
#include "resource.h" |
#include "resource.h" |
35 |
|
|
36 |
|
|
43 |
return TRUE; |
return TRUE; |
44 |
} |
} |
45 |
|
|
46 |
|
extern HINSTANCE m_hdll; |
47 |
|
|
48 |
/* __declspec(dllexport) */ LRESULT WINAPI DriverProc( |
/* __declspec(dllexport) */ LRESULT WINAPI DriverProc( |
49 |
DWORD dwDriverId, |
DWORD dwDriverId, |
65 |
|
|
66 |
case DRV_OPEN : |
case DRV_OPEN : |
67 |
DPRINTF("DRV_OPEN"); |
DPRINTF("DRV_OPEN"); |
68 |
|
m_hdll = NULL; |
69 |
{ |
{ |
70 |
ICOPEN * icopen = (ICOPEN *)lParam2; |
ICOPEN * icopen = (ICOPEN *)lParam2; |
71 |
|
|
85 |
return 0; |
return 0; |
86 |
} |
} |
87 |
|
|
88 |
|
|
89 |
|
codec->status.hDlg = NULL; |
90 |
|
codec->config.ci_valid = 0; |
91 |
codec->ehandle = codec->dhandle = NULL; |
codec->ehandle = codec->dhandle = NULL; |
92 |
codec->fbase = 25; |
codec->fbase = 25; |
93 |
codec->fincr = 1; |
codec->fincr = 1; |
94 |
config_reg_get(&codec->config); |
config_reg_get(&codec->config); |
95 |
|
|
96 |
/* bad things happen if this is uncommented |
#if 0 |
97 |
|
/* bad things happen if this piece of code is activated */ |
98 |
if (lstrcmp(XVID_BUILD, codec->config.build)) |
if (lstrcmp(XVID_BUILD, codec->config.build)) |
99 |
{ |
{ |
100 |
config_reg_default(&codec->config); |
config_reg_default(&codec->config); |
101 |
} |
} |
102 |
*/ |
#endif |
103 |
|
|
104 |
if (icopen != NULL) |
if (icopen != NULL) |
105 |
{ |
{ |
110 |
|
|
111 |
case DRV_CLOSE : |
case DRV_CLOSE : |
112 |
DPRINTF("DRV_CLOSE"); |
DPRINTF("DRV_CLOSE"); |
113 |
// compress_end/decompress_end don't always get called |
/* compress_end/decompress_end don't always get called */ |
114 |
compress_end(codec); |
compress_end(codec); |
115 |
decompress_end(codec); |
decompress_end(codec); |
116 |
|
status_destroy_always(&codec->status); |
117 |
free(codec); |
free(codec); |
118 |
return DRV_OK; |
return DRV_OK; |
119 |
|
|
197 |
return 0; |
return 0; |
198 |
} |
} |
199 |
memcpy(&codec->config,(void*)lParam1, sizeof(CONFIG)); |
memcpy(&codec->config,(void*)lParam1, sizeof(CONFIG)); |
200 |
return 0; // sizeof(CONFIG); |
return 0; /* sizeof(CONFIG); */ |
201 |
|
|
202 |
/* not sure the difference, private/public data? */ |
/* not sure the difference, private/public data? */ |
203 |
|
|
276 |
case ICM_DECOMPRESSEX: |
case ICM_DECOMPRESSEX: |
277 |
return ICERR_UNSUPPORTED; |
return ICERR_UNSUPPORTED; |
278 |
|
|
279 |
|
/* VFWEXT entry point */ |
280 |
|
case ICM_USER+0x0fff : |
281 |
|
if (lParam1 == VFWEXT_CONFIGURE_INFO) { |
282 |
|
VFWEXT_CONFIGURE_INFO_T * info = (VFWEXT_CONFIGURE_INFO_T*)lParam2; |
283 |
|
DPRINTF("%i %i %i %i %i %i", |
284 |
|
info->ciWidth, info->ciHeight, |
285 |
|
info->ciRate, info->ciScale, |
286 |
|
info->ciActiveFrame, info->ciFrameCount); |
287 |
|
|
288 |
|
codec->config.ci_valid = 1; |
289 |
|
memcpy(&codec->config.ci, (void*)lParam2, sizeof(VFWEXT_CONFIGURE_INFO_T)); |
290 |
|
return ICERR_OK; |
291 |
|
} |
292 |
|
return ICERR_UNSUPPORTED; |
293 |
|
|
294 |
default: |
default: |
295 |
return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2); |
return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2); |
296 |
} |
} |
304 |
dwDriverId = DriverProc(0, 0, DRV_OPEN, 0, 0); |
dwDriverId = DriverProc(0, 0, DRV_OPEN, 0, 0); |
305 |
if (dwDriverId != (DWORD)NULL) |
if (dwDriverId != (DWORD)NULL) |
306 |
{ |
{ |
307 |
DriverProc(dwDriverId, 0, ICM_CONFIGURE, 0, 0); |
DriverProc(dwDriverId, 0, ICM_CONFIGURE, (LPARAM)GetDesktopWindow(), 0); |
308 |
DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0); |
DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0); |
309 |
} |
} |
310 |
} |
} |