Made msacm32 really load ACM drivers.

oldstable
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,6 +17,7 @@
#include "mmsystem.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
#include "winreg.h"
DEFAULT_DEBUG_CHANNEL(msacm)
@ -21,29 +25,28 @@ DEFAULT_DEBUG_CHANNEL(msacm)
/***********************************************************************
* acmDriverAddA (MSACM32.2)
*/
MMRESULT WINAPI acmDriverAddA(
PHACMDRIVERID phadid, HINSTANCE hinstModule,
MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule,
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
{
PWINE_ACMLOCALDRIVER pld;
if(!phadid)
if (!phadid)
return MMSYSERR_INVALPARAM;
/* Check if any unknown flags */
if(fdwAdd &
if (fdwAdd &
~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND|
ACM_DRIVERADDF_GLOBAL))
return MMSYSERR_INVALFLAG;
/* Check if any incompatible flags */
if((fdwAdd & ACM_DRIVERADDF_FUNCTION) &&
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: 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 */
@ -55,13 +58,12 @@ MMRESULT WINAPI acmDriverAddA(
* FIXME
* Not implemented
*/
MMRESULT WINAPI acmDriverAddW(
PHACMDRIVERID phadid, HINSTANCE hinstModule,
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
);
phadid, hinstModule, lParam, dwPriority, fdwAdd);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
@ -69,25 +71,21 @@ MMRESULT WINAPI acmDriverAddW(
/***********************************************************************
* acmDriverClose (MSACM32.4)
*/
MMRESULT WINAPI acmDriverClose(
HACMDRIVER had, DWORD fdwClose)
MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
{
PWINE_ACMDRIVER p;
if(fdwClose)
if (fdwClose)
return MMSYSERR_INVALFLAG;
p = MSACM_GetDriver(had);
if(!p)
if (!p)
return MMSYSERR_INVALHANDLE;
p->obj.pACMDriverID->pACMDriver = NULL;
/* FIXME: CloseDriver32 not implemented */
#if 0
if(p->hDrvr)
if (p->hDrvr)
CloseDriver(p->hDrvr, 0, 0);
#endif
HeapFree(MSACM_hHeap, 0, p);
@ -97,37 +95,59 @@ MMRESULT WINAPI acmDriverClose(
/***********************************************************************
* acmDriverDetailsA (MSACM32.5)
*/
MMRESULT WINAPI acmDriverDetailsA(
HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, DWORD fdwDetails)
MMRESULT WINAPI acmDriverDetailsA(HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, DWORD fdwDetails)
{
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)
*/
MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, DWORD fdwDetails)
{
PWINE_ACMDRIVERID p;
MMRESULT mmr;
BOOL bOpenTemporary;
p = MSACM_GetDriverID(hadid);
if(!p)
if (!p)
return MMSYSERR_INVALHANDLE;
if(fdwDetails)
if (fdwDetails)
return MMSYSERR_INVALFLAG;
bOpenTemporary = !p->pACMDriver;
if(bOpenTemporary) {
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
);
mmr = (MMRESULT) acmDriverMessage((HACMDRIVER) p->pACMDriver, ACMDM_DRIVER_DETAILS,
(LPARAM) padd, 0);
if(bOpenTemporary) {
if (bOpenTemporary) {
acmDriverClose((HACMDRIVER) p->pACMDriver, 0);
p->pACMDriver = NULL;
}
@ -135,40 +155,23 @@ MMRESULT WINAPI acmDriverDetailsA(
return mmr;
}
/***********************************************************************
* acmDriverDetailsW (MSACM32.6)
* FIXME
* Not implemented
*/
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;
}
/***********************************************************************
* 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)
{
if (!fnCallback) {
return MMSYSERR_INVALPARAM;
}
if(fdwEnum && ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED))
{
if (fdwEnum && ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED)) {
return MMSYSERR_INVALFLAG;
}
p = MSACM_pFirstACMDriverID;
while(p)
{
while (p) {
(*fnCallback)((HACMDRIVERID) p, dwInstance, ACMDRIVERDETAILS_SUPPORTF_CODEC);
p = p->pNextACMDriverID;
}
@ -179,19 +182,18 @@ MMRESULT WINAPI acmDriverEnum(
/***********************************************************************
* 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)
if (!pao)
return MMSYSERR_INVALHANDLE;
if(!phadid)
if (!phadid)
return MMSYSERR_INVALPARAM;
if(fdwDriverID)
if (fdwDriverID)
return MMSYSERR_INVALFLAG;
*phadid = (HACMDRIVERID) pao->pACMDriverID;
@ -204,16 +206,15 @@ 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)
if (!pad)
return MMSYSERR_INVALPARAM;
/* FIXME: Check if uMsg legal */
if(!SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2))
if (!SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2))
return MMSYSERR_NOTSUPPORTED;
return MMSYSERR_NOERROR;
@ -223,57 +224,54 @@ LRESULT WINAPI acmDriverMessage(
/***********************************************************************
* acmDriverOpen (MSACM32.10)
*/
MMRESULT WINAPI acmDriverOpen(
PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen)
MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen)
{
PWINE_ACMDRIVERID padid;
if(!phad)
TRACE("(%p, %x, %08lu\n", phad, hadid, fdwOpen);
if (!phad)
return MMSYSERR_INVALPARAM;
padid = MSACM_GetDriverID(hadid);
if(!padid)
if (!padid)
return MMSYSERR_INVALHANDLE;
if(fdwOpen)
if (fdwOpen)
return MMSYSERR_INVALFLAG;
if(padid->pACMDriver)
{
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 = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
padid->pACMDriver->obj.pACMDriverID = padid;
if(!padid->pACMLocalDriver)
padid->pACMDriver->hDrvr =
OpenDriverA(padid->pszDriverAlias, "drivers32", 0);
if (!padid->hInstModule)
padid->pACMDriver->hDrvr = OpenDriverA(padid->pszDriverAlias, "drivers32", 0);
else
{
padid->pACMDriver->hDrvr = MSACM_OpenDriverProc(
padid->pACMLocalDriver->pfnDriverProc
);
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;
padid->pACMDriver->pfnDriverProc = GetProcAddress(padid->pACMDriver->hDrvr, "DriverProc");
/* FIXME: Create a WINE_ACMDRIVER32 */
*phad = (HACMDRIVER) NULL;
*phad = (HACMDRIVER) padid->pACMDriver;
return MMSYSERR_ERROR;
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];
@ -284,22 +282,22 @@ MMRESULT WINAPI acmDriverPriority(
DWORD dwPriorityCounter;
padid = MSACM_GetDriverID(hadid);
if(!padid)
if (!padid)
return MMSYSERR_INVALHANDLE;
/* Check for unknown flags */
if(fdwPriority &
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) &&
if ((fdwPriority & ACM_DRIVERPRIORITYF_ENABLE) &&
(fdwPriority & ACM_DRIVERPRIORITYF_DISABLE))
return MMSYSERR_INVALFLAG;
/* Check for incompatible flags */
if((fdwPriority & ACM_DRIVERPRIORITYF_BEGIN) &&
if ((fdwPriority & ACM_DRIVERPRIORITYF_BEGIN) &&
(fdwPriority & ACM_DRIVERPRIORITYF_END))
return MMSYSERR_INVALFLAG;
@ -309,19 +307,17 @@ MMRESULT WINAPI acmDriverPriority(
&hPriorityKey
);
/* FIXME: Create key */
if(lError != ERROR_SUCCESS)
if (lError != ERROR_SUCCESS)
return MMSYSERR_ERROR;
for(dwPriorityCounter = 1; ; dwPriorityCounter++)
{
for (dwPriorityCounter = 1; ; dwPriorityCounter++) {
wsnprintfA(szSubKey, 17, "Priorty%ld", dwPriorityCounter);
lError = RegQueryValueA(hPriorityKey, szSubKey, szBuffer, &lBufferLength);
if(lError != ERROR_SUCCESS)
if (lError != ERROR_SUCCESS)
break;
FIXME("(0x%08x, %ld, %ld): stub (partial)\n",
hadid, dwPriority, fdwPriority
);
hadid, dwPriority, fdwPriority);
break;
}
@ -333,16 +329,15 @@ MMRESULT WINAPI acmDriverPriority(
/***********************************************************************
* 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)
if (!padid)
return MMSYSERR_INVALHANDLE;
if(fdwRemove)
if (fdwRemove)
return MMSYSERR_INVALFLAG;
MSACM_UnregisterDriver(padid);

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,26 +31,25 @@ PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL;
/***********************************************************************
* MSACM_RegisterDriver32()
*/
PWINE_ACMDRIVERID MSACM_RegisterDriver(
LPSTR pszDriverAlias, LPSTR pszFileName,
PWINE_ACMLOCALDRIVER pLocalDriver)
PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
HINSTANCE hinstModule)
{
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;
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;
padid->pPreviousACMDriverID = MSACM_pLastACMDriverID;
if (MSACM_pLastACMDriverID)
MSACM_pLastACMDriverID->pNextACMDriverID = padid;
MSACM_pLastACMDriverID = padid;
if(!MSACM_pFirstACMDriverID)
if (!MSACM_pFirstACMDriverID)
MSACM_pFirstACMDriverID = padid;
return padid;
@ -53,9 +58,8 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(
/***********************************************************************
* MSACM_RegisterAllDrivers32()
*/
void MSACM_RegisterAllDrivers()
void MSACM_RegisterAllDrivers(void)
{
PWINE_ACMBUILTINDRIVER pbd;
LPSTR pszBuffer;
DWORD dwBufferLength;
@ -63,50 +67,29 @@ void MSACM_RegisterAllDrivers()
* What if the user edits system.ini while the program is running?
* Does Windows handle that?
*/
if(!MSACM_pFirstACMDriverID)
if (MSACM_pFirstACMDriverID)
return;
/* FIXME: Do not work! How do I determine the section length? */
dwBufferLength =
GetPrivateProfileSectionA("drivers32", NULL, 0, "system.ini");
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))
{
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);
while (*s2 != '\0' && *s2 != '=') s2++;
if (*s2) {
*s2++ = '\0';
MSACM_RegisterDriver(s, s2, 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);
}
@ -117,19 +100,22 @@ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
{
PWINE_ACMDRIVERID pNextACMDriverID;
if(p->pACMDriver)
if (p->pACMDriver)
acmDriverClose((HACMDRIVER) p->pACMDriver, 0);
if(p->pszDriverAlias)
if (p->pszDriverAlias)
HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);
if(p->pszFileName)
if (p->pszFileName)
HeapFree(MSACM_hHeap, 0, p->pszFileName);
if(p->pACMLocalDriver)
HeapFree(MSACM_hHeap, 0, p->pACMLocalDriver);
if(p->pPreviousACMDriverID)
if (p == MSACM_pFirstACMDriverID)
MSACM_pFirstACMDriverID = p->pNextACMDriverID;
if (p == MSACM_pLastACMDriverID)
MSACM_pLastACMDriverID = p->pPreviousACMDriverID;
if (p->pPreviousACMDriverID)
p->pPreviousACMDriverID->pNextACMDriverID = p->pNextACMDriverID;
if(p->pNextACMDriverID)
if (p->pNextACMDriverID)
p->pNextACMDriverID->pPreviousACMDriverID = p->pPreviousACMDriverID;
pNextACMDriverID = p->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,6 +13,7 @@
#include "debugtools.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
#include "winversion.h"
DEFAULT_DEBUG_CHANNEL(msacm)
@ -21,14 +25,13 @@ 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)
{
if (MSACM_dwProcessesAttached == 0) {
MSACM_hHeap = HeapCreate(0, 0x10000, 0);
MSACM_RegisterAllDrivers();
}
@ -36,8 +39,7 @@ BOOL WINAPI MSACM32_LibMain(
break;
case DLL_PROCESS_DETACH:
MSACM_dwProcessesAttached--;
if(MSACM_dwProcessesAttached == 0)
{
if (MSACM_dwProcessesAttached == 0) {
MSACM_UnregisterAllDrivers();
HeapDestroy(MSACM_hHeap);
MSACM_hHeap = (HANDLE) NULL;
@ -62,10 +64,9 @@ 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());
case WIN95:
@ -84,20 +85,18 @@ 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)
{
switch (uMetric) {
case ACM_METRIC_COUNT_DRIVERS:
bLocal = FALSE;
case ACM_METRIC_COUNT_LOCAL_DRIVERS:
if(!pao)
if (!pao)
return MMSYSERR_INVALHANDLE;
return MMSYSERR_NOTSUPPORTED;
case ACM_METRIC_COUNT_CODECS:
@ -115,7 +114,7 @@ MMRESULT WINAPI acmMetrics(
case ACM_METRIC_COUNT_DISABLED:
bLocal = FALSE;
case ACM_METRIC_COUNT_LOCAL_DISABLED:
if(!pao)
if (!pao)
return MMSYSERR_INVALHANDLE;
return MMSYSERR_NOTSUPPORTED;
case ACM_METRIC_COUNT_HARDWARE:

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,40 +21,88 @@
#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
);
FIXME("(0x%08x, %u, %ld, %ld): stub\n", has, uMsg, lParam1, lParam2);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
@ -52,65 +110,280 @@ MMRESULT WINAPI acmStreamMessage(
/***********************************************************************
* acmStreamOpen (MSACM32.40)
*/
MMRESULT WINAPI acmStreamOpen(
PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
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,
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;
}

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) */