Commit f051db39 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Mimic more closely Windows' behavior (a MSACM driver is always opened

twice: first time for info gathering, subsequent openings for conversions). Added format suggestion for PCM. Cleaned up internal structures.
parent beea6151
...@@ -177,7 +177,7 @@ MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWOR ...@@ -177,7 +177,7 @@ MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWOR
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
fdwSupport = padid->fdwSupport; fdwSupport = padid->fdwSupport;
if (!padid->bEnabled) { if (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) {
if (fdwEnum & ACM_DRIVERENUMF_DISABLED) if (fdwEnum & ACM_DRIVERENUMF_DISABLED)
fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED; fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED;
else else
...@@ -226,6 +226,62 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA ...@@ -226,6 +226,62 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
return MMSYSERR_INVALPARAM; return MMSYSERR_INVALPARAM;
} }
static MMRESULT MSACM_DriverOpenHelper(PWINE_ACMDRIVER* ppad, PWINE_ACMDRIVERID padid, DWORD fdwOpen, BOOL useDesc)
{
MMRESULT ret = MMSYSERR_ERROR;
PWINE_ACMDRIVER pad;
*ppad = NULL;
pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
if (!pad) return MMSYSERR_NOMEM;
pad->obj.dwType = WINE_ACMOBJ_DRIVER;
pad->obj.pACMDriverID = padid;
if (!(pad->hDrvr = padid->hInstModule)) {
/* this is not an externally added driver... need to load it */
if (!padid->pszDriverAlias) goto gotError;
if (useDesc) {
ACMDRVOPENDESCW adod;
int len;
adod.cbStruct = sizeof(adod);
adod.fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
adod.fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
adod.dwVersion = acmGetVersion();
adod.dwFlags = fdwOpen;
adod.dwError = 0;
len = strlen("Drivers32") + 1;
adod.pszSectionName = HeapAlloc(MSACM_hHeap, 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, "Drivers32", -1, (LPWSTR)adod.pszSectionName, len);
len = strlen(padid->pszDriverAlias) + 1;
adod.pszAliasName = HeapAlloc(MSACM_hHeap, 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, padid->pszDriverAlias, -1, (LPWSTR)adod.pszAliasName, len);
adod.dnDevNode = 0;
pad->hDrvr = OpenDriverA(padid->pszDriverAlias, NULL, (DWORD)&adod);
HeapFree(MSACM_hHeap, 0, (LPWSTR)adod.pszSectionName);
HeapFree(MSACM_hHeap, 0, (LPWSTR)adod.pszAliasName);
if (!pad->hDrvr) {
ret = adod.dwError;
goto gotError;
}
} else {
if (!(pad->hDrvr = OpenDriverA(padid->pszDriverAlias, 0L, 0L))) {
ret = MMSYSERR_ERROR;
goto gotError;
}
}
}
*ppad = pad;
return MMSYSERR_NOERROR;
gotError:
HeapFree(MSACM_hHeap, 0, pad);
return ret;
}
/*********************************************************************** /***********************************************************************
* acmDriverOpen (MSACM32.10) * acmDriverOpen (MSACM32.10)
...@@ -233,8 +289,8 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA ...@@ -233,8 +289,8 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen) MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen)
{ {
PWINE_ACMDRIVERID padid; PWINE_ACMDRIVERID padid;
PWINE_ACMDRIVER pad; PWINE_ACMDRIVER pad, first_pad = NULL;
MMRESULT ret = MMSYSERR_ERROR; MMRESULT ret;
TRACE("(%p, %x, %08lu)\n", phad, hadid, fdwOpen); TRACE("(%p, %x, %08lu)\n", phad, hadid, fdwOpen);
...@@ -247,30 +303,23 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe ...@@ -247,30 +303,23 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
padid = MSACM_GetDriverID(hadid); padid = MSACM_GetDriverID(hadid);
if (!padid) if (!padid)
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
if (!pad) return MMSYSERR_NOMEM;
pad->obj.dwType = WINE_ACMOBJ_DRIVER; /* first driver to be loaded ? */
pad->obj.pACMDriverID = padid; if (!padid->pACMDriverList && !padid->hInstModule) {
ret = MSACM_DriverOpenHelper(&first_pad, padid, fdwOpen, FALSE);
if (ret) goto gotError;
if (!(pad->hDrvr = padid->hInstModule) && padid->pszDriverAlias) {
ACMDRVOPENDESCW adod; /* insert new pad at beg of list */
first_pad->pNextACMDriver = NULL;
adod.cbStruct = sizeof(adod); padid->pACMDriverList = first_pad;
adod.fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC; }
adod.fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
adod.dwVersion = acmGetVersion(); ret = MSACM_DriverOpenHelper(&pad, padid, fdwOpen, TRUE);
adod.dwFlags = fdwOpen; if (ret) {
adod.dwError = 0; if (first_pad)
adod.pszSectionName = (LPCWSTR)"\0"; /* FIXME */ acmDriverClose((HACMDRIVER)first_pad, 0L);
adod.pszAliasName = (LPCWSTR)"\0"; /* FIXME */ goto gotError;
adod.dnDevNode = 0;
if (!(pad->hDrvr = OpenDriverA(padid->pszDriverAlias, NULL, (DWORD)&adod))) {
ret = adod.dwError;
goto gotError;
}
} }
/* insert new pad at beg of list */ /* insert new pad at beg of list */
...@@ -280,6 +329,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe ...@@ -280,6 +329,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); TRACE("'%s' => %08lx\n", padid->pszDriverAlias, (DWORD)pad);
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
gotError: gotError:
if (!pad->hDrvr) if (!pad->hDrvr)
......
...@@ -92,7 +92,7 @@ MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd, ...@@ -92,7 +92,7 @@ MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd,
mmr = ACMERR_NOTPOSSIBLE; mmr = ACMERR_NOTPOSSIBLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */ /* should check for codec only */
if (padid->bEnabled && if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) { acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS, mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS,
(LPARAM)pafd, (LPARAM)fdwDetails); (LPARAM)pafd, (LPARAM)fdwDetails);
...@@ -229,7 +229,8 @@ MMRESULT WINAPI acmFilterEnumW(HACMDRIVER had, PACMFILTERDETAILSW pafd, ...@@ -229,7 +229,8 @@ MMRESULT WINAPI acmFilterEnumW(HACMDRIVER had, PACMFILTERDETAILSW pafd,
} }
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */ /* should check for codec only */
if (!padid->bEnabled || acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR) if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ||
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
continue; continue;
ret = MSACM_FilterEnumHelper(padid, had, pafd, ret = MSACM_FilterEnumHelper(padid, had, pafd,
fnCallback, dwInstance, fdwEnum); fnCallback, dwInstance, fdwEnum);
...@@ -287,7 +288,8 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd ...@@ -287,7 +288,8 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd
mmr = ACMERR_NOTPOSSIBLE; mmr = ACMERR_NOTPOSSIBLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */ /* should check for codec only */
if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) { if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, (LPARAM)paftd, fdwDetails); mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, (LPARAM)paftd, fdwDetails);
acmDriverClose(had, 0); acmDriverClose(had, 0);
if (mmr == MMSYSERR_NOERROR) break; if (mmr == MMSYSERR_NOERROR) break;
...@@ -311,7 +313,7 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd ...@@ -311,7 +313,7 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd
mmr = ACMERR_NOTPOSSIBLE; mmr = ACMERR_NOTPOSSIBLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */ /* should check for codec only */
if (padid->bEnabled && if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) { acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
memset(&tmp, 0, sizeof(tmp)); memset(&tmp, 0, sizeof(tmp));
...@@ -416,7 +418,8 @@ MMRESULT WINAPI acmFilterTagEnumW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, ...@@ -416,7 +418,8 @@ MMRESULT WINAPI acmFilterTagEnumW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd,
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */ /* should check for codec only */
if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) { if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) {
for (i = 0; i < padid->cFilterTags; i++) { for (i = 0; i < padid->cFilterTags; i++) {
paftd->dwFilterTagIndex = i; paftd->dwFilterTagIndex = i;
......
...@@ -319,7 +319,7 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD ...@@ -319,7 +319,7 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD
mmr = ACMERR_NOTPOSSIBLE; mmr = ACMERR_NOTPOSSIBLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */ /* should check for codec only */
if (padid->bEnabled && if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) { acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails); mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails);
acmDriverClose(had, 0); acmDriverClose(had, 0);
...@@ -498,7 +498,8 @@ MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd, ...@@ -498,7 +498,8 @@ MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd,
} }
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */ /* should check for codec only */
if (!padid->bEnabled || acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR) if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ||
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
continue; continue;
ret = MSACM_FormatEnumHelper(padid, had, pafd, &wfxRef, ret = MSACM_FormatEnumHelper(padid, had, pafd, &wfxRef,
fnCallback, dwInstance, fdwEnum); fnCallback, dwInstance, fdwEnum);
...@@ -541,7 +542,7 @@ MMRESULT WINAPI acmFormatSuggest(HACMDRIVER had, PWAVEFORMATEX pwfxSrc, ...@@ -541,7 +542,7 @@ MMRESULT WINAPI acmFormatSuggest(HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
mmr = ACMERR_NOTPOSSIBLE; mmr = ACMERR_NOTPOSSIBLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */ /* should check for codec only */
if (!padid->bEnabled || if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ||
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR) acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
continue; continue;
...@@ -604,7 +605,7 @@ MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd ...@@ -604,7 +605,7 @@ MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd
if (had == (HACMDRIVER)NULL) { if (had == (HACMDRIVER)NULL) {
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */ /* should check for codec only */
if (padid->bEnabled && if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
MSACM_FindFormatTagInCache(padid, paftd->dwFormatTag, NULL) && MSACM_FindFormatTagInCache(padid, paftd->dwFormatTag, NULL) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) { acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails); mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
...@@ -636,7 +637,7 @@ MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd ...@@ -636,7 +637,7 @@ MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */ /* should check for codec only */
if (padid->bEnabled && if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) { acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
memset(&tmp, 0, sizeof(tmp)); memset(&tmp, 0, sizeof(tmp));
...@@ -742,8 +743,8 @@ MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, ...@@ -742,8 +743,8 @@ MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */ /* should check for codec only */
if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) { if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) {
for (i = 0; i < padid->cFormatTags; i++) { for (i = 0; i < padid->cFormatTags; i++) {
paftd->dwFormatTagIndex = i; paftd->dwFormatTagIndex = i;
if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,
......
...@@ -224,7 +224,7 @@ static BOOL MSACM_WriteCache(PWINE_ACMDRIVERID padid) ...@@ -224,7 +224,7 @@ static BOOL MSACM_WriteCache(PWINE_ACMDRIVERID padid)
PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
HINSTANCE hinstModule) HINSTANCE hinstModule)
{ {
PWINE_ACMDRIVERID padid; PWINE_ACMDRIVERID padid;
TRACE("('%s', '%s', 0x%08x)\n", pszDriverAlias, pszFileName, hinstModule); TRACE("('%s', '%s', 0x%08x)\n", pszDriverAlias, pszFileName, hinstModule);
...@@ -245,7 +245,6 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, ...@@ -245,7 +245,6 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
} }
padid->hInstModule = hinstModule; padid->hInstModule = hinstModule;
padid->bEnabled = TRUE;
padid->pACMDriverList = NULL; padid->pACMDriverList = NULL;
padid->pNextACMDriverID = NULL; padid->pNextACMDriverID = NULL;
padid->pPrevACMDriverID = MSACM_pLastACMDriverID; padid->pPrevACMDriverID = MSACM_pLastACMDriverID;
......
...@@ -106,7 +106,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) ...@@ -106,7 +106,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
case ACM_METRIC_COUNT_LOCAL_DRIVERS: case ACM_METRIC_COUNT_LOCAL_DRIVERS:
if (hao) return MMSYSERR_INVALHANDLE; if (hao) return MMSYSERR_INVALHANDLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (padid->bEnabled && CheckLocal(padid)) if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
val++; val++;
*(LPDWORD)pMetric = val; *(LPDWORD)pMetric = val;
break; break;
...@@ -117,8 +117,9 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) ...@@ -117,8 +117,9 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
case ACM_METRIC_COUNT_LOCAL_CODECS: case ACM_METRIC_COUNT_LOCAL_CODECS:
if (hao) return MMSYSERR_INVALHANDLE; if (hao) return MMSYSERR_INVALHANDLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (padid->bEnabled && (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC) if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
&& CheckLocal(padid)) (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC) &&
CheckLocal(padid))
val++; val++;
*(LPDWORD)pMetric = val; *(LPDWORD)pMetric = val;
break; break;
...@@ -129,8 +130,9 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) ...@@ -129,8 +130,9 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
case ACM_METRIC_COUNT_LOCAL_CONVERTERS: case ACM_METRIC_COUNT_LOCAL_CONVERTERS:
if (hao) return MMSYSERR_INVALHANDLE; if (hao) return MMSYSERR_INVALHANDLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (padid->bEnabled && (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CONVERTER) if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
&& CheckLocal(padid)) (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CONVERTER) &&
CheckLocal(padid))
val++; val++;
*(LPDWORD)pMetric = val; *(LPDWORD)pMetric = val;
break; break;
...@@ -141,8 +143,9 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) ...@@ -141,8 +143,9 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
case ACM_METRIC_COUNT_LOCAL_FILTERS: case ACM_METRIC_COUNT_LOCAL_FILTERS:
if (hao) return MMSYSERR_INVALHANDLE; if (hao) return MMSYSERR_INVALHANDLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (padid->bEnabled && (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_FILTER) if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
&& CheckLocal(padid)) (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_FILTER) &&
CheckLocal(padid))
val++; val++;
*(LPDWORD)pMetric = val; *(LPDWORD)pMetric = val;
break; break;
...@@ -153,7 +156,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) ...@@ -153,7 +156,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
case ACM_METRIC_COUNT_LOCAL_DISABLED: case ACM_METRIC_COUNT_LOCAL_DISABLED:
if (hao) return MMSYSERR_INVALHANDLE; if (hao) return MMSYSERR_INVALHANDLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (!padid->bEnabled && CheckLocal(padid)) if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
val++; val++;
*(LPDWORD)pMetric = val; *(LPDWORD)pMetric = val;
break; break;
...@@ -161,7 +164,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) ...@@ -161,7 +164,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
case ACM_METRIC_MAX_SIZE_FORMAT: case ACM_METRIC_MAX_SIZE_FORMAT:
if (hao == (HACMOBJ)NULL) { if (hao == (HACMOBJ)NULL) {
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
if (padid->bEnabled) { if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
for (i = 0; i < padid->cFormatTags; i++) { for (i = 0; i < padid->cFormatTags; i++) {
if (val < padid->aFormatTag[i].cbwfx) if (val < padid->aFormatTag[i].cbwfx)
val = padid->aFormatTag[i].cbwfx; val = padid->aFormatTag[i].cbwfx;
...@@ -177,7 +180,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) ...@@ -177,7 +180,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
default: default:
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
if (padid->bEnabled) { if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
for (i = 0; i < padid->cFormatTags; i++) { for (i = 0; i < padid->cFormatTags; i++) {
if (val < padid->aFormatTag[i].cbwfx) if (val < padid->aFormatTag[i].cbwfx)
val = padid->aFormatTag[i].cbwfx; val = padid->aFormatTag[i].cbwfx;
......
...@@ -32,9 +32,9 @@ DEFAULT_DEBUG_CHANNEL(msacm); ...@@ -32,9 +32,9 @@ DEFAULT_DEBUG_CHANNEL(msacm);
*/ */
static DWORD PCM_drvOpen(LPCSTR str, PACMDRVOPENDESCW adod) static DWORD PCM_drvOpen(LPCSTR str, PACMDRVOPENDESCW adod)
{ {
return return (adod == NULL) ||
adod->fccType == ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC && (adod->fccType == ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC &&
adod->fccComp == ACMDRIVERDETAILS_FCCCOMP_UNDEFINED; adod->fccComp == ACMDRIVERDETAILS_FCCCOMP_UNDEFINED);
} }
/*********************************************************************** /***********************************************************************
...@@ -789,8 +789,33 @@ static LRESULT PCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery) ...@@ -789,8 +789,33 @@ static LRESULT PCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
*/ */
static LRESULT PCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs) static LRESULT PCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
{ {
FIXME("(%p);\n", adfs); /* some tests ... */
return MMSYSERR_NOTSUPPORTED; if (adfs->cbwfxSrc < sizeof(PCMWAVEFORMAT) ||
adfs->cbwfxDst < sizeof(PCMWAVEFORMAT) ||
PCM_GetFormatIndex(adfs->pwfxSrc) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
/* is no suggestion for destination, then copy source value */
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS)) {
adfs->pwfxDst->nChannels = adfs->pwfxSrc->nChannels;
}
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NSAMPLESPERSEC)) {
adfs->pwfxDst->nSamplesPerSec = adfs->pwfxSrc->nSamplesPerSec;
}
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WBITSPERSAMPLE)) {
adfs->pwfxDst->wBitsPerSample = adfs->pwfxSrc->wBitsPerSample;
}
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG)) {
if (adfs->pwfxSrc->wFormatTag != WAVE_FORMAT_PCM) return ACMERR_NOTPOSSIBLE;
adfs->pwfxDst->wFormatTag = adfs->pwfxSrc->wFormatTag;
}
/* check if result is ok */
if (PCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
/* recompute other values */
adfs->pwfxDst->nBlockAlign = (adfs->pwfxDst->nChannels * adfs->pwfxDst->wBitsPerSample) / 8;
adfs->pwfxDst->nAvgBytesPerSec = adfs->pwfxDst->nSamplesPerSec * adfs->pwfxDst->nBlockAlign;
return MMSYSERR_NOERROR;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -140,7 +140,8 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw ...@@ -140,7 +140,8 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
if (pwfxSrc->wFormatTag != WAVE_FORMAT_PCM) wfxSrcSize += pwfxSrc->cbSize; if (pwfxSrc->wFormatTag != WAVE_FORMAT_PCM) wfxSrcSize += pwfxSrc->cbSize;
if (pwfxDst->wFormatTag != WAVE_FORMAT_PCM) wfxDstSize += pwfxDst->cbSize; if (pwfxDst->wFormatTag != WAVE_FORMAT_PCM) wfxDstSize += pwfxDst->cbSize;
was = HeapAlloc(MSACM_hHeap, 0, sizeof(*was) + wfxSrcSize + wfxDstSize + ((pwfltr) ? sizeof(WAVEFILTER) : 0)); was = HeapAlloc(MSACM_hHeap, 0, sizeof(*was) + wfxSrcSize + wfxDstSize +
((pwfltr) ? sizeof(WAVEFILTER) : 0));
if (was == NULL) if (was == NULL)
return MMSYSERR_NOMEM; return MMSYSERR_NOMEM;
...@@ -160,7 +161,8 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw ...@@ -160,7 +161,8 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
was->drvInst.fdwOpen = fdwOpen; was->drvInst.fdwOpen = fdwOpen;
was->drvInst.fdwDriver = 0L; was->drvInst.fdwDriver = 0L;
was->drvInst.dwDriver = 0L; was->drvInst.dwDriver = 0L;
was->drvInst.has = (HACMSTREAM)was; /* real value will be stored once ACMDM_STREAM_OPEN succeeds */
was->drvInst.has = 0L;
if (had) { if (had) {
if (!(wad = MSACM_GetDriver(had))) { if (!(wad = MSACM_GetDriver(had))) {
...@@ -181,7 +183,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw ...@@ -181,7 +183,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
ret = ACMERR_NOTPOSSIBLE; ret = ACMERR_NOTPOSSIBLE;
for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) { for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) {
if (!wadi->bEnabled || if ((wadi->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ||
!MSACM_FindFormatTagInCache(wadi, pwfxSrc->wFormatTag, NULL) || !MSACM_FindFormatTagInCache(wadi, pwfxSrc->wFormatTag, NULL) ||
!MSACM_FindFormatTagInCache(wadi, pwfxDst->wFormatTag, NULL)) !MSACM_FindFormatTagInCache(wadi, pwfxDst->wFormatTag, NULL))
continue; continue;
...@@ -195,7 +197,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw ...@@ -195,7 +197,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
was->hAcmDriver = had; was->hAcmDriver = had;
ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);
TRACE("%s => %08x\n", wadi->pszFileName, ret); TRACE("%s => %08x\n", wadi->pszDriverAlias, ret);
if (ret == MMSYSERR_NOERROR) { if (ret == MMSYSERR_NOERROR) {
if (fdwOpen & ACM_STREAMOPENF_QUERY) { if (fdwOpen & ACM_STREAMOPENF_QUERY) {
acmDriverClose(had, 0L); acmDriverClose(had, 0L);
...@@ -212,6 +214,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw ...@@ -212,6 +214,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
} }
} }
ret = MMSYSERR_NOERROR; ret = MMSYSERR_NOERROR;
was->drvInst.has = (HACMSTREAM)was;
if (!(fdwOpen & ACM_STREAMOPENF_QUERY)) { if (!(fdwOpen & ACM_STREAMOPENF_QUERY)) {
if (phas) if (phas)
*phas = (HACMSTREAM)was; *phas = (HACMSTREAM)was;
......
...@@ -299,11 +299,9 @@ typedef struct _WINE_ACMSTREAM ...@@ -299,11 +299,9 @@ typedef struct _WINE_ACMSTREAM
typedef struct _WINE_ACMDRIVERID typedef struct _WINE_ACMDRIVERID
{ {
WINE_ACMOBJ obj; WINE_ACMOBJ obj;
LPSTR pszDriverAlias; LPSTR pszDriverAlias;
LPSTR pszFileName; LPSTR pszFileName;
HINSTANCE hInstModule; /* NULL if global */ HINSTANCE hInstModule; /* NULL if global */
DWORD dwProcessID; /* ID of process which installed a local driver */
BOOL bEnabled;
PWINE_ACMDRIVER pACMDriverList; PWINE_ACMDRIVER pACMDriverList;
PWINE_ACMDRIVERID pNextACMDriverID; PWINE_ACMDRIVERID pNextACMDriverID;
PWINE_ACMDRIVERID pPrevACMDriverID; PWINE_ACMDRIVERID pPrevACMDriverID;
......
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