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
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
|
|
|
|
1999-02-17 14:51:06 +01:00
|
|
|
#include "winbase.h"
|
1998-10-11 19:00:29 +02:00
|
|
|
#include "winerror.h"
|
1999-03-14 17:35:05 +01:00
|
|
|
#include "windef.h"
|
1999-05-14 10:17:14 +02:00
|
|
|
#include "debugtools.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
|
|
|
|
2000-08-14 16:35:01 +02:00
|
|
|
DEFAULT_DEBUG_CHANNEL(msacm);
|
1999-10-31 19:29:16 +01:00
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
/**********************************************************************/
|
1999-10-31 19:29:16 +01:00
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
static DWORD MSACM_dwProcessesAttached = 0;
|
2000-08-26 06:33:00 +02:00
|
|
|
HINSTANCE MSACM_hInstance32 = 0;
|
1998-10-11 19:00:29 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* MSACM_LibMain (MSACM32.init)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
BOOL WINAPI MSACM32_LibMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
1999-10-31 19:29:16 +01:00
|
|
|
TRACE("0x%x 0x%lx %p\n", hInstDLL, fdwReason, lpvReserved);
|
|
|
|
|
|
|
|
switch (fdwReason) {
|
1998-10-11 19:00:29 +02:00
|
|
|
case DLL_PROCESS_ATTACH:
|
1999-10-31 19:29:16 +01:00
|
|
|
if (MSACM_dwProcessesAttached == 0) {
|
|
|
|
MSACM_hHeap = HeapCreate(0, 0x10000, 0);
|
2000-08-26 06:33:00 +02:00
|
|
|
MSACM_hInstance32 = hInstDLL;
|
1999-10-31 19:29:16 +01:00
|
|
|
MSACM_RegisterAllDrivers();
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
1999-10-31 19:29:16 +01:00
|
|
|
MSACM_dwProcessesAttached++;
|
|
|
|
break;
|
1998-10-11 19:00:29 +02:00
|
|
|
case DLL_PROCESS_DETACH:
|
1999-10-31 19:29:16 +01:00
|
|
|
MSACM_dwProcessesAttached--;
|
|
|
|
if (MSACM_dwProcessesAttached == 0) {
|
|
|
|
MSACM_UnregisterAllDrivers();
|
|
|
|
HeapDestroy(MSACM_hHeap);
|
|
|
|
MSACM_hHeap = (HANDLE) NULL;
|
2000-08-26 06:33:00 +02:00
|
|
|
MSACM_hInstance32 = (HINSTANCE)NULL;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
1999-10-31 19:29:16 +01:00
|
|
|
break;
|
1998-10-11 19:00:29 +02:00
|
|
|
case DLL_THREAD_ATTACH:
|
1999-10-31 19:29:16 +01:00
|
|
|
break;
|
1998-10-11 19:00:29 +02:00
|
|
|
case DLL_THREAD_DETACH:
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* acmGetVersion (MSACM32.34)
|
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;
|
|
|
|
GetVersionExA( &version );
|
|
|
|
switch(version.dwPlatformId)
|
|
|
|
{
|
|
|
|
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:
|
|
|
|
FIXME("%ld not supported",version.dwPlatformId);
|
|
|
|
case VER_PLATFORM_WIN32_WINDOWS:
|
|
|
|
return 0x04000000; /* 4.0.0 */
|
|
|
|
}
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* acmMessage32 (MSACM32.35)
|
|
|
|
* FIXME
|
|
|
|
* No documentation found.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* acmMetrics (MSACM32.36)
|
|
|
|
*/
|
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;
|
2000-08-26 06:33:00 +02:00
|
|
|
MMRESULT mmr = MMSYSERR_NOERROR;
|
1999-12-12 22:28:09 +01:00
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
TRACE("(0x%08x, %d, %p);\n", hao, uMetric, pMetric);
|
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;
|
1999-12-12 22:28:09 +01:00
|
|
|
/* fall thru */
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_LOCAL_DRIVERS:
|
1999-10-31 19:29:16 +01:00
|
|
|
if (!pao)
|
1999-12-12 22:28:09 +01:00
|
|
|
return MMSYSERR_INVALHANDLE;
|
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
|
|
|
if (padid->bEnabled /* && (local(padid) || !bLocal) */)
|
|
|
|
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-12-12 22:28:09 +01:00
|
|
|
if (!pao)
|
|
|
|
return MMSYSERR_INVALHANDLE;
|
1999-10-31 19:29:16 +01:00
|
|
|
bLocal = FALSE;
|
1999-12-12 22:28:09 +01:00
|
|
|
/* fall thru */
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_LOCAL_CODECS:
|
1999-12-12 22:28:09 +01:00
|
|
|
/* FIXME: don't know how to differentiate codec, converters & filters yet */
|
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
|
|
|
if (padid->bEnabled /* && (local(padid) || !bLocal) */)
|
|
|
|
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;
|
1999-12-12 22:28:09 +01:00
|
|
|
/* fall thru */
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_LOCAL_CONVERTERS:
|
1999-12-12 22:28:09 +01:00
|
|
|
/* FIXME: don't know how to differentiate codec, converters & filters yet */
|
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
|
|
|
if (padid->bEnabled /* && (local(padid) || !bLocal) */)
|
|
|
|
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;
|
1999-12-12 22:28:09 +01:00
|
|
|
/* fall thru */
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_LOCAL_FILTERS:
|
1999-12-12 22:28:09 +01:00
|
|
|
/* FIXME: don't know how to differentiate codec, converters & filters yet */
|
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
|
|
|
if (padid->bEnabled /* && (local(padid) || !bLocal) */)
|
|
|
|
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;
|
1999-12-12 22:28:09 +01:00
|
|
|
/* fall thru */
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_LOCAL_DISABLED:
|
1999-10-31 19:29:16 +01:00
|
|
|
if (!pao)
|
|
|
|
return MMSYSERR_INVALHANDLE;
|
1999-12-12 22:28:09 +01:00
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
|
|
|
if (!padid->bEnabled /* && (local(padid) || !bLocal) */)
|
|
|
|
val++;
|
|
|
|
*(LPDWORD)pMetric = val;
|
2000-08-26 06:33:00 +02:00
|
|
|
break;
|
2000-07-12 00:05:47 +02:00
|
|
|
|
|
|
|
case ACM_METRIC_MAX_SIZE_FORMAT:
|
2000-08-26 06:33:00 +02:00
|
|
|
{
|
|
|
|
ACMFORMATTAGDETAILSW aftd;
|
|
|
|
|
|
|
|
aftd.cbStruct = sizeof(aftd);
|
|
|
|
aftd.dwFormatTag = WAVE_FORMAT_UNKNOWN;
|
|
|
|
|
|
|
|
if (hao == (HACMOBJ)NULL) {
|
|
|
|
mmr = acmFormatTagDetailsW((HACMDRIVER)NULL, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE);
|
|
|
|
} else if (MSACM_GetObj(hao, WINE_ACMOBJ_DRIVER)) {
|
|
|
|
mmr = acmFormatTagDetailsW((HACMDRIVER)hao, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE);
|
|
|
|
} else if (MSACM_GetObj(hao, WINE_ACMOBJ_DRIVERID)) {
|
|
|
|
HACMDRIVER had;
|
|
|
|
|
|
|
|
if (acmDriverOpen(&had, (HACMDRIVERID)hao, 0) == 0) {
|
|
|
|
mmr = acmFormatTagDetailsW((HACMDRIVER)hao, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE);
|
|
|
|
acmDriverClose(had, 0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mmr = MMSYSERR_INVALHANDLE;
|
|
|
|
}
|
|
|
|
if (mmr == MMSYSERR_NOERROR) *(LPDWORD)pMetric = aftd.cbFormatSize;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
case ACM_METRIC_COUNT_HARDWARE:
|
|
|
|
case ACM_METRIC_HARDWARE_WAVE_INPUT:
|
|
|
|
case ACM_METRIC_HARDWARE_WAVE_OUTPUT:
|
|
|
|
case ACM_METRIC_MAX_SIZE_FILTER:
|
|
|
|
case ACM_METRIC_DRIVER_SUPPORT:
|
|
|
|
case ACM_METRIC_DRIVER_PRIORITY:
|
|
|
|
default:
|
2000-08-26 06:33:00 +02:00
|
|
|
FIXME("(0x%08x, %d, %p): stub\n", hao, uMetric, pMetric);
|
|
|
|
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
|
|
|
}
|