Commit 140d8cd9 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Added PCM converter internal driver.

A few driver handling fixes.
parent bd8ede1b
...@@ -14,6 +14,7 @@ C_SRCS = \ ...@@ -14,6 +14,7 @@ C_SRCS = \
internal.c \ internal.c \
msacm32_main.c \ msacm32_main.c \
msacm_main.c \ msacm_main.c \
pcmconverter.c \
stream.c stream.c
RC_SRCS = \ RC_SRCS = \
......
...@@ -76,27 +76,32 @@ MMRESULT WINAPI acmDriverAddW(PHACMDRIVERID phadid, HINSTANCE hinstModule, ...@@ -76,27 +76,32 @@ MMRESULT WINAPI acmDriverAddW(PHACMDRIVERID phadid, HINSTANCE hinstModule,
*/ */
MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose) MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
{ {
PWINE_ACMDRIVER p; PWINE_ACMDRIVER pad;
PWINE_ACMDRIVER* tp; PWINE_ACMDRIVERID padid;
PWINE_ACMDRIVER* tpad;
if (fdwClose) if (fdwClose)
return MMSYSERR_INVALFLAG; return MMSYSERR_INVALFLAG;
p = MSACM_GetDriver(had); pad = MSACM_GetDriver(had);
if (!p) if (!pad)
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
for (tp = &(p->obj.pACMDriverID->pACMDriverList); *tp; *tp = (*tp)->pNextACMDriver) { padid = pad->obj.pACMDriverID;
if (*tp == p) {
*tp = (*tp)->pNextACMDriver; /* remove driver from list */
for (tpad = &(padid->pACMDriverList); *tpad; *tpad = (*tpad)->pNextACMDriver) {
if (*tpad == pad) {
*tpad = (*tpad)->pNextACMDriver;
break; break;
} }
} }
if (p->hDrvr && !p->obj.pACMDriverID->pACMDriverList) /* close driver if it has been opened */
CloseDriver(p->hDrvr, 0, 0); if (pad->hDrvr && !padid->hInstModule)
CloseDriver(pad->hDrvr, 0, 0);
HeapFree(MSACM_hHeap, 0, p); HeapFree(MSACM_hHeap, 0, pad);
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
} }
...@@ -232,30 +237,25 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe ...@@ -232,30 +237,25 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
if (!phad) if (!phad)
return MMSYSERR_INVALPARAM; return MMSYSERR_INVALPARAM;
if (fdwOpen)
return MMSYSERR_INVALFLAG;
padid = MSACM_GetDriverID(hadid); padid = MSACM_GetDriverID(hadid);
if (!padid) if (!padid)
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
if (fdwOpen)
return MMSYSERR_INVALFLAG;
pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER)); pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
if (!pad) return MMSYSERR_NOMEM; if (!pad) return MMSYSERR_NOMEM;
pad->obj.dwType = WINE_ACMOBJ_DRIVER; pad->obj.dwType = WINE_ACMOBJ_DRIVER;
pad->obj.pACMDriverID = padid; pad->obj.pACMDriverID = padid;
if (!padid->hInstModule) if (!(pad->hDrvr = padid->hInstModule) && padid->pszDriverAlias)
pad->hDrvr = OpenDriverA(padid->pszDriverAlias, "drivers32", 0); pad->hDrvr = OpenDriverA(padid->pszDriverAlias, NULL, 0);
else
pad->hDrvr = padid->hInstModule;
if (!pad->hDrvr) { if (!pad->hDrvr) {
HeapFree(MSACM_hHeap, 0, pad); HeapFree(MSACM_hHeap, 0, pad);
return MMSYSERR_ERROR; return MMSYSERR_ERROR;
} }
pad->pfnDriverProc = GetProcAddress(pad->hDrvr, "DriverProc");
/* insert new pad at beg of list */ /* insert new pad at beg of list */
pad->pNextACMDriver = padid->pACMDriverList; pad->pNextACMDriver = padid->pACMDriverList;
...@@ -263,7 +263,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe ...@@ -263,7 +263,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
/* FIXME: Create a WINE_ACMDRIVER32 */ /* FIXME: Create a WINE_ACMDRIVER32 */
*phad = (HACMDRIVER)pad; *phad = (HACMDRIVER)pad;
TRACE("'%s' => %08lx\n", padid->pszDriverAlias, (DWORD)pad);
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
} }
......
...@@ -484,7 +484,7 @@ MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd, ...@@ -484,7 +484,7 @@ MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd,
if (fdwEnum & (ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_SUGGEST| if (fdwEnum & (ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_SUGGEST|
ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT)) ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT))
FIXME("Unsupported fdwEnum values\n"); FIXME("Unsupported fdwEnum values %08lx\n", fdwEnum);
if (had) { if (had) {
HACMDRIVERID hadid; HACMDRIVERID hadid;
......
...@@ -42,8 +42,8 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, ...@@ -42,8 +42,8 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
padid->obj.dwType = WINE_ACMOBJ_DRIVERID; padid->obj.dwType = WINE_ACMOBJ_DRIVERID;
padid->obj.pACMDriverID = padid; padid->obj.pACMDriverID = padid;
padid->pszDriverAlias = HEAP_strdupA(MSACM_hHeap, 0, pszDriverAlias); padid->pszDriverAlias = pszDriverAlias ? HEAP_strdupA(MSACM_hHeap, 0, pszDriverAlias) : NULL;
padid->pszFileName = HEAP_strdupA(MSACM_hHeap, 0, pszFileName); padid->pszFileName = pszFileName ? HEAP_strdupA(MSACM_hHeap, 0, pszFileName) : NULL;
padid->hInstModule = hinstModule; padid->hInstModule = hinstModule;
padid->bEnabled = TRUE; padid->bEnabled = TRUE;
padid->pACMDriverList = NULL; padid->pACMDriverList = NULL;
...@@ -65,7 +65,7 @@ void MSACM_RegisterAllDrivers(void) ...@@ -65,7 +65,7 @@ void MSACM_RegisterAllDrivers(void)
{ {
LPSTR pszBuffer; LPSTR pszBuffer;
DWORD dwBufferLength; DWORD dwBufferLength;
/* FIXME /* FIXME
* What if the user edits system.ini while the program is running? * What if the user edits system.ini while the program is running?
* Does Windows handle that? * Does Windows handle that?
...@@ -85,8 +85,9 @@ void MSACM_RegisterAllDrivers(void) ...@@ -85,8 +85,9 @@ void MSACM_RegisterAllDrivers(void)
char *s2 = s; char *s2 = s;
while (*s2 != '\0' && *s2 != '=') s2++; while (*s2 != '\0' && *s2 != '=') s2++;
if (*s2) { if (*s2) {
*s2++ = '\0'; *s2 = '\0';
MSACM_RegisterDriver(s, s2, 0); MSACM_RegisterDriver(s, s2 + 1, 0);
*s2 = '=';
} }
} }
s += strlen(s) + 1; /* Either next char or \0 */ s += strlen(s) + 1; /* Either next char or \0 */
...@@ -94,6 +95,8 @@ void MSACM_RegisterAllDrivers(void) ...@@ -94,6 +95,8 @@ void MSACM_RegisterAllDrivers(void)
} }
HeapFree(MSACM_hHeap, 0, pszBuffer); HeapFree(MSACM_hHeap, 0, pszBuffer);
MSACM_RegisterDriver("msacm32.dll", "msacm32.dll", 0);
} }
/*********************************************************************** /***********************************************************************
......
...@@ -51,3 +51,6 @@ import kernel32.dll ...@@ -51,3 +51,6 @@ import kernel32.dll
42 stdcall acmStreamReset(long long) acmStreamReset 42 stdcall acmStreamReset(long long) acmStreamReset
43 stdcall acmStreamSize(long long ptr long) acmStreamSize 43 stdcall acmStreamSize(long long ptr long) acmStreamSize
44 stdcall acmStreamUnprepareHeader(long ptr long) acmStreamUnprepareHeader 44 stdcall acmStreamUnprepareHeader(long ptr long) acmStreamUnprepareHeader
# this is wine only
@ stdcall DriverProc(long long long long long) PCM_DriverProc
...@@ -285,7 +285,6 @@ typedef struct _WINE_ACMDRIVER ...@@ -285,7 +285,6 @@ typedef struct _WINE_ACMDRIVER
{ {
WINE_ACMOBJ obj; WINE_ACMOBJ obj;
HDRVR hDrvr; HDRVR hDrvr;
DRIVERPROC pfnDriverProc;
PWINE_ACMDRIVER pNextACMDriver; PWINE_ACMDRIVER pNextACMDriver;
} WINE_ACMDRIVER; } WINE_ACMDRIVER;
...@@ -328,6 +327,10 @@ extern MMRESULT MSACM_Message(HACMDRIVER, UINT, LPARAM, LPARAM); ...@@ -328,6 +327,10 @@ extern MMRESULT MSACM_Message(HACMDRIVER, UINT, LPARAM, LPARAM);
/* From msacm32.c */ /* From msacm32.c */
extern HINSTANCE MSACM_hInstance32; extern HINSTANCE MSACM_hInstance32;
/* From pcmcnvtr.c */
LRESULT CALLBACK PCM_DriverProc(DWORD dwDevID, HDRVR hDriv, UINT wMsg,
LPARAM dwParam1, LPARAM dwParam2);
/* Dialog box templates */ /* Dialog box templates */
#define DLG_ACMFORMATCHOOSE_ID 70 #define DLG_ACMFORMATCHOOSE_ID 70
#define IDD_ACMFORMATCHOOSE_BTN_HELP 9 #define IDD_ACMFORMATCHOOSE_BTN_HELP 9
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment