--- branches/dev-api-4/xvidcore/vfw/src/driverproc.c 2003/02/22 08:24:01 889 +++ branches/dev-api-4/xvidcore/vfw/src/driverproc.c 2004/01/03 12:06:11 1305 @@ -1,38 +1,36 @@ -/************************************************************************** +/***************************************************************************** * - * XVID VFW FRONTEND - * driverproc main + * XVID MPEG-4 VFW FRONTEND + * - driverproc main - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright(C) 2001-2003 Peter Ross * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is free software ; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation ; either version 2 of the License, or + * (at your option) any later version. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY ; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - *************************************************************************/ - -/************************************************************************** - * - * History: + * You should have received a copy of the GNU General Public License + * along with this program ; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * 31.08.2002 Configure() export - * 01.12.2001 inital version; (c)2001 peter ross + * $Id: driverproc.c,v 1.1.2.7 2004-01-03 12:06:11 syskin Exp $ * - *************************************************************************/ + ****************************************************************************/ #include #include +#include "vfwext.h" +#include "debug.h" #include "codec.h" #include "config.h" +#include "status.h" #include "resource.h" @@ -41,11 +39,11 @@ DWORD ul_reason_for_call, LPVOID lpReserved) { - hInst = (HINSTANCE) hModule; + g_hInst = (HINSTANCE) hModule; return TRUE; } - +extern HINSTANCE m_hdll; /* __declspec(dllexport) */ LRESULT WINAPI DriverProc( DWORD dwDriverId, @@ -66,7 +64,8 @@ return DRV_OK; case DRV_OPEN : - DEBUG("DRV_OPEN"); + DPRINTF("DRV_OPEN"); + m_hdll = NULL; { ICOPEN * icopen = (ICOPEN *)lParam2; @@ -85,18 +84,22 @@ } return 0; } - - codec->ehandle = codec->dhandle = NULL; - codec->fbase = 25; + + + codec->status.hDlg = NULL; + codec->config.ci_valid = 0; + codec->ehandle = codec->dhandle = NULL; + codec->fbase = 25; codec->fincr = 1; config_reg_get(&codec->config); - /* bad things happen if this is uncommented +#if 0 + /* bad things happen if this piece of code is activated */ if (lstrcmp(XVID_BUILD, codec->config.build)) { config_reg_default(&codec->config); } - */ +#endif if (icopen != NULL) { @@ -106,10 +109,11 @@ } case DRV_CLOSE : - DEBUG("DRV_CLOSE"); - // compress_end/decompress_end don't always get called + DPRINTF("DRV_CLOSE"); + /* compress_end/decompress_end don't always get called */ compress_end(codec); decompress_end(codec); + status_destroy_always(&codec->status); free(codec); return DRV_OK; @@ -129,7 +133,7 @@ /* info */ case ICM_GETINFO : - DEBUG("ICM_GETINFO"); + DPRINTF("ICM_GETINFO"); { ICINFO *icinfo = (ICINFO *)lParam1; @@ -152,12 +156,12 @@ /* state control */ case ICM_ABOUT : - DEBUG("ICM_ABOUT"); - DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)lParam1, about_proc, 0); + DPRINTF("ICM_ABOUT"); + DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)lParam1, about_proc, 0); return ICERR_OK; case ICM_CONFIGURE : - DEBUG("ICM_CONFIGURE"); + DPRINTF("ICM_CONFIGURE"); if (lParam1 != -1) { CONFIG temp; @@ -165,7 +169,7 @@ codec->config.save = FALSE; memcpy(&temp, &codec->config, sizeof(CONFIG)); - DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_MAIN), (HWND)lParam1, main_proc, (LPARAM)&temp); + DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_MAIN), (HWND)lParam1, main_proc, (LPARAM)&temp); if (temp.save) { @@ -176,7 +180,7 @@ return ICERR_OK; case ICM_GETSTATE : - DEBUG("ICM_GETSTATE"); + DPRINTF("ICM_GETSTATE"); if ((void*)lParam1 == NULL) { return sizeof(CONFIG); @@ -185,15 +189,15 @@ return ICERR_OK; case ICM_SETSTATE : - DEBUG("ICM_SETSTATE"); + DPRINTF("ICM_SETSTATE"); if ((void*)lParam1 == NULL) { - DEBUG("ICM_SETSTATE : DEFAULT"); + DPRINTF("ICM_SETSTATE : DEFAULT"); config_reg_get(&codec->config); return 0; } memcpy(&codec->config,(void*)lParam1, sizeof(CONFIG)); - return 0; // sizeof(CONFIG); + return 0; /* sizeof(CONFIG); */ /* not sure the difference, private/public data? */ @@ -215,53 +219,53 @@ /* compressor */ case ICM_COMPRESS_QUERY : - DEBUG("ICM_COMPRESS_QUERY"); + DPRINTF("ICM_COMPRESS_QUERY"); return compress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); case ICM_COMPRESS_GET_FORMAT : - DEBUG("ICM_COMPRESS_GET_FORMAT"); + DPRINTF("ICM_COMPRESS_GET_FORMAT"); return compress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); case ICM_COMPRESS_GET_SIZE : - DEBUG("ICM_COMPRESS_GET_SIZE"); + DPRINTF("ICM_COMPRESS_GET_SIZE"); return compress_get_size(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); case ICM_COMPRESS_FRAMES_INFO : - DEBUG("ICM_COMPRESS_FRAMES_INFO"); + DPRINTF("ICM_COMPRESS_FRAMES_INFO"); return compress_frames_info(codec, (ICCOMPRESSFRAMES *)lParam1); case ICM_COMPRESS_BEGIN : - DEBUG("ICM_COMPRESS_BEGIN"); + DPRINTF("ICM_COMPRESS_BEGIN"); return compress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); case ICM_COMPRESS_END : - DEBUG("ICM_COMPRESS_END"); + DPRINTF("ICM_COMPRESS_END"); return compress_end(codec); case ICM_COMPRESS : - DEBUG("ICM_COMPRESS"); + DPRINTF("ICM_COMPRESS"); return compress(codec, (ICCOMPRESS *)lParam1); /* decompressor */ case ICM_DECOMPRESS_QUERY : - DEBUG("ICM_DECOMPRESS_QUERY"); + DPRINTF("ICM_DECOMPRESS_QUERY"); return decompress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); case ICM_DECOMPRESS_GET_FORMAT : - DEBUG("ICM_DECOMPRESS_GET_FORMAT"); + DPRINTF("ICM_DECOMPRESS_GET_FORMAT"); return decompress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); case ICM_DECOMPRESS_BEGIN : - DEBUG("ICM_DECOMPRESS_BEGIN"); + DPRINTF("ICM_DECOMPRESS_BEGIN"); return decompress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2); case ICM_DECOMPRESS_END : - DEBUG("ICM_DECOMPRESS_END"); + DPRINTF("ICM_DECOMPRESS_END"); return decompress_end(codec); case ICM_DECOMPRESS : - DEBUG("ICM_DECOMPRESS"); + DPRINTF("ICM_DECOMPRESS"); return decompress(codec, (ICDECOMPRESS *)lParam1); case ICM_DECOMPRESS_GET_PALETTE : @@ -272,6 +276,21 @@ case ICM_DECOMPRESSEX: return ICERR_UNSUPPORTED; + /* VFWEXT entry point */ + case ICM_USER+0x0fff : + if (lParam1 == VFWEXT_CONFIGURE_INFO) { + VFWEXT_CONFIGURE_INFO_T * info = (VFWEXT_CONFIGURE_INFO_T*)lParam2; + DPRINTF("%i %i %i %i %i %i", + info->ciWidth, info->ciHeight, + info->ciRate, info->ciScale, + info->ciActiveFrame, info->ciFrameCount); + + codec->config.ci_valid = 1; + memcpy(&codec->config.ci, (void*)lParam2, sizeof(VFWEXT_CONFIGURE_INFO_T)); + return ICERR_OK; + } + return ICERR_UNSUPPORTED; + default: return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2); } @@ -285,7 +304,7 @@ dwDriverId = DriverProc(0, 0, DRV_OPEN, 0, 0); if (dwDriverId != (DWORD)NULL) { - DriverProc(dwDriverId, 0, ICM_CONFIGURE, 0, 0); + DriverProc(dwDriverId, 0, ICM_CONFIGURE, (LPARAM)GetDesktopWindow(), 0); DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0); } }