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.
This commit is contained in:
parent
beea615126
commit
f051db39ec
|
@ -177,7 +177,7 @@ MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWOR
|
|||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
fdwSupport = padid->fdwSupport;
|
||||
|
||||
if (!padid->bEnabled) {
|
||||
if (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) {
|
||||
if (fdwEnum & ACM_DRIVERENUMF_DISABLED)
|
||||
fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED;
|
||||
else
|
||||
|
@ -226,6 +226,62 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
|
|||
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)
|
||||
|
@ -233,8 +289,8 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
|
|||
MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen)
|
||||
{
|
||||
PWINE_ACMDRIVERID padid;
|
||||
PWINE_ACMDRIVER pad;
|
||||
MMRESULT ret = MMSYSERR_ERROR;
|
||||
PWINE_ACMDRIVER pad, first_pad = NULL;
|
||||
MMRESULT ret;
|
||||
|
||||
TRACE("(%p, %x, %08lu)\n", phad, hadid, fdwOpen);
|
||||
|
||||
|
@ -247,30 +303,23 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
|
|||
padid = MSACM_GetDriverID(hadid);
|
||||
if (!padid)
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
|
||||
pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
|
||||
if (!pad) return MMSYSERR_NOMEM;
|
||||
|
||||
pad->obj.dwType = WINE_ACMOBJ_DRIVER;
|
||||
pad->obj.pACMDriverID = padid;
|
||||
/* first driver to be loaded ? */
|
||||
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;
|
||||
padid->pACMDriverList = first_pad;
|
||||
}
|
||||
|
||||
adod.cbStruct = sizeof(adod);
|
||||
adod.fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
|
||||
adod.fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
|
||||
adod.dwVersion = acmGetVersion();
|
||||
adod.dwFlags = fdwOpen;
|
||||
adod.dwError = 0;
|
||||
adod.pszSectionName = (LPCWSTR)"\0"; /* FIXME */
|
||||
adod.pszAliasName = (LPCWSTR)"\0"; /* FIXME */
|
||||
adod.dnDevNode = 0;
|
||||
|
||||
if (!(pad->hDrvr = OpenDriverA(padid->pszDriverAlias, NULL, (DWORD)&adod))) {
|
||||
ret = adod.dwError;
|
||||
goto gotError;
|
||||
}
|
||||
ret = MSACM_DriverOpenHelper(&pad, padid, fdwOpen, TRUE);
|
||||
if (ret) {
|
||||
if (first_pad)
|
||||
acmDriverClose((HACMDRIVER)first_pad, 0L);
|
||||
goto gotError;
|
||||
}
|
||||
|
||||
/* insert new pad at beg of list */
|
||||
|
@ -280,6 +329,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
|
|||
/* FIXME: Create a WINE_ACMDRIVER32 */
|
||||
*phad = (HACMDRIVER)pad;
|
||||
TRACE("'%s' => %08lx\n", padid->pszDriverAlias, (DWORD)pad);
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
gotError:
|
||||
if (!pad->hDrvr)
|
||||
|
|
|
@ -92,7 +92,7 @@ MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd,
|
|||
mmr = ACMERR_NOTPOSSIBLE;
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
/* should check for codec only */
|
||||
if (padid->bEnabled &&
|
||||
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
||||
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
|
||||
mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS,
|
||||
(LPARAM)pafd, (LPARAM)fdwDetails);
|
||||
|
@ -229,7 +229,8 @@ MMRESULT WINAPI acmFilterEnumW(HACMDRIVER had, PACMFILTERDETAILSW pafd,
|
|||
}
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
/* 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;
|
||||
ret = MSACM_FilterEnumHelper(padid, had, pafd,
|
||||
fnCallback, dwInstance, fdwEnum);
|
||||
|
@ -287,7 +288,8 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd
|
|||
mmr = ACMERR_NOTPOSSIBLE;
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
/* 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);
|
||||
acmDriverClose(had, 0);
|
||||
if (mmr == MMSYSERR_NOERROR) break;
|
||||
|
@ -311,7 +313,7 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd
|
|||
mmr = ACMERR_NOTPOSSIBLE;
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
/* should check for codec only */
|
||||
if (padid->bEnabled &&
|
||||
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
||||
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
|
||||
|
||||
memset(&tmp, 0, sizeof(tmp));
|
||||
|
@ -416,7 +418,8 @@ MMRESULT WINAPI acmFilterTagEnumW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd,
|
|||
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
/* 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++) {
|
||||
paftd->dwFilterTagIndex = i;
|
||||
|
|
|
@ -319,7 +319,7 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD
|
|||
mmr = ACMERR_NOTPOSSIBLE;
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
/* should check for codec only */
|
||||
if (padid->bEnabled &&
|
||||
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
||||
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
|
||||
mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails);
|
||||
acmDriverClose(had, 0);
|
||||
|
@ -498,7 +498,8 @@ MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd,
|
|||
}
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
/* 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;
|
||||
ret = MSACM_FormatEnumHelper(padid, had, pafd, &wfxRef,
|
||||
fnCallback, dwInstance, fdwEnum);
|
||||
|
@ -541,7 +542,7 @@ MMRESULT WINAPI acmFormatSuggest(HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
|
|||
mmr = ACMERR_NOTPOSSIBLE;
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
/* should check for codec only */
|
||||
if (!padid->bEnabled ||
|
||||
if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ||
|
||||
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
|
||||
continue;
|
||||
|
||||
|
@ -604,7 +605,7 @@ MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd
|
|||
if (had == (HACMDRIVER)NULL) {
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
/* should check for codec only */
|
||||
if (padid->bEnabled &&
|
||||
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
||||
MSACM_FindFormatTagInCache(padid, paftd->dwFormatTag, NULL) &&
|
||||
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
|
||||
mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
|
||||
|
@ -636,7 +637,7 @@ MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd
|
|||
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
/* should check for codec only */
|
||||
if (padid->bEnabled &&
|
||||
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
||||
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
|
||||
|
||||
memset(&tmp, 0, sizeof(tmp));
|
||||
|
@ -742,8 +743,8 @@ MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
|
|||
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
/* 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++) {
|
||||
paftd->dwFormatTagIndex = i;
|
||||
if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,
|
||||
|
|
|
@ -224,7 +224,7 @@ static BOOL MSACM_WriteCache(PWINE_ACMDRIVERID padid)
|
|||
PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
|
||||
HINSTANCE hinstModule)
|
||||
{
|
||||
PWINE_ACMDRIVERID padid;
|
||||
PWINE_ACMDRIVERID padid;
|
||||
|
||||
TRACE("('%s', '%s', 0x%08x)\n", pszDriverAlias, pszFileName, hinstModule);
|
||||
|
||||
|
@ -245,7 +245,6 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
|
|||
}
|
||||
padid->hInstModule = hinstModule;
|
||||
|
||||
padid->bEnabled = TRUE;
|
||||
padid->pACMDriverList = NULL;
|
||||
padid->pNextACMDriverID = NULL;
|
||||
padid->pPrevACMDriverID = MSACM_pLastACMDriverID;
|
||||
|
|
|
@ -106,7 +106,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
|
|||
case ACM_METRIC_COUNT_LOCAL_DRIVERS:
|
||||
if (hao) return MMSYSERR_INVALHANDLE;
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
||||
if (padid->bEnabled && CheckLocal(padid))
|
||||
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
|
||||
val++;
|
||||
*(LPDWORD)pMetric = val;
|
||||
break;
|
||||
|
@ -117,8 +117,9 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
|
|||
case ACM_METRIC_COUNT_LOCAL_CODECS:
|
||||
if (hao) return MMSYSERR_INVALHANDLE;
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
||||
if (padid->bEnabled && (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC)
|
||||
&& CheckLocal(padid))
|
||||
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
||||
(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC) &&
|
||||
CheckLocal(padid))
|
||||
val++;
|
||||
*(LPDWORD)pMetric = val;
|
||||
break;
|
||||
|
@ -129,8 +130,9 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
|
|||
case ACM_METRIC_COUNT_LOCAL_CONVERTERS:
|
||||
if (hao) return MMSYSERR_INVALHANDLE;
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
||||
if (padid->bEnabled && (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CONVERTER)
|
||||
&& CheckLocal(padid))
|
||||
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
||||
(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CONVERTER) &&
|
||||
CheckLocal(padid))
|
||||
val++;
|
||||
*(LPDWORD)pMetric = val;
|
||||
break;
|
||||
|
@ -141,8 +143,9 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
|
|||
case ACM_METRIC_COUNT_LOCAL_FILTERS:
|
||||
if (hao) return MMSYSERR_INVALHANDLE;
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
||||
if (padid->bEnabled && (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_FILTER)
|
||||
&& CheckLocal(padid))
|
||||
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
|
||||
(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_FILTER) &&
|
||||
CheckLocal(padid))
|
||||
val++;
|
||||
*(LPDWORD)pMetric = val;
|
||||
break;
|
||||
|
@ -153,7 +156,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
|
|||
case ACM_METRIC_COUNT_LOCAL_DISABLED:
|
||||
if (hao) return MMSYSERR_INVALHANDLE;
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
||||
if (!padid->bEnabled && CheckLocal(padid))
|
||||
if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
|
||||
val++;
|
||||
*(LPDWORD)pMetric = val;
|
||||
break;
|
||||
|
@ -161,7 +164,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
|
|||
case ACM_METRIC_MAX_SIZE_FORMAT:
|
||||
if (hao == (HACMOBJ)NULL) {
|
||||
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
||||
if (padid->bEnabled) {
|
||||
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
|
||||
for (i = 0; i < padid->cFormatTags; i++) {
|
||||
if (val < padid->aFormatTag[i].cbwfx)
|
||||
val = padid->aFormatTag[i].cbwfx;
|
||||
|
@ -177,7 +180,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
|
|||
default:
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
}
|
||||
if (padid->bEnabled) {
|
||||
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
|
||||
for (i = 0; i < padid->cFormatTags; i++) {
|
||||
if (val < padid->aFormatTag[i].cbwfx)
|
||||
val = padid->aFormatTag[i].cbwfx;
|
||||
|
|
|
@ -32,9 +32,9 @@ DEFAULT_DEBUG_CHANNEL(msacm);
|
|||
*/
|
||||
static DWORD PCM_drvOpen(LPCSTR str, PACMDRVOPENDESCW adod)
|
||||
{
|
||||
return
|
||||
adod->fccType == ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC &&
|
||||
adod->fccComp == ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
|
||||
return (adod == NULL) ||
|
||||
(adod->fccType == ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC &&
|
||||
adod->fccComp == ACMDRIVERDETAILS_FCCCOMP_UNDEFINED);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -789,8 +789,33 @@ static LRESULT PCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
|
|||
*/
|
||||
static LRESULT PCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
|
||||
{
|
||||
FIXME("(%p);\n", adfs);
|
||||
return MMSYSERR_NOTSUPPORTED;
|
||||
/* some tests ... */
|
||||
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
|
|||
if (pwfxSrc->wFormatTag != WAVE_FORMAT_PCM) wfxSrcSize += pwfxSrc->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)
|
||||
return MMSYSERR_NOMEM;
|
||||
|
||||
|
@ -160,7 +161,8 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
|
|||
was->drvInst.fdwOpen = fdwOpen;
|
||||
was->drvInst.fdwDriver = 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 (!(wad = MSACM_GetDriver(had))) {
|
||||
|
@ -181,7 +183,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
|
|||
|
||||
ret = ACMERR_NOTPOSSIBLE;
|
||||
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, pwfxDst->wFormatTag, NULL))
|
||||
continue;
|
||||
|
@ -195,7 +197,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
|
|||
was->hAcmDriver = had;
|
||||
|
||||
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 (fdwOpen & ACM_STREAMOPENF_QUERY) {
|
||||
acmDriverClose(had, 0L);
|
||||
|
@ -212,6 +214,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
|
|||
}
|
||||
}
|
||||
ret = MMSYSERR_NOERROR;
|
||||
was->drvInst.has = (HACMSTREAM)was;
|
||||
if (!(fdwOpen & ACM_STREAMOPENF_QUERY)) {
|
||||
if (phas)
|
||||
*phas = (HACMSTREAM)was;
|
||||
|
|
|
@ -299,11 +299,9 @@ typedef struct _WINE_ACMSTREAM
|
|||
typedef struct _WINE_ACMDRIVERID
|
||||
{
|
||||
WINE_ACMOBJ obj;
|
||||
LPSTR pszDriverAlias;
|
||||
LPSTR pszDriverAlias;
|
||||
LPSTR pszFileName;
|
||||
HINSTANCE hInstModule; /* NULL if global */
|
||||
DWORD dwProcessID; /* ID of process which installed a local driver */
|
||||
BOOL bEnabled;
|
||||
PWINE_ACMDRIVER pACMDriverList;
|
||||
PWINE_ACMDRIVERID pNextACMDriverID;
|
||||
PWINE_ACMDRIVERID pPrevACMDriverID;
|
||||
|
|
Loading…
Reference in New Issue