Made msacm32 really load ACM drivers.

This commit is contained in:
Eric Pouech 1999-10-31 18:29:16 +00:00 committed by Alexandre Julliard
parent 5f930d89e4
commit 1ddce71635
8 changed files with 765 additions and 624 deletions

View File

@ -8,7 +8,6 @@ MODULE = msacm32
SPEC_SRCS = msacm32.spec
C_SRCS = \
builtin.c \
driver.c \
filter.c \
format.c \

View File

@ -1,77 +0,0 @@
/*
* MSACM32 library
*
* Copyright 1998 Patrik Stridvall
*/
#include "winbase.h"
#include "winerror.h"
#include "windef.h"
#include "debugtools.h"
#include "driver.h"
#include "heap.h"
#include "mmsystem.h"
#include "msacm.h"
#include "msacmdrv.h"
/***********************************************************************
* MSACM_BuiltinDrivers
*/
LONG WINAPI MSACM_DummyDriverProc(
DWORD dwDriverId, HDRVR hdrvr, UINT msg,
LONG lParam1, LONG lParam2);
WINE_ACMBUILTINDRIVER MSACM_BuiltinDrivers[] = {
{ "MSACM.dummy", &MSACM_DummyDriverProc },
{ NULL, NULL }
};
/***********************************************************************
* MSACM_DummyDriverProc
*/
LONG WINAPI MSACM_DummyDriverProc(
DWORD dwDriverId, HDRVR hdrvr, UINT msg,
LONG lParam1, LONG lParam2)
{
switch(msg)
{
case DRV_LOAD:
case DRV_ENABLE:
case DRV_OPEN:
case DRV_CLOSE:
case DRV_DISABLE:
case DRV_FREE:
case DRV_CONFIGURE:
case DRV_QUERYCONFIGURE:
case DRV_INSTALL:
case DRV_REMOVE:
case DRV_EXITSESSION:
case DRV_EXITAPPLICATION:
case DRV_POWER:
case ACMDM_DRIVER_NOTIFY:
case ACMDM_DRIVER_DETAILS:
case ACMDM_HARDWARE_WAVE_CAPS_INPUT:
case ACMDM_HARDWARE_WAVE_CAPS_OUTPUT:
case ACMDM_FORMATTAG_DETAILS:
case ACMDM_FORMAT_DETAILS:
case ACMDM_FORMAT_SUGGEST:
case ACMDM_FILTERTAG_DETAILS:
case ACMDM_FILTER_DETAILS:
case ACMDM_STREAM_OPEN:
case ACMDM_STREAM_CLOSE:
case ACMDM_STREAM_SIZE:
case ACMDM_STREAM_CONVERT:
case ACMDM_STREAM_RESET:
case ACMDM_STREAM_PREPARE:
case ACMDM_STREAM_UNPREPARE:
case ACMDM_STREAM_UPDATE:
default:
/* FIXME: DefDriverProc not implemented */
#if 0
DefDriverProc(dwDriverId, hdrvr, msg, lParam1, lParam2);
#endif
break;
}
return 0;
}

View File

@ -1,7 +1,10 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MSACM32 library
*
* Copyright 1998 Patrik Stridvall
* 1999 Eric Pouech
*/
#include "winbase.h"
@ -14,40 +17,40 @@
#include "mmsystem.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
#include "winreg.h"
DEFAULT_DEBUG_CHANNEL(msacm)
/***********************************************************************
* acmDriverAddA (MSACM32.2)
*/
MMRESULT WINAPI acmDriverAddA(
PHACMDRIVERID phadid, HINSTANCE hinstModule,
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule,
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
{
PWINE_ACMLOCALDRIVER pld;
if(!phadid)
return MMSYSERR_INVALPARAM;
/* Check if any unknown flags */
if(fdwAdd &
~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND|
ACM_DRIVERADDF_GLOBAL))
return MMSYSERR_INVALFLAG;
/* Check if any incompatible flags */
if((fdwAdd & ACM_DRIVERADDF_FUNCTION) &&
(fdwAdd & ACM_DRIVERADDF_NOTIFYHWND))
return MMSYSERR_INVALFLAG;
pld = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMLOCALDRIVER));
pld->pfnDriverProc = (DRIVERPROC)
GetProcAddress(hinstModule, "DriverProc");
*phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, NULL, pld);
/* FIXME: lParam, dwPriority and fdwAdd ignored */
return MMSYSERR_NOERROR;
if (!phadid)
return MMSYSERR_INVALPARAM;
/* Check if any unknown flags */
if (fdwAdd &
~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND|
ACM_DRIVERADDF_GLOBAL))
return MMSYSERR_INVALFLAG;
/* Check if any incompatible flags */
if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) &&
(fdwAdd & ACM_DRIVERADDF_NOTIFYHWND))
return MMSYSERR_INVALFLAG;
/* FIXME: in fact, should GetModuleFileName(hinstModule) and do a
* LoadDriver on it, to be sure we can call SendDriverMessage on the
* hDrvr handle.
*/
*phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, NULL, hinstModule);
/* FIXME: lParam, dwPriority and fdwAdd ignored */
return MMSYSERR_NOERROR;
}
/***********************************************************************
@ -55,148 +58,147 @@ MMRESULT WINAPI acmDriverAddA(
* FIXME
* Not implemented
*/
MMRESULT WINAPI acmDriverAddW(
PHACMDRIVERID phadid, HINSTANCE hinstModule,
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
MMRESULT WINAPI acmDriverAddW(PHACMDRIVERID phadid, HINSTANCE hinstModule,
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
{
FIXME("(%p, 0x%08x, %ld, %ld, %ld): stub\n",
phadid, hinstModule, lParam, dwPriority, fdwAdd
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
FIXME("(%p, 0x%08x, %ld, %ld, %ld): stub\n",
phadid, hinstModule, lParam, dwPriority, fdwAdd);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmDriverClose (MSACM32.4)
*/
MMRESULT WINAPI acmDriverClose(
HACMDRIVER had, DWORD fdwClose)
MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
{
PWINE_ACMDRIVER p;
if(fdwClose)
return MMSYSERR_INVALFLAG;
p = MSACM_GetDriver(had);
if(!p)
return MMSYSERR_INVALHANDLE;
p->obj.pACMDriverID->pACMDriver = NULL;
/* FIXME: CloseDriver32 not implemented */
#if 0
if(p->hDrvr)
CloseDriver(p->hDrvr, 0, 0);
#endif
HeapFree(MSACM_hHeap, 0, p);
return MMSYSERR_NOERROR;
PWINE_ACMDRIVER p;
if (fdwClose)
return MMSYSERR_INVALFLAG;
p = MSACM_GetDriver(had);
if (!p)
return MMSYSERR_INVALHANDLE;
p->obj.pACMDriverID->pACMDriver = NULL;
if (p->hDrvr)
CloseDriver(p->hDrvr, 0, 0);
HeapFree(MSACM_hHeap, 0, p);
return MMSYSERR_NOERROR;
}
/***********************************************************************
* acmDriverDetailsA (MSACM32.5)
*/
MMRESULT WINAPI acmDriverDetailsA(
HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, DWORD fdwDetails)
MMRESULT WINAPI acmDriverDetailsA(HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, DWORD fdwDetails)
{
PWINE_ACMDRIVERID p;
MMRESULT mmr;
BOOL bOpenTemporary;
p = MSACM_GetDriverID(hadid);
if(!p)
return MMSYSERR_INVALHANDLE;
if(fdwDetails)
return MMSYSERR_INVALFLAG;
bOpenTemporary = !p->pACMDriver;
if(bOpenTemporary) {
bOpenTemporary = TRUE;
acmDriverOpen((PHACMDRIVER) &p->pACMDriver, hadid, 0);
}
/* FIXME
* How does the driver know if the ANSI or
* the UNICODE variant of PACMDRIVERDETAILS is used?
* It might check cbStruct or does it only accept ANSI.
*/
mmr = (MMRESULT) acmDriverMessage(
(HACMDRIVER) p->pACMDriver, ACMDM_DRIVER_DETAILS,
(LPARAM) padd, 0
);
if(bOpenTemporary) {
acmDriverClose((HACMDRIVER) p->pACMDriver, 0);
p->pACMDriver = NULL;
}
return mmr;
MMRESULT mmr;
ACMDRIVERDETAILSW addw;
addw.cbStruct = sizeof(addw);
mmr = acmDriverDetailsW(hadid, &addw, fdwDetails);
if (mmr == 0) {
padd->fccType = addw.fccType;
padd->fccComp = addw.fccComp;
padd->wMid = addw.wMid;
padd->wPid = addw.wPid;
padd->vdwACM = addw.vdwACM;
padd->vdwDriver = addw.vdwDriver;
padd->fdwSupport = addw.fdwSupport;
padd->cFormatTags = addw.cFormatTags;
padd->cFilterTags = addw.cFilterTags;
padd->hicon = addw.hicon;
lstrcpyWtoA(padd->szShortName, addw.szShortName);
lstrcpyWtoA(padd->szLongName, addw.szLongName);
lstrcpyWtoA(padd->szCopyright, addw.szCopyright);
lstrcpyWtoA(padd->szLicensing, addw.szLicensing);
lstrcpyWtoA(padd->szFeatures, addw.szFeatures);
}
return mmr;
}
/***********************************************************************
* acmDriverDetailsW (MSACM32.6)
* FIXME
* Not implemented
*/
MMRESULT WINAPI acmDriverDetailsW(
HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, DWORD fdwDetails)
MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, DWORD fdwDetails)
{
FIXME("(0x%08x, %p, %ld): stub\n", hadid, padd, fdwDetails);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
PWINE_ACMDRIVERID p;
MMRESULT mmr;
BOOL bOpenTemporary;
p = MSACM_GetDriverID(hadid);
if (!p)
return MMSYSERR_INVALHANDLE;
if (fdwDetails)
return MMSYSERR_INVALFLAG;
bOpenTemporary = !p->pACMDriver;
if (bOpenTemporary) {
bOpenTemporary = TRUE;
acmDriverOpen((PHACMDRIVER) &p->pACMDriver, hadid, 0);
}
mmr = (MMRESULT) acmDriverMessage((HACMDRIVER) p->pACMDriver, ACMDM_DRIVER_DETAILS,
(LPARAM) padd, 0);
if (bOpenTemporary) {
acmDriverClose((HACMDRIVER) p->pACMDriver, 0);
p->pACMDriver = NULL;
}
return mmr;
}
/***********************************************************************
* acmDriverEnum (MSACM32.7)
*/
MMRESULT WINAPI acmDriverEnum(
ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum)
MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum)
{
PWINE_ACMDRIVERID p;
if(!fnCallback)
{
return MMSYSERR_INVALPARAM;
PWINE_ACMDRIVERID p;
if (!fnCallback) {
return MMSYSERR_INVALPARAM;
}
if(fdwEnum && ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED))
{
return MMSYSERR_INVALFLAG;
if (fdwEnum && ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED)) {
return MMSYSERR_INVALFLAG;
}
p = MSACM_pFirstACMDriverID;
while(p)
{
(*fnCallback)((HACMDRIVERID) p, dwInstance, ACMDRIVERDETAILS_SUPPORTF_CODEC);
p = p->pNextACMDriverID;
p = MSACM_pFirstACMDriverID;
while (p) {
(*fnCallback)((HACMDRIVERID) p, dwInstance, ACMDRIVERDETAILS_SUPPORTF_CODEC);
p = p->pNextACMDriverID;
}
return MMSYSERR_NOERROR;
return MMSYSERR_NOERROR;
}
/***********************************************************************
* acmDriverID (MSACM32.8)
*/
MMRESULT WINAPI acmDriverID(
HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID)
MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID)
{
PWINE_ACMOBJ pao;
pao = MSACM_GetObj(hao);
if(!pao)
return MMSYSERR_INVALHANDLE;
if(!phadid)
return MMSYSERR_INVALPARAM;
if(fdwDriverID)
return MMSYSERR_INVALFLAG;
*phadid = (HACMDRIVERID) pao->pACMDriverID;
return MMSYSERR_NOERROR;
PWINE_ACMOBJ pao;
pao = MSACM_GetObj(hao);
if (!pao)
return MMSYSERR_INVALHANDLE;
if (!phadid)
return MMSYSERR_INVALPARAM;
if (fdwDriverID)
return MMSYSERR_INVALFLAG;
*phadid = (HACMDRIVERID) pao->pACMDriverID;
return MMSYSERR_NOERROR;
}
/***********************************************************************
@ -204,149 +206,142 @@ MMRESULT WINAPI acmDriverID(
* FIXME
* Not implemented
*/
LRESULT WINAPI acmDriverMessage(
HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
{
PWINE_ACMDRIVER pad = MSACM_GetDriver(had);
if(!pad)
return MMSYSERR_INVALPARAM;
/* FIXME: Check if uMsg legal */
if(!SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2))
return MMSYSERR_NOTSUPPORTED;
return MMSYSERR_NOERROR;
PWINE_ACMDRIVER pad = MSACM_GetDriver(had);
if (!pad)
return MMSYSERR_INVALPARAM;
/* FIXME: Check if uMsg legal */
if (!SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2))
return MMSYSERR_NOTSUPPORTED;
return MMSYSERR_NOERROR;
}
/***********************************************************************
* acmDriverOpen (MSACM32.10)
*/
MMRESULT WINAPI acmDriverOpen(
PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen)
MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen)
{
PWINE_ACMDRIVERID padid;
PWINE_ACMDRIVERID padid;
if(!phad)
return MMSYSERR_INVALPARAM;
TRACE("(%p, %x, %08lu\n", phad, hadid, fdwOpen);
padid = MSACM_GetDriverID(hadid);
if(!padid)
return MMSYSERR_INVALHANDLE;
if(fdwOpen)
return MMSYSERR_INVALFLAG;
if(padid->pACMDriver)
{
/* FIXME: Is it allowed? */
ERR("Can't open driver twice\n");
return MMSYSERR_ERROR;
if (!phad)
return MMSYSERR_INVALPARAM;
padid = MSACM_GetDriverID(hadid);
if (!padid)
return MMSYSERR_INVALHANDLE;
if (fdwOpen)
return MMSYSERR_INVALFLAG;
if (padid->pACMDriver) {
/* FIXME: Is it allowed? */
ERR("Can't open driver twice\n");
return MMSYSERR_ERROR;
}
padid->pACMDriver = HeapAlloc(
MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER)
);
padid->pACMDriver->obj.pACMDriverID = padid;
if(!padid->pACMLocalDriver)
padid->pACMDriver->hDrvr =
OpenDriverA(padid->pszDriverAlias, "drivers32", 0);
else
{
padid->pACMDriver->hDrvr = MSACM_OpenDriverProc(
padid->pACMLocalDriver->pfnDriverProc
);
padid->pACMDriver = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
padid->pACMDriver->obj.pACMDriverID = padid;
if (!padid->hInstModule)
padid->pACMDriver->hDrvr = OpenDriverA(padid->pszDriverAlias, "drivers32", 0);
else
padid->pACMDriver->hDrvr = padid->hInstModule;
if (!padid->pACMDriver->hDrvr) {
HeapFree(MSACM_hHeap, 0, padid->pACMDriver);
padid->pACMDriver = NULL;
return MMSYSERR_ERROR;
}
if(!padid->pACMDriver->hDrvr)
return MMSYSERR_ERROR;
/* FIXME: Create a WINE_ACMDRIVER32 */
*phad = (HACMDRIVER) NULL;
return MMSYSERR_ERROR;
padid->pACMDriver->pfnDriverProc = GetProcAddress(padid->pACMDriver->hDrvr, "DriverProc");
/* FIXME: Create a WINE_ACMDRIVER32 */
*phad = (HACMDRIVER) padid->pACMDriver;
return MMSYSERR_NOERROR;
}
/***********************************************************************
* acmDriverPriority (MSACM32.11)
*/
MMRESULT WINAPI acmDriverPriority(
HACMDRIVERID hadid, DWORD dwPriority, DWORD fdwPriority)
MMRESULT WINAPI acmDriverPriority(HACMDRIVERID hadid, DWORD dwPriority, DWORD fdwPriority)
{
PWINE_ACMDRIVERID padid;
CHAR szSubKey[17];
CHAR szBuffer[256];
LONG lBufferLength = sizeof(szBuffer);
LONG lError;
HKEY hPriorityKey;
DWORD dwPriorityCounter;
padid = MSACM_GetDriverID(hadid);
if(!padid)
return MMSYSERR_INVALHANDLE;
/* Check for unknown flags */
if(fdwPriority &
~(ACM_DRIVERPRIORITYF_ENABLE|ACM_DRIVERPRIORITYF_DISABLE|
ACM_DRIVERPRIORITYF_BEGIN|ACM_DRIVERPRIORITYF_END))
return MMSYSERR_INVALFLAG;
/* Check for incompatible flags */
if((fdwPriority & ACM_DRIVERPRIORITYF_ENABLE) &&
(fdwPriority & ACM_DRIVERPRIORITYF_DISABLE))
return MMSYSERR_INVALFLAG;
/* Check for incompatible flags */
if((fdwPriority & ACM_DRIVERPRIORITYF_BEGIN) &&
(fdwPriority & ACM_DRIVERPRIORITYF_END))
return MMSYSERR_INVALFLAG;
lError = RegOpenKeyA(HKEY_CURRENT_USER,
"Software\\Microsoft\\Multimedia\\"
"Audio Compression Manager\\Priority v4.00",
&hPriorityKey
);
/* FIXME: Create key */
if(lError != ERROR_SUCCESS)
PWINE_ACMDRIVERID padid;
CHAR szSubKey[17];
CHAR szBuffer[256];
LONG lBufferLength = sizeof(szBuffer);
LONG lError;
HKEY hPriorityKey;
DWORD dwPriorityCounter;
padid = MSACM_GetDriverID(hadid);
if (!padid)
return MMSYSERR_INVALHANDLE;
/* Check for unknown flags */
if (fdwPriority &
~(ACM_DRIVERPRIORITYF_ENABLE|ACM_DRIVERPRIORITYF_DISABLE|
ACM_DRIVERPRIORITYF_BEGIN|ACM_DRIVERPRIORITYF_END))
return MMSYSERR_INVALFLAG;
/* Check for incompatible flags */
if ((fdwPriority & ACM_DRIVERPRIORITYF_ENABLE) &&
(fdwPriority & ACM_DRIVERPRIORITYF_DISABLE))
return MMSYSERR_INVALFLAG;
/* Check for incompatible flags */
if ((fdwPriority & ACM_DRIVERPRIORITYF_BEGIN) &&
(fdwPriority & ACM_DRIVERPRIORITYF_END))
return MMSYSERR_INVALFLAG;
lError = RegOpenKeyA(HKEY_CURRENT_USER,
"Software\\Microsoft\\Multimedia\\"
"Audio Compression Manager\\Priority v4.00",
&hPriorityKey
);
/* FIXME: Create key */
if (lError != ERROR_SUCCESS)
return MMSYSERR_ERROR;
for (dwPriorityCounter = 1; ; dwPriorityCounter++) {
wsnprintfA(szSubKey, 17, "Priorty%ld", dwPriorityCounter);
lError = RegQueryValueA(hPriorityKey, szSubKey, szBuffer, &lBufferLength);
if (lError != ERROR_SUCCESS)
break;
FIXME("(0x%08x, %ld, %ld): stub (partial)\n",
hadid, dwPriority, fdwPriority);
break;
}
RegCloseKey(hPriorityKey);
return MMSYSERR_ERROR;
for(dwPriorityCounter = 1; ; dwPriorityCounter++)
{
wsnprintfA(szSubKey, 17, "Priorty%ld", dwPriorityCounter);
lError = RegQueryValueA(hPriorityKey, szSubKey, szBuffer, &lBufferLength);
if(lError != ERROR_SUCCESS)
break;
FIXME("(0x%08x, %ld, %ld): stub (partial)\n",
hadid, dwPriority, fdwPriority
);
break;
}
RegCloseKey(hPriorityKey);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmDriverRemove (MSACM32.12)
*/
MMRESULT WINAPI acmDriverRemove(
HACMDRIVERID hadid, DWORD fdwRemove)
MMRESULT WINAPI acmDriverRemove(HACMDRIVERID hadid, DWORD fdwRemove)
{
PWINE_ACMDRIVERID padid;
padid = MSACM_GetDriverID(hadid);
if(!padid)
return MMSYSERR_INVALHANDLE;
if(fdwRemove)
return MMSYSERR_INVALFLAG;
MSACM_UnregisterDriver(padid);
return MMSYSERR_NOERROR;
PWINE_ACMDRIVERID padid;
padid = MSACM_GetDriverID(hadid);
if (!padid)
return MMSYSERR_INVALHANDLE;
if (fdwRemove)
return MMSYSERR_INVALFLAG;
MSACM_UnregisterDriver(padid);
return MMSYSERR_NOERROR;
}

View File

@ -1,7 +1,10 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MSACM32 library
*
* Copyright 1998 Patrik Stridvall
* 1999 Eric Pouech
*/
#include <string.h>
@ -14,8 +17,11 @@
#include "mmsystem.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(msacm)
/**********************************************************************/
HANDLE MSACM_hHeap = (HANDLE) NULL;
@ -25,89 +31,66 @@ PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL;
/***********************************************************************
* MSACM_RegisterDriver32()
*/
PWINE_ACMDRIVERID MSACM_RegisterDriver(
LPSTR pszDriverAlias, LPSTR pszFileName,
PWINE_ACMLOCALDRIVER pLocalDriver)
{
PWINE_ACMDRIVERID padid;
padid = (PWINE_ACMDRIVERID) HeapAlloc(
MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)
);
padid->pszDriverAlias =
HEAP_strdupA(MSACM_hHeap, 0, pszDriverAlias);
padid->pszFileName =
HEAP_strdupA(MSACM_hHeap, 0, pszFileName);
padid->pACMLocalDriver = pLocalDriver;
padid->bEnabled = TRUE;
padid->pACMDriver = NULL;
padid->pNextACMDriverID = NULL;
padid->pPreviousACMDriverID =
MSACM_pLastACMDriverID;
MSACM_pLastACMDriverID = padid;
if(!MSACM_pFirstACMDriverID)
MSACM_pFirstACMDriverID = padid;
PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
HINSTANCE hinstModule)
{
PWINE_ACMDRIVERID padid;
return padid;
TRACE("('%s', '%s', 0x%08x)\n", pszDriverAlias, pszFileName, hinstModule);
padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
padid->pszDriverAlias = HEAP_strdupA(MSACM_hHeap, 0, pszDriverAlias);
padid->pszFileName = HEAP_strdupA(MSACM_hHeap, 0, pszFileName);
padid->hInstModule = hinstModule;
padid->bEnabled = TRUE;
padid->pACMDriver = NULL;
padid->pNextACMDriverID = NULL;
padid->pPreviousACMDriverID = MSACM_pLastACMDriverID;
if (MSACM_pLastACMDriverID)
MSACM_pLastACMDriverID->pNextACMDriverID = padid;
MSACM_pLastACMDriverID = padid;
if (!MSACM_pFirstACMDriverID)
MSACM_pFirstACMDriverID = padid;
return padid;
}
/***********************************************************************
* MSACM_RegisterAllDrivers32()
*/
void MSACM_RegisterAllDrivers()
void MSACM_RegisterAllDrivers(void)
{
PWINE_ACMBUILTINDRIVER pbd;
LPSTR pszBuffer;
DWORD dwBufferLength;
/* FIXME
* What if the user edits system.ini while the program is running?
* Does Windows handle that?
*/
if(!MSACM_pFirstACMDriverID)
return;
/* FIXME: Do not work! How do I determine the section length? */
dwBufferLength =
GetPrivateProfileSectionA("drivers32", NULL, 0, "system.ini");
pszBuffer = (LPSTR) HeapAlloc(
MSACM_hHeap, 0, dwBufferLength
);
if(GetPrivateProfileSectionA(
"drivers32", pszBuffer, dwBufferLength, "system.ini"))
{
char *s = pszBuffer;
while(*s)
{
if(!lstrncmpiA("MSACM.", s, 6))
{
char *s2 = s;
while(*s2 != '\0' && *s2 != '=') s2++;
if(*s2)
{
*s2++='\0';
MSACM_RegisterDriver(s, s2, NULL);
LPSTR pszBuffer;
DWORD dwBufferLength;
/* FIXME
* What if the user edits system.ini while the program is running?
* Does Windows handle that?
*/
if (MSACM_pFirstACMDriverID)
return;
/* FIXME: Do not work! How do I determine the section length? */
dwBufferLength = 1024;
/* EPP GetPrivateProfileSectionA("drivers32", NULL, 0, "system.ini"); */
pszBuffer = (LPSTR) HeapAlloc(MSACM_hHeap, 0, dwBufferLength);
if (GetPrivateProfileSectionA("drivers32", pszBuffer, dwBufferLength, "system.ini")) {
char* s = pszBuffer;
while (*s) {
if (!lstrncmpiA("MSACM.", s, 6)) {
char *s2 = s;
while (*s2 != '\0' && *s2 != '=') s2++;
if (*s2) {
*s2++ = '\0';
MSACM_RegisterDriver(s, s2, 0);
}
}
s += lstrlenA(s) + 1; /* Either next char or \0 */
s += lstrlenA(s) + 1; /* Either next char or \0 */
}
}
/* FIXME
* Check if any of the builtin driver was added
* when the external drivers was.
*/
pbd = MSACM_BuiltinDrivers;
while(pbd->pszDriverAlias)
{
PWINE_ACMLOCALDRIVER pld;
pld = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMLOCALDRIVER));
pld->pfnDriverProc = pbd->pfnDriverProc;
MSACM_RegisterDriver(pbd->pszDriverAlias, NULL, pld);
pbd++;
}
HeapFree(MSACM_hHeap, 0, pszBuffer);
HeapFree(MSACM_hHeap, 0, pszBuffer);
}
/***********************************************************************
@ -115,28 +98,31 @@ void MSACM_RegisterAllDrivers()
*/
PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
{
PWINE_ACMDRIVERID pNextACMDriverID;
PWINE_ACMDRIVERID pNextACMDriverID;
if (p->pACMDriver)
acmDriverClose((HACMDRIVER) p->pACMDriver, 0);
if (p->pszDriverAlias)
HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);
if (p->pszFileName)
HeapFree(MSACM_hHeap, 0, p->pszFileName);
if (p == MSACM_pFirstACMDriverID)
MSACM_pFirstACMDriverID = p->pNextACMDriverID;
if (p == MSACM_pLastACMDriverID)
MSACM_pLastACMDriverID = p->pPreviousACMDriverID;
if(p->pACMDriver)
acmDriverClose((HACMDRIVER) p->pACMDriver, 0);
if(p->pszDriverAlias)
HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);
if(p->pszFileName)
HeapFree(MSACM_hHeap, 0, p->pszFileName);
if(p->pACMLocalDriver)
HeapFree(MSACM_hHeap, 0, p->pACMLocalDriver);
if(p->pPreviousACMDriverID)
p->pPreviousACMDriverID->pNextACMDriverID = p->pNextACMDriverID;
if(p->pNextACMDriverID)
p->pNextACMDriverID->pPreviousACMDriverID = p->pPreviousACMDriverID;
pNextACMDriverID = p->pNextACMDriverID;
HeapFree(MSACM_hHeap, 0, p);
return pNextACMDriverID;
if (p->pPreviousACMDriverID)
p->pPreviousACMDriverID->pNextACMDriverID = p->pNextACMDriverID;
if (p->pNextACMDriverID)
p->pNextACMDriverID->pPreviousACMDriverID = p->pPreviousACMDriverID;
pNextACMDriverID = p->pNextACMDriverID;
HeapFree(MSACM_hHeap, 0, p);
return pNextACMDriverID;
}
/***********************************************************************
@ -144,10 +130,11 @@ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
* FIXME
* Where should this function be called?
*/
void MSACM_UnregisterAllDrivers()
void MSACM_UnregisterAllDrivers(void)
{
PWINE_ACMDRIVERID p = MSACM_pFirstACMDriverID;
while(p) p = MSACM_UnregisterDriver(p);
PWINE_ACMDRIVERID p;
for (p = MSACM_pFirstACMDriverID; p; p = MSACM_UnregisterDriver(p));
}
/***********************************************************************
@ -155,7 +142,7 @@ void MSACM_UnregisterAllDrivers()
*/
PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID)
{
return (PWINE_ACMDRIVERID) hDriverID;
return (PWINE_ACMDRIVERID)hDriverID;
}
/***********************************************************************
@ -163,7 +150,7 @@ PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID)
*/
PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver)
{
return (PWINE_ACMDRIVER) hDriver;
return (PWINE_ACMDRIVER)hDriver;
}
/***********************************************************************
@ -171,32 +158,7 @@ PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver)
*/
PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj)
{
return (PWINE_ACMOBJ) hObj;
}
/***********************************************************************
* MSACM_OpenDriverProc32
* FIXME
* This function should be integrated with OpenDriver,
* renamed and moved there.
*/
HDRVR MSACM_OpenDriverProc(DRIVERPROC pfnDriverProc)
{
#if 0
LPDRIVERITEMA pDrvr;
/* FIXME: This is a very bad solution */
pDrvr = (LPDRIVERITEMA) HeapAlloc(MSACM_hHeap, HEAP_ZERO_MEMORY, sizeof(DRIVERITEMA));
pDrvr->count = 1;
pDrvr->driverproc = pfnDriverProc;
/* FIXME: Send DRV_OPEN among others to DriverProc */
return (HDRVR) pDrvr;
#else
return (HDRVR) 0;
#endif
return (PWINE_ACMOBJ)hObj;
}

View File

@ -1,7 +1,10 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MSACM32 library
*
* Copyright 1998 Patrik Stridvall
* 1999 Eric Pouech
*/
#include "winbase.h"
@ -10,47 +13,46 @@
#include "debugtools.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
#include "winversion.h"
DEFAULT_DEBUG_CHANNEL(msacm)
/**********************************************************************/
static DWORD MSACM_dwProcessesAttached = 0;
/***********************************************************************
* MSACM_LibMain32 (MSACM32.init)
*/
BOOL WINAPI MSACM32_LibMain(
HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
BOOL WINAPI MSACM32_LibMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch(fdwReason)
{
TRACE("0x%x 0x%lx %p\n", hInstDLL, fdwReason, lpvReserved);
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
if(MSACM_dwProcessesAttached == 0)
{
MSACM_hHeap = HeapCreate(0, 0x10000, 0);
MSACM_RegisterAllDrivers();
if (MSACM_dwProcessesAttached == 0) {
MSACM_hHeap = HeapCreate(0, 0x10000, 0);
MSACM_RegisterAllDrivers();
}
MSACM_dwProcessesAttached++;
break;
MSACM_dwProcessesAttached++;
break;
case DLL_PROCESS_DETACH:
MSACM_dwProcessesAttached--;
if(MSACM_dwProcessesAttached == 0)
{
MSACM_UnregisterAllDrivers();
HeapDestroy(MSACM_hHeap);
MSACM_hHeap = (HANDLE) NULL;
MSACM_dwProcessesAttached--;
if (MSACM_dwProcessesAttached == 0) {
MSACM_UnregisterAllDrivers();
HeapDestroy(MSACM_hHeap);
MSACM_hHeap = (HANDLE) NULL;
}
break;
break;
case DLL_THREAD_ATTACH:
break;
break;
case DLL_THREAD_DETACH:
break;
break;
default:
break;
break;
}
return TRUE;
return TRUE;
}
/***********************************************************************
@ -62,16 +64,15 @@ BOOL WINAPI MSACM32_LibMain(
/***********************************************************************
* acmGetVersion32 (MSACM32.34)
*/
DWORD WINAPI acmGetVersion()
DWORD WINAPI acmGetVersion(void)
{
switch(VERSION_GetVersion())
{
switch (VERSION_GetVersion()) {
default:
FIXME("%s not supported\n", VERSION_GetVersionName());
FIXME("%s not supported\n", VERSION_GetVersionName());
case WIN95:
return 0x04000000; /* 4.0.0 */
return 0x04000000; /* 4.0.0 */
case NT40:
return 0x04000565; /* 4.0.1381 */
return 0x04000565; /* 4.0.1381 */
}
}
@ -84,40 +85,38 @@ DWORD WINAPI acmGetVersion()
/***********************************************************************
* acmMetrics (MSACM32.36)
*/
MMRESULT WINAPI acmMetrics(
HACMOBJ hao, UINT uMetric, LPVOID pMetric)
MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
{
PWINE_ACMOBJ pao = MSACM_GetObj(hao);
BOOL bLocal = TRUE;
FIXME("(0x%08x, %d, %p): stub\n", hao, uMetric, pMetric);
switch(uMetric)
{
PWINE_ACMOBJ pao = MSACM_GetObj(hao);
BOOL bLocal = TRUE;
FIXME("(0x%08x, %d, %p): stub\n", hao, uMetric, pMetric);
switch (uMetric) {
case ACM_METRIC_COUNT_DRIVERS:
bLocal = FALSE;
bLocal = FALSE;
case ACM_METRIC_COUNT_LOCAL_DRIVERS:
if(!pao)
return MMSYSERR_INVALHANDLE;
return MMSYSERR_NOTSUPPORTED;
if (!pao)
return MMSYSERR_INVALHANDLE;
return MMSYSERR_NOTSUPPORTED;
case ACM_METRIC_COUNT_CODECS:
bLocal = FALSE;
bLocal = FALSE;
case ACM_METRIC_COUNT_LOCAL_CODECS:
return MMSYSERR_NOTSUPPORTED;
return MMSYSERR_NOTSUPPORTED;
case ACM_METRIC_COUNT_CONVERTERS:
bLocal = FALSE;
bLocal = FALSE;
case ACM_METRIC_COUNT_LOCAL_CONVERTERS:
return MMSYSERR_NOTSUPPORTED;
return MMSYSERR_NOTSUPPORTED;
case ACM_METRIC_COUNT_FILTERS:
bLocal = FALSE;
bLocal = FALSE;
case ACM_METRIC_COUNT_LOCAL_FILTERS:
return MMSYSERR_NOTSUPPORTED;
return MMSYSERR_NOTSUPPORTED;
case ACM_METRIC_COUNT_DISABLED:
bLocal = FALSE;
bLocal = FALSE;
case ACM_METRIC_COUNT_LOCAL_DISABLED:
if(!pao)
return MMSYSERR_INVALHANDLE;
return MMSYSERR_NOTSUPPORTED;
if (!pao)
return MMSYSERR_INVALHANDLE;
return MMSYSERR_NOTSUPPORTED;
case ACM_METRIC_COUNT_HARDWARE:
case ACM_METRIC_HARDWARE_WAVE_INPUT:
case ACM_METRIC_HARDWARE_WAVE_OUTPUT:
@ -126,7 +125,7 @@ MMRESULT WINAPI acmMetrics(
case ACM_METRIC_DRIVER_SUPPORT:
case ACM_METRIC_DRIVER_PRIORITY:
default:
return MMSYSERR_NOTSUPPORTED;
return MMSYSERR_NOTSUPPORTED;
}
return MMSYSERR_NOERROR;
return MMSYSERR_NOERROR;
}

View File

@ -1,7 +1,17 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MSACM32 library
*
* Copyright 1998 Patrik Stridvall
* 1999 Eric Pouech
*/
/* TODO
* + asynchronous conversion is not implemented
* + callback/notification
* * acmStreamMessage
* + properly close ACM streams
*/
#include "winbase.h"
@ -11,106 +21,369 @@
#include "mmsystem.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
DEFAULT_DEBUG_CHANNEL(msacm)
static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has)
{
return (PWINE_ACMSTREAM)has;
}
/***********************************************************************
* acmStreamClose (MSACM32.37)
*/
MMRESULT WINAPI acmStreamClose(
HACMSTREAM has, DWORD fdwClose)
MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose)
{
FIXME("(0x%08x, %ld): stub\n", has, fdwClose);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
PWINE_ACMSTREAM was;
MMRESULT ret;
TRACE("(0x%08x, %ld)\n", has, fdwClose);
if ((was = ACM_GetStream(has)) == NULL) {
return MMSYSERR_INVALHANDLE;
}
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CLOSE, (DWORD)&was->drvInst, 0);
if (ret == MMSYSERR_NOERROR) {
/* FIXME: shall the was->pDrv->hDrvr be also closed ? */
HeapFree(MSACM_hHeap, 0, was);
}
TRACE("=> (%d)\n", ret);
return ret;
}
/***********************************************************************
* acmStreamConvert (MSACM32.38)
*/
MMRESULT WINAPI acmStreamConvert(
HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwConvert)
MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash,
DWORD fdwConvert)
{
FIXME("(0x%08x, %p, %ld): stub\n", has, pash, fdwConvert);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
PWINE_ACMSTREAM was;
MMRESULT ret = MMSYSERR_NOERROR;
PACMDRVSTREAMHEADER padsh;
TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwConvert);
if ((was = ACM_GetStream(has)) == NULL)
return MMSYSERR_INVALHANDLE;
if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER))
return MMSYSERR_INVALPARAM;
if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED))
return ACMERR_UNPREPARED;
/* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same
* size. some fields are private to msacm internals, and are exposed
* in ACMSTREAMHEADER in the dwReservedDriver array
*/
padsh = (PACMDRVSTREAMHEADER)pash;
/* check that pointers have not been modified */
if (padsh->pbPreparedSrc != padsh->pbSrc ||
padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
padsh->pbPreparedDst != padsh->pbDst ||
padsh->cbPreparedDstLength < padsh->cbDstLength) {
return MMSYSERR_INVALPARAM;
}
padsh->fdwConvert = fdwConvert;
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CONVERT, (DWORD)&was->drvInst, (DWORD)padsh);
if (ret == MMSYSERR_NOERROR) {
padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_DONE;
}
TRACE("=> (%d)\n", ret);
return ret;
}
/***********************************************************************
* acmStreamMessage (MSACM32.39)
*/
MMRESULT WINAPI acmStreamMessage(
HACMSTREAM has, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
MMRESULT WINAPI acmStreamMessage(HACMSTREAM has, UINT uMsg, LPARAM lParam1,
LPARAM lParam2)
{
FIXME("(0x%08x, %u, %ld, %ld): stub\n",
has, uMsg, lParam1, lParam2
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
FIXME("(0x%08x, %u, %ld, %ld): stub\n", has, uMsg, lParam1, lParam2);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmStreamOpen (MSACM32.40)
*/
MMRESULT WINAPI acmStreamOpen(
PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback,
DWORD dwInstance, DWORD fdwOpen)
MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback,
DWORD dwInstance, DWORD fdwOpen)
{
FIXME("(%p, 0x%08x, %p, %p, %p, %ld, %ld, %ld): stub\n",
phas, had, pwfxSrc, pwfxDst, pwfltr,
dwCallback, dwInstance, fdwOpen
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
PWINE_ACMSTREAM was;
PWINE_ACMDRIVER wad;
MMRESULT ret;
int wfxSrcSize;
int wfxDstSize;
TRACE("(%p, 0x%08x, %p, %p, %p, %ld, %ld, %ld)\n",
phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen);
TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n",
pwfxSrc->wFormatTag, pwfxSrc->nChannels, pwfxSrc->nSamplesPerSec, pwfxSrc->nAvgBytesPerSec,
pwfxSrc->nBlockAlign, pwfxSrc->wBitsPerSample, pwfxSrc->cbSize);
TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n",
pwfxDst->wFormatTag, pwfxDst->nChannels, pwfxDst->nSamplesPerSec, pwfxDst->nAvgBytesPerSec,
pwfxDst->nBlockAlign, pwfxDst->wBitsPerSample, pwfxDst->cbSize);
#define SIZEOF_WFX(wfx) (sizeof(WAVEFORMATEX) + ((wfx->wFormatTag == WAVE_FORMAT_PCM) ? 0 : wfx->cbSize))
wfxSrcSize = SIZEOF_WFX(pwfxSrc);
wfxDstSize = SIZEOF_WFX(pwfxDst);
#undef SIZEOF_WFX
was = HeapAlloc(MSACM_hHeap, 0, sizeof(*was) + wfxSrcSize + wfxDstSize + ((pwfltr) ? sizeof(WAVEFILTER) : 0));
if (was == NULL)
return MMSYSERR_NOMEM;
was->drvInst.cbStruct = sizeof(was->drvInst);
was->drvInst.pwfxSrc = (PWAVEFORMATEX)((LPSTR)was + sizeof(*was));
memcpy(was->drvInst.pwfxSrc, pwfxSrc, wfxSrcSize);
was->drvInst.pwfxDst = (PWAVEFORMATEX)((LPSTR)was + sizeof(*was) + wfxSrcSize);
memcpy(was->drvInst.pwfxDst, pwfxDst, wfxDstSize);
if (pwfltr) {
was->drvInst.pwfltr = (PWAVEFILTER)((LPSTR)was + sizeof(*was) + wfxSrcSize + wfxDstSize);
memcpy(was->drvInst.pwfltr, pwfltr, sizeof(WAVEFILTER));
} else {
was->drvInst.pwfltr = NULL;
}
was->drvInst.dwCallback = dwCallback;
was->drvInst.dwInstance = dwInstance;
was->drvInst.fdwOpen = fdwOpen;
was->drvInst.fdwDriver = 0L;
was->drvInst.dwDriver = 0L;
was->drvInst.has = (HACMSTREAM)was;
if (had) {
if (!(wad = MSACM_GetDriver(had))) {
ret = MMSYSERR_INVALPARAM;
goto errCleanUp;
}
was->obj.pACMDriverID = wad->obj.pACMDriverID;
was->pDrv = wad;
ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);
if (ret != MMSYSERR_NOERROR)
goto errCleanUp;
} else {
PWINE_ACMDRIVERID wadi;
ret = ACMERR_NOTPOSSIBLE;
for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) {
ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L);
if (ret == MMSYSERR_NOERROR) {
if ((wad = MSACM_GetDriver(had)) != 0) {
was->obj.pACMDriverID = wad->obj.pACMDriverID;
was->pDrv = wad;
ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);
/* FIXME: when shall the acmDriver be Close():d ? */
if (ret == MMSYSERR_NOERROR)
break;
}
/* no match, close this acm driver and try next one */
acmDriverClose(had, 0L);
}
}
if (ret != MMSYSERR_NOERROR) {
ret = ACMERR_NOTPOSSIBLE;
goto errCleanUp;
}
}
if (phas)
*phas = (HACMSTREAM)was;
TRACE("=> (%d)\n", ret);
ret = MMSYSERR_NOERROR;
if (!(fdwOpen & ACM_STREAMOPENF_QUERY))
return ret;
errCleanUp:
HeapFree(MSACM_hHeap, 0, was);
TRACE("=> (%d)\n", ret);
return ret;
}
/***********************************************************************
* acmStreamPrepareHeader (MSACM32.41)
*/
MMRESULT WINAPI acmStreamPrepareHeader(
HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwPrepare)
MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash,
DWORD fdwPrepare)
{
FIXME("(0x%08x, %p, %ld): stub\n", has, pash, fdwPrepare);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
PWINE_ACMSTREAM was;
MMRESULT ret = MMSYSERR_NOERROR;
PACMDRVSTREAMHEADER padsh;
TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwPrepare);
if ((was = ACM_GetStream(has)) == NULL)
return MMSYSERR_INVALHANDLE;
if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER))
return MMSYSERR_INVALPARAM;
if (fdwPrepare)
ret = MMSYSERR_INVALFLAG;
if (pash->fdwStatus & ACMSTREAMHEADER_STATUSF_DONE)
return MMSYSERR_NOERROR;
/* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same
* size. some fields are private to msacm internals, and are exposed
* in ACMSTREAMHEADER in the dwReservedDriver array
*/
padsh = (PACMDRVSTREAMHEADER)pash;
padsh->fdwConvert = fdwPrepare;
padsh->padshNext = NULL;
padsh->fdwDriver = padsh->dwDriver = 0L;
padsh->fdwPrepared = 0;
padsh->dwPrepared = 0;
padsh->pbPreparedSrc = 0;
padsh->cbPreparedSrcLength = 0;
padsh->pbPreparedDst = 0;
padsh->cbPreparedDstLength = 0;
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_PREPARE, (DWORD)&was->drvInst, (DWORD)padsh);
if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) {
ret = MMSYSERR_NOERROR;
padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE);
padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_PREPARED;
padsh->fdwPrepared = padsh->fdwStatus;
padsh->dwPrepared = 0;
padsh->pbPreparedSrc = padsh->pbSrc;
padsh->cbPreparedSrcLength = padsh->cbSrcLength;
padsh->pbPreparedDst = padsh->pbDst;
padsh->cbPreparedDstLength = padsh->cbDstLength;
} else {
padsh->fdwPrepared = 0;
padsh->dwPrepared = 0;
padsh->pbPreparedSrc = 0;
padsh->cbPreparedSrcLength = 0;
padsh->pbPreparedDst = 0;
padsh->cbPreparedDstLength = 0;
}
TRACE("=> (%d)\n", ret);
return ret;
}
/***********************************************************************
* acmStreamReset (MSACM32.42)
*/
MMRESULT WINAPI acmStreamReset(
HACMSTREAM has, DWORD fdwReset)
MMRESULT WINAPI acmStreamReset(HACMSTREAM has, DWORD fdwReset)
{
FIXME("(0x%08x, %ld): stub\n", has, fdwReset);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
PWINE_ACMSTREAM was;
MMRESULT ret = MMSYSERR_NOERROR;
TRACE("(0x%08x, %ld)\n", has, fdwReset);
if (fdwReset) {
ret = MMSYSERR_INVALFLAG;
} else if ((was = ACM_GetStream(has)) == NULL) {
return MMSYSERR_INVALHANDLE;
} else if (was->drvInst.fdwOpen & ACM_STREAMOPENF_ASYNC) {
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_RESET, (DWORD)&was->drvInst, 0);
}
TRACE("=> (%d)\n", ret);
return ret;
}
/***********************************************************************
* acmStreamSize (MSACM32.43)
*/
MMRESULT WINAPI acmStreamSize(
HACMSTREAM has, DWORD cbInput,
LPDWORD pdwOutputBytes, DWORD fdwSize)
MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput,
LPDWORD pdwOutputBytes, DWORD fdwSize)
{
FIXME("(0x%08x, %ld, %p, %ld): stub\n",
has, cbInput, pdwOutputBytes, fdwSize
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
PWINE_ACMSTREAM was;
ACMDRVSTREAMSIZE adss;
MMRESULT ret;
TRACE("(0x%08x, %ld, %p, %ld)\n", has, cbInput, pdwOutputBytes, fdwSize);
if ((was = ACM_GetStream(has)) == NULL) {
return MMSYSERR_INVALHANDLE;
}
if ((fdwSize & ~ACM_STREAMSIZEF_QUERYMASK) != 0) {
return MMSYSERR_INVALFLAG;
}
*pdwOutputBytes = 0L;
switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) {
case ACM_STREAMSIZEF_DESTINATION:
adss.cbDstLength = cbInput;
adss.cbSrcLength = 0;
break;
case ACM_STREAMSIZEF_SOURCE:
adss.cbSrcLength = cbInput;
adss.cbDstLength = 0;
break;
default:
return MMSYSERR_INVALFLAG;
}
adss.cbStruct = sizeof(adss);
adss.fdwSize = fdwSize;
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_SIZE,
(DWORD)&was->drvInst, (DWORD)&adss);
if (ret == MMSYSERR_NOERROR) {
switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) {
case ACM_STREAMSIZEF_DESTINATION:
*pdwOutputBytes = adss.cbSrcLength;
break;
case ACM_STREAMSIZEF_SOURCE:
*pdwOutputBytes = adss.cbDstLength;
break;
}
}
TRACE("=> (%d) [%lu]\n", ret, *pdwOutputBytes);
return ret;
}
/***********************************************************************
* acmStreamUnprepareHeader (MSACM32.44)
*/
MMRESULT WINAPI acmStreamUnprepareHeader(
HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare)
MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash,
DWORD fdwUnprepare)
{
FIXME("(0x%08x, %p, %ld): stub\n",
has, pash, fdwUnprepare
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
PWINE_ACMSTREAM was;
MMRESULT ret = MMSYSERR_NOERROR;
PACMDRVSTREAMHEADER padsh;
TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwUnprepare);
if ((was = ACM_GetStream(has)) == NULL)
return MMSYSERR_INVALHANDLE;
if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER))
return MMSYSERR_INVALPARAM;
if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED))
return ACMERR_UNPREPARED;
/* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same
* size. some fields are private to msacm internals, and are exposed
* in ACMSTREAMHEADER in the dwReservedDriver array
*/
padsh = (PACMDRVSTREAMHEADER)pash;
/* check that pointers have not been modified */
if (padsh->pbPreparedSrc != padsh->pbSrc ||
padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
padsh->pbPreparedDst != padsh->pbDst ||
padsh->cbPreparedDstLength < padsh->cbDstLength) {
return MMSYSERR_INVALPARAM;
}
padsh->fdwConvert = fdwUnprepare;
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_UNPREPARE, (DWORD)&was->drvInst, (DWORD)padsh);
if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) {
ret = MMSYSERR_NOERROR;
padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE|ACMSTREAMHEADER_STATUSF_PREPARED);
}
TRACE("=> (%d)\n", ret);
return ret;
}

52
dlls/msacm32/wineacm.h Normal file
View File

@ -0,0 +1,52 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/***********************************************************************
* Wine specific - Win32
*/
typedef struct _WINE_ACMDRIVERID *PWINE_ACMDRIVERID;
typedef struct _WINE_ACMOBJ
{
PWINE_ACMDRIVERID pACMDriverID;
} WINE_ACMOBJ, *PWINE_ACMOBJ;
typedef struct _WINE_ACMDRIVER
{
WINE_ACMOBJ obj;
HDRVR hDrvr;
DRIVERPROC pfnDriverProc;
} WINE_ACMDRIVER, *PWINE_ACMDRIVER;
typedef struct _WINE_ACMSTREAM
{
WINE_ACMOBJ obj;
PWINE_ACMDRIVER pDrv;
ACMDRVSTREAMINSTANCE drvInst;
} WINE_ACMSTREAM, *PWINE_ACMSTREAM;
typedef struct _WINE_ACMDRIVERID
{
LPSTR pszDriverAlias;
LPSTR pszFileName;
HINSTANCE hInstModule; /* NULL if global */
DWORD dwProcessID; /* ID of process which installed a local driver */
BOOL bEnabled;
PWINE_ACMDRIVER pACMDriver; /* NULL if not open; shouldn't this be a list ? */
PWINE_ACMDRIVERID pNextACMDriverID;
PWINE_ACMDRIVERID pPreviousACMDriverID;
} WINE_ACMDRIVERID;
/* From internal.c */
extern HANDLE MSACM_hHeap;
extern PWINE_ACMDRIVERID MSACM_pFirstACMDriverID;
extern PWINE_ACMDRIVERID MSACM_pLastACMDriverID;
PWINE_ACMDRIVERID MSACM_RegisterDriver(
LPSTR pszDriverAlias, LPSTR pszFileName,
HINSTANCE hinstModule);
void MSACM_RegisterAllDrivers(void);
PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p);
void MSACM_UnregisterAllDrivers(void);
PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID);
PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver);
PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj);

View File

@ -919,68 +919,6 @@ MMRESULT WINAPI acmStreamUnprepareHeader(
HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare
);
/***********************************************************************
* Wine specific - Win32
*/
typedef struct _WINE_ACMBUILTINDRIVER
{
LPSTR pszDriverAlias;
DRIVERPROC pfnDriverProc;
} WINE_ACMBUILTINDRIVER, *PWINE_ACMBUILTINDRIVER;
typedef struct _WINE_ACMLOCALDRIVER
{
DRIVERPROC pfnDriverProc;
} WINE_ACMLOCALDRIVER, *PWINE_ACMLOCALDRIVER;
typedef struct _WINE_ACMDRIVERID *PWINE_ACMDRIVERID;
typedef struct _WINE_ACMOBJ
{
PWINE_ACMDRIVERID pACMDriverID;
} WINE_ACMOBJ, *PWINE_ACMOBJ;
typedef struct _WINE_ACMDRIVER
{
WINE_ACMOBJ obj;
HDRVR hDrvr;
} WINE_ACMDRIVER, *PWINE_ACMDRIVER;
typedef struct _WINE_ACMSTREAM
{
WINE_ACMOBJ obj;
/* FIME: More fields needed */
} WINE_ACMSTREAM, *PWINE_ACMSTREAM;
typedef struct _WINE_ACMDRIVERID
{
LPSTR pszDriverAlias;
LPSTR pszFileName;
PWINE_ACMLOCALDRIVER pACMLocalDriver;
BOOL bEnabled;
PWINE_ACMDRIVER pACMDriver; /* NULL if not open */
PWINE_ACMDRIVERID pNextACMDriverID;
PWINE_ACMDRIVERID pPreviousACMDriverID;
} WINE_ACMDRIVERID;
/* From builtin.c */
extern WINE_ACMBUILTINDRIVER MSACM_BuiltinDrivers[];
/* From interal.c */
extern HANDLE MSACM_hHeap;
extern PWINE_ACMDRIVERID MSACM_pFirstACMDriverID;
extern PWINE_ACMDRIVERID MSACM_pLastACMDriverID;
PWINE_ACMDRIVERID MSACM_RegisterDriver(
LPSTR pszDriverAlias, LPSTR pszFileName,
PWINE_ACMLOCALDRIVER pLocalDriver);
void MSACM_RegisterAllDrivers();
PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p);
void MSACM_UnregisterAllDrivers();
PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID);
PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver);
PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj);
HDRVR MSACM_OpenDriverProc(DRIVERPROC pfnDriverProc);
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */