1999-10-31 19:29:16 +01:00
|
|
|
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
|
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
/*
|
|
|
|
* MSACM32 library
|
|
|
|
*
|
|
|
|
* Copyright 1998 Patrik Stridvall
|
1999-10-31 19:29:16 +01:00
|
|
|
* 1999 Eric Pouech
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
1999-02-17 14:51:06 +01:00
|
|
|
#include "winbase.h"
|
1998-10-11 19:00:29 +02:00
|
|
|
#include "winerror.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "mmsystem.h"
|
2004-08-11 21:35:34 +02:00
|
|
|
#define NOBITMAP
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "mmreg.h"
|
1998-10-11 19:00:29 +02:00
|
|
|
#include "msacm.h"
|
|
|
|
#include "msacmdrv.h"
|
1999-10-31 19:29:16 +01:00
|
|
|
#include "wineacm.h"
|
1998-10-11 19:00:29 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msacm);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
/**********************************************************************/
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
HINSTANCE MSACM_hInstance32 = 0;
|
1998-10-11 19:00:29 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2002-11-05 00:53:41 +01:00
|
|
|
* DllMain (MSACM32.init)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2002-11-05 00:53:41 +01:00
|
|
|
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2002-10-22 02:46:23 +02:00
|
|
|
TRACE("%p 0x%lx %p\n", hInstDLL, fdwReason, lpvReserved);
|
1999-10-31 19:29:16 +01:00
|
|
|
|
|
|
|
switch (fdwReason) {
|
1998-10-11 19:00:29 +02:00
|
|
|
case DLL_PROCESS_ATTACH:
|
2003-06-30 22:53:48 +02:00
|
|
|
DisableThreadLibraryCalls(hInstDLL);
|
2001-01-17 23:03:18 +01:00
|
|
|
MSACM_hHeap = HeapCreate(0, 0x10000, 0);
|
|
|
|
MSACM_hInstance32 = hInstDLL;
|
|
|
|
MSACM_RegisterAllDrivers();
|
1999-10-31 19:29:16 +01:00
|
|
|
break;
|
1998-10-11 19:00:29 +02:00
|
|
|
case DLL_PROCESS_DETACH:
|
2001-01-17 23:03:18 +01:00
|
|
|
MSACM_UnregisterAllDrivers();
|
|
|
|
HeapDestroy(MSACM_hHeap);
|
2003-01-15 00:43:41 +01:00
|
|
|
MSACM_hHeap = NULL;
|
2002-12-02 19:10:57 +01:00
|
|
|
MSACM_hInstance32 = NULL;
|
1999-10-31 19:29:16 +01:00
|
|
|
break;
|
1998-10-11 19:00:29 +02:00
|
|
|
default:
|
1999-10-31 19:29:16 +01:00
|
|
|
break;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
1999-10-31 19:29:16 +01:00
|
|
|
return TRUE;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* XRegThunkEntry (MSACM32.1)
|
|
|
|
* FIXME
|
|
|
|
* No documentation found.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmGetVersion (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
DWORD WINAPI acmGetVersion(void)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-14 16:35:01 +02:00
|
|
|
OSVERSIONINFOA version;
|
2001-04-23 20:14:41 +02:00
|
|
|
|
|
|
|
version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
|
|
|
|
if (!GetVersionExA( &version ))
|
|
|
|
return 0x04030000;
|
|
|
|
|
|
|
|
switch (version.dwPlatformId) {
|
2000-08-14 16:35:01 +02:00
|
|
|
case VER_PLATFORM_WIN32_NT:
|
1999-10-31 19:29:16 +01:00
|
|
|
return 0x04000565; /* 4.0.1381 */
|
2000-08-14 16:35:01 +02:00
|
|
|
default:
|
2001-04-23 20:14:41 +02:00
|
|
|
FIXME("%lx not supported\n", version.dwPlatformId);
|
2000-08-14 16:35:01 +02:00
|
|
|
case VER_PLATFORM_WIN32_WINDOWS:
|
2001-04-23 20:14:41 +02:00
|
|
|
return 0x04030000; /* 4.3.0 */
|
|
|
|
}
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* acmMessage32 (MSACM32.35)
|
|
|
|
* FIXME
|
|
|
|
* No documentation found.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmMetrics (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2000-08-26 06:33:00 +02:00
|
|
|
MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-26 06:33:00 +02:00
|
|
|
PWINE_ACMOBJ pao = MSACM_GetObj(hao, WINE_ACMOBJ_DONTCARE);
|
1999-12-12 22:28:09 +01:00
|
|
|
BOOL bLocal = TRUE;
|
|
|
|
PWINE_ACMDRIVERID padid;
|
|
|
|
DWORD val = 0;
|
2004-09-08 03:23:57 +02:00
|
|
|
unsigned int i;
|
2000-08-26 06:33:00 +02:00
|
|
|
MMRESULT mmr = MMSYSERR_NOERROR;
|
1999-12-12 22:28:09 +01:00
|
|
|
|
2002-10-22 02:46:23 +02:00
|
|
|
TRACE("(%p, %d, %p);\n", hao, uMetric, pMetric);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-23 20:14:41 +02:00
|
|
|
#define CheckLocal(padid) (!bLocal || ((padid)->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL))
|
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
switch (uMetric) {
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_DRIVERS:
|
1999-10-31 19:29:16 +01:00
|
|
|
bLocal = FALSE;
|
2001-08-21 19:07:17 +02:00
|
|
|
/* fall through */
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_LOCAL_DRIVERS:
|
2001-04-23 20:14:41 +02:00
|
|
|
if (hao) return MMSYSERR_INVALHANDLE;
|
2004-05-03 22:09:42 +02:00
|
|
|
if (!pMetric) return MMSYSERR_INVALPARAM;
|
1999-12-12 22:28:09 +01:00
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
2001-05-22 21:21:16 +02:00
|
|
|
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
|
1999-12-12 22:28:09 +01:00
|
|
|
val++;
|
|
|
|
*(LPDWORD)pMetric = val;
|
2000-08-26 06:33:00 +02:00
|
|
|
break;
|
1999-12-12 22:28:09 +01:00
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_CODECS:
|
1999-10-31 19:29:16 +01:00
|
|
|
bLocal = FALSE;
|
2001-08-21 19:07:17 +02:00
|
|
|
/* fall through */
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_LOCAL_CODECS:
|
2001-04-23 20:14:41 +02:00
|
|
|
if (hao) return MMSYSERR_INVALHANDLE;
|
2004-05-03 22:09:42 +02:00
|
|
|
if (!pMetric) return MMSYSERR_INVALPARAM;
|
1999-12-12 22:28:09 +01:00
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
2001-05-22 21:21:16 +02:00
|
|
|
(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC) &&
|
|
|
|
CheckLocal(padid))
|
1999-12-12 22:28:09 +01:00
|
|
|
val++;
|
|
|
|
*(LPDWORD)pMetric = val;
|
2000-08-26 06:33:00 +02:00
|
|
|
break;
|
1999-12-12 22:28:09 +01:00
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_CONVERTERS:
|
1999-10-31 19:29:16 +01:00
|
|
|
bLocal = FALSE;
|
2001-08-21 19:07:17 +02:00
|
|
|
/* fall through */
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_LOCAL_CONVERTERS:
|
2001-04-23 20:14:41 +02:00
|
|
|
if (hao) return MMSYSERR_INVALHANDLE;
|
2004-05-03 22:09:42 +02:00
|
|
|
if (!pMetric) return MMSYSERR_INVALPARAM;
|
1999-12-12 22:28:09 +01:00
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
2001-05-22 21:21:16 +02:00
|
|
|
(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CONVERTER) &&
|
|
|
|
CheckLocal(padid))
|
1999-12-12 22:28:09 +01:00
|
|
|
val++;
|
|
|
|
*(LPDWORD)pMetric = val;
|
2000-08-26 06:33:00 +02:00
|
|
|
break;
|
1999-12-12 22:28:09 +01:00
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_FILTERS:
|
1999-10-31 19:29:16 +01:00
|
|
|
bLocal = FALSE;
|
2001-08-21 19:07:17 +02:00
|
|
|
/* fall through */
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_LOCAL_FILTERS:
|
2001-04-23 20:14:41 +02:00
|
|
|
if (hao) return MMSYSERR_INVALHANDLE;
|
2004-05-03 22:09:42 +02:00
|
|
|
if (!pMetric) return MMSYSERR_INVALPARAM;
|
1999-12-12 22:28:09 +01:00
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
|
|
|
(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_FILTER) &&
|
2001-05-22 21:21:16 +02:00
|
|
|
CheckLocal(padid))
|
1999-12-12 22:28:09 +01:00
|
|
|
val++;
|
|
|
|
*(LPDWORD)pMetric = val;
|
2000-08-26 06:33:00 +02:00
|
|
|
break;
|
1999-12-12 22:28:09 +01:00
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_DISABLED:
|
1999-10-31 19:29:16 +01:00
|
|
|
bLocal = FALSE;
|
2001-08-21 19:07:17 +02:00
|
|
|
/* fall through */
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_LOCAL_DISABLED:
|
2001-04-23 20:14:41 +02:00
|
|
|
if (hao) return MMSYSERR_INVALHANDLE;
|
2004-05-03 22:09:42 +02:00
|
|
|
if (!pMetric) return MMSYSERR_INVALPARAM;
|
1999-12-12 22:28:09 +01:00
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
2001-05-22 21:21:16 +02:00
|
|
|
if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
|
1999-12-12 22:28:09 +01:00
|
|
|
val++;
|
|
|
|
*(LPDWORD)pMetric = val;
|
2000-08-26 06:33:00 +02:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-12 00:05:47 +02:00
|
|
|
case ACM_METRIC_MAX_SIZE_FORMAT:
|
2002-12-02 19:10:57 +01:00
|
|
|
if (hao == NULL) {
|
2001-04-23 20:14:41 +02:00
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
2001-05-22 21:21:16 +02:00
|
|
|
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
|
2001-04-23 20:14:41 +02:00
|
|
|
for (i = 0; i < padid->cFormatTags; i++) {
|
|
|
|
if (val < padid->aFormatTag[i].cbwfx)
|
|
|
|
val = padid->aFormatTag[i].cbwfx;
|
|
|
|
}
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
|
|
|
}
|
2001-04-23 20:14:41 +02:00
|
|
|
} else if (pao != NULL) {
|
|
|
|
switch (pao->dwType) {
|
|
|
|
case WINE_ACMOBJ_DRIVER:
|
|
|
|
case WINE_ACMOBJ_DRIVERID:
|
|
|
|
padid = pao->pACMDriverID;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return MMSYSERR_INVALHANDLE;
|
|
|
|
}
|
2001-05-22 21:21:16 +02:00
|
|
|
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
|
2001-04-23 20:14:41 +02:00
|
|
|
for (i = 0; i < padid->cFormatTags; i++) {
|
|
|
|
if (val < padid->aFormatTag[i].cbwfx)
|
|
|
|
val = padid->aFormatTag[i].cbwfx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return MMSYSERR_INVALHANDLE;
|
2000-08-26 06:33:00 +02:00
|
|
|
}
|
2004-05-03 22:09:42 +02:00
|
|
|
if (!pMetric) return MMSYSERR_INVALPARAM;
|
2001-04-23 20:14:41 +02:00
|
|
|
*(LPDWORD)pMetric = val;
|
2000-08-26 06:33:00 +02:00
|
|
|
break;
|
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_HARDWARE:
|
2004-05-03 22:09:42 +02:00
|
|
|
if (hao) return MMSYSERR_INVALHANDLE;
|
|
|
|
if (!pMetric) return MMSYSERR_INVALPARAM;
|
|
|
|
*(LPDWORD)pMetric = 0;
|
|
|
|
FIXME("ACM_METRIC_COUNT_HARDWARE not implemented\n");
|
|
|
|
break;
|
|
|
|
|
2006-01-03 13:16:12 +01:00
|
|
|
case ACM_METRIC_DRIVER_PRIORITY:
|
|
|
|
/* Return current list position of driver */
|
|
|
|
if (!hao) return MMSYSERR_INVALHANDLE;
|
|
|
|
mmr = MMSYSERR_INVALHANDLE;
|
|
|
|
for (i = 1, padid = MSACM_pFirstACMDriverID; padid; i++, padid = padid->pNextACMDriverID) {
|
|
|
|
if (padid == (PWINE_ACMDRIVERID)hao) {
|
2006-01-17 15:59:59 +01:00
|
|
|
if (pMetric) {
|
|
|
|
*(LPDWORD)pMetric = i;
|
|
|
|
mmr = MMSYSERR_NOERROR;
|
|
|
|
} else {
|
|
|
|
mmr = MMSYSERR_INVALPARAM;
|
|
|
|
}
|
2006-01-03 13:16:12 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-01-17 15:59:02 +01:00
|
|
|
case ACM_METRIC_DRIVER_SUPPORT:
|
|
|
|
/* Return fdwSupport for driver */
|
|
|
|
if (!hao) return MMSYSERR_INVALHANDLE;
|
|
|
|
mmr = MMSYSERR_INVALHANDLE;
|
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
|
|
|
if (padid == (PWINE_ACMDRIVERID)hao) {
|
|
|
|
if (pMetric) {
|
|
|
|
*(LPDWORD)pMetric = padid->fdwSupport;
|
|
|
|
mmr = MMSYSERR_NOERROR;
|
|
|
|
} else {
|
|
|
|
mmr = MMSYSERR_INVALPARAM;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_HARDWARE_WAVE_INPUT:
|
|
|
|
case ACM_METRIC_HARDWARE_WAVE_OUTPUT:
|
|
|
|
case ACM_METRIC_MAX_SIZE_FILTER:
|
|
|
|
default:
|
2002-10-22 02:46:23 +02:00
|
|
|
FIXME("(%p, %d, %p): stub\n", hao, uMetric, pMetric);
|
2000-08-26 06:33:00 +02:00
|
|
|
mmr = MMSYSERR_NOTSUPPORTED;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
2000-08-26 06:33:00 +02:00
|
|
|
return mmr;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|