Sweden-Number/dlls/msacm/msacm32_main.c

207 lines
5.7 KiB
C
Raw Normal View History

1999-10-31 19:29:16 +01:00
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MSACM32 library
*
* Copyright 1998 Patrik Stridvall
1999-10-31 19:29:16 +01:00
* 1999 Eric Pouech
*/
#include "winbase.h"
#include "winerror.h"
1999-03-14 17:35:05 +01:00
#include "windef.h"
#include "debugtools.h"
#include "msacm.h"
#include "msacmdrv.h"
1999-10-31 19:29:16 +01:00
#include "wineacm.h"
DEFAULT_DEBUG_CHANNEL(msacm);
1999-10-31 19:29:16 +01:00
/**********************************************************************/
1999-10-31 19:29:16 +01:00
HINSTANCE MSACM_hInstance32 = 0;
/***********************************************************************
* MSACM_LibMain (MSACM32.init)
*/
1999-10-31 19:29:16 +01:00
BOOL WINAPI MSACM32_LibMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
1999-10-31 19:29:16 +01:00
TRACE("0x%x 0x%lx %p\n", hInstDLL, fdwReason, lpvReserved);
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
MSACM_hHeap = HeapCreate(0, 0x10000, 0);
MSACM_hInstance32 = hInstDLL;
MSACM_RegisterAllDrivers();
1999-10-31 19:29:16 +01:00
break;
case DLL_PROCESS_DETACH:
MSACM_UnregisterAllDrivers();
HeapDestroy(MSACM_hHeap);
MSACM_hHeap = (HANDLE)NULL;
MSACM_hInstance32 = (HINSTANCE)NULL;
1999-10-31 19:29:16 +01:00
break;
case DLL_THREAD_ATTACH:
1999-10-31 19:29:16 +01:00
break;
case DLL_THREAD_DETACH:
1999-10-31 19:29:16 +01:00
break;
default:
1999-10-31 19:29:16 +01:00
break;
}
1999-10-31 19:29:16 +01:00
return TRUE;
}
/***********************************************************************
* XRegThunkEntry (MSACM32.1)
* FIXME
* No documentation found.
*/
/***********************************************************************
* acmGetVersion (MSACM32.@)
*/
1999-10-31 19:29:16 +01:00
DWORD WINAPI acmGetVersion(void)
{
OSVERSIONINFOA version;
version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
if (!GetVersionExA( &version ))
return 0x04030000;
switch (version.dwPlatformId) {
case VER_PLATFORM_WIN32_NT:
1999-10-31 19:29:16 +01:00
return 0x04000565; /* 4.0.1381 */
default:
FIXME("%lx not supported\n", version.dwPlatformId);
case VER_PLATFORM_WIN32_WINDOWS:
return 0x04030000; /* 4.3.0 */
}
}
/***********************************************************************
* acmMessage32 (MSACM32.35)
* FIXME
* No documentation found.
*/
/***********************************************************************
* acmMetrics (MSACM32.@)
*/
MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
{
PWINE_ACMOBJ pao = MSACM_GetObj(hao, WINE_ACMOBJ_DONTCARE);
BOOL bLocal = TRUE;
PWINE_ACMDRIVERID padid;
DWORD val = 0;
int i;
MMRESULT mmr = MMSYSERR_NOERROR;
TRACE("(0x%08x, %d, %p);\n", hao, uMetric, pMetric);
1999-10-31 19:29:16 +01:00
#define CheckLocal(padid) (!bLocal || ((padid)->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL))
1999-10-31 19:29:16 +01:00
switch (uMetric) {
case ACM_METRIC_COUNT_DRIVERS:
1999-10-31 19:29:16 +01:00
bLocal = FALSE;
/* fall through */
case ACM_METRIC_COUNT_LOCAL_DRIVERS:
if (hao) return MMSYSERR_INVALHANDLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
val++;
*(LPDWORD)pMetric = val;
break;
case ACM_METRIC_COUNT_CODECS:
1999-10-31 19:29:16 +01:00
bLocal = FALSE;
/* fall through */
case ACM_METRIC_COUNT_LOCAL_CODECS:
if (hao) return MMSYSERR_INVALHANDLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC) &&
CheckLocal(padid))
val++;
*(LPDWORD)pMetric = val;
break;
case ACM_METRIC_COUNT_CONVERTERS:
1999-10-31 19:29:16 +01:00
bLocal = FALSE;
/* fall through */
case ACM_METRIC_COUNT_LOCAL_CONVERTERS:
if (hao) return MMSYSERR_INVALHANDLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CONVERTER) &&
CheckLocal(padid))
val++;
*(LPDWORD)pMetric = val;
break;
case ACM_METRIC_COUNT_FILTERS:
1999-10-31 19:29:16 +01:00
bLocal = FALSE;
/* fall through */
case ACM_METRIC_COUNT_LOCAL_FILTERS:
if (hao) return MMSYSERR_INVALHANDLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_FILTER) &&
CheckLocal(padid))
val++;
*(LPDWORD)pMetric = val;
break;
case ACM_METRIC_COUNT_DISABLED:
1999-10-31 19:29:16 +01:00
bLocal = FALSE;
/* fall through */
case ACM_METRIC_COUNT_LOCAL_DISABLED:
if (hao) return MMSYSERR_INVALHANDLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
val++;
*(LPDWORD)pMetric = val;
break;
case ACM_METRIC_MAX_SIZE_FORMAT:
if (hao == (HACMOBJ)NULL) {
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
for (i = 0; i < padid->cFormatTags; i++) {
if (val < padid->aFormatTag[i].cbwfx)
val = padid->aFormatTag[i].cbwfx;
}
}
}
} else if (pao != NULL) {
switch (pao->dwType) {
case WINE_ACMOBJ_DRIVER:
case WINE_ACMOBJ_DRIVERID:
padid = pao->pACMDriverID;
break;
default:
return MMSYSERR_INVALHANDLE;
}
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
for (i = 0; i < padid->cFormatTags; i++) {
if (val < padid->aFormatTag[i].cbwfx)
val = padid->aFormatTag[i].cbwfx;
}
}
} else {
return MMSYSERR_INVALHANDLE;
}
*(LPDWORD)pMetric = val;
break;
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:
FIXME("(0x%08x, %d, %p): stub\n", hao, uMetric, pMetric);
mmr = MMSYSERR_NOTSUPPORTED;
}
return mmr;
}