Added the ability to open several streams on the same driver.
Added a few acmMetrics options.
This commit is contained in:
parent
be5e3c6512
commit
5c7f1ab978
|
@ -74,6 +74,7 @@ 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 p;
|
||||||
|
PWINE_ACMDRIVER* tp;
|
||||||
|
|
||||||
if (fdwClose)
|
if (fdwClose)
|
||||||
return MMSYSERR_INVALFLAG;
|
return MMSYSERR_INVALFLAG;
|
||||||
|
@ -82,9 +83,14 @@ MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
|
||||||
if (!p)
|
if (!p)
|
||||||
return MMSYSERR_INVALHANDLE;
|
return MMSYSERR_INVALHANDLE;
|
||||||
|
|
||||||
p->obj.pACMDriverID->pACMDriver = NULL;
|
for (tp = &(p->obj.pACMDriverID->pACMDriverList); *tp; *tp = (*tp)->pNextACMDriver) {
|
||||||
|
if (*tp == p) {
|
||||||
|
*tp = (*tp)->pNextACMDriver;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (p->hDrvr)
|
if (p->hDrvr && !p->obj.pACMDriverID->pACMDriverList)
|
||||||
CloseDriver(p->hDrvr, 0, 0);
|
CloseDriver(p->hDrvr, 0, 0);
|
||||||
|
|
||||||
HeapFree(MSACM_hHeap, 0, p);
|
HeapFree(MSACM_hHeap, 0, p);
|
||||||
|
@ -127,29 +133,17 @@ MMRESULT WINAPI acmDriverDetailsA(HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, D
|
||||||
*/
|
*/
|
||||||
MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, DWORD fdwDetails)
|
MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, DWORD fdwDetails)
|
||||||
{
|
{
|
||||||
PWINE_ACMDRIVERID p;
|
HACMDRIVER acmDrvr;
|
||||||
MMRESULT mmr;
|
MMRESULT mmr;
|
||||||
BOOL bOpenTemporary;
|
|
||||||
|
|
||||||
p = MSACM_GetDriverID(hadid);
|
|
||||||
if (!p)
|
|
||||||
return MMSYSERR_INVALHANDLE;
|
|
||||||
|
|
||||||
if (fdwDetails)
|
if (fdwDetails)
|
||||||
return MMSYSERR_INVALFLAG;
|
return MMSYSERR_INVALFLAG;
|
||||||
|
|
||||||
bOpenTemporary = !p->pACMDriver;
|
mmr = acmDriverOpen(&acmDrvr, hadid, 0);
|
||||||
if (bOpenTemporary) {
|
if (mmr == 0) {
|
||||||
bOpenTemporary = TRUE;
|
mmr = (MMRESULT)acmDriverMessage(acmDrvr, ACMDM_DRIVER_DETAILS, (LPARAM) padd, 0);
|
||||||
acmDriverOpen((PHACMDRIVER) &p->pACMDriver, hadid, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
mmr = (MMRESULT) acmDriverMessage((HACMDRIVER) p->pACMDriver, ACMDM_DRIVER_DETAILS,
|
acmDriverClose(acmDrvr, 0);
|
||||||
(LPARAM) padd, 0);
|
|
||||||
|
|
||||||
if (bOpenTemporary) {
|
|
||||||
acmDriverClose((HACMDRIVER) p->pACMDriver, 0);
|
|
||||||
p->pACMDriver = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mmr;
|
return mmr;
|
||||||
|
@ -161,6 +155,7 @@ MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, D
|
||||||
MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum)
|
MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum)
|
||||||
{
|
{
|
||||||
PWINE_ACMDRIVERID p;
|
PWINE_ACMDRIVERID p;
|
||||||
|
DWORD fdwSupport;
|
||||||
|
|
||||||
if (!fnCallback) {
|
if (!fnCallback) {
|
||||||
return MMSYSERR_INVALPARAM;
|
return MMSYSERR_INVALPARAM;
|
||||||
|
@ -170,10 +165,15 @@ MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWOR
|
||||||
return MMSYSERR_INVALFLAG;
|
return MMSYSERR_INVALFLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = MSACM_pFirstACMDriverID;
|
for (p = MSACM_pFirstACMDriverID; p; p = p->pNextACMDriverID) {
|
||||||
while (p) {
|
fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
|
||||||
(*fnCallback)((HACMDRIVERID) p, dwInstance, ACMDRIVERDETAILS_SUPPORTF_CODEC);
|
if (!p->bEnabled) {
|
||||||
p = p->pNextACMDriverID;
|
if (fdwEnum & ACM_DRIVERENUMF_DISABLED)
|
||||||
|
fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
(*fnCallback)((HACMDRIVERID) p, dwInstance, fdwSupport);
|
||||||
}
|
}
|
||||||
|
|
||||||
return MMSYSERR_NOERROR;
|
return MMSYSERR_NOERROR;
|
||||||
|
@ -227,6 +227,7 @@ 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;
|
||||||
|
|
||||||
TRACE("(%p, %x, %08lu)\n", phad, hadid, fdwOpen);
|
TRACE("(%p, %x, %08lu)\n", phad, hadid, fdwOpen);
|
||||||
|
|
||||||
|
@ -240,30 +241,29 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
|
||||||
if (fdwOpen)
|
if (fdwOpen)
|
||||||
return MMSYSERR_INVALFLAG;
|
return MMSYSERR_INVALFLAG;
|
||||||
|
|
||||||
if (padid->pACMDriver) {
|
pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
|
||||||
/* FIXME: Is it allowed? */
|
if (!pad) return MMSYSERR_NOMEM;
|
||||||
ERR("Can't open driver '%s' twice\n", padid->pszDriverAlias);
|
|
||||||
return MMSYSERR_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
padid->pACMDriver = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
|
pad->obj.pACMDriverID = padid;
|
||||||
padid->pACMDriver->obj.pACMDriverID = padid;
|
|
||||||
|
|
||||||
if (!padid->hInstModule)
|
if (!padid->hInstModule)
|
||||||
padid->pACMDriver->hDrvr = OpenDriverA(padid->pszDriverAlias, "drivers32", 0);
|
pad->hDrvr = OpenDriverA(padid->pszDriverAlias, "drivers32", 0);
|
||||||
else
|
else
|
||||||
padid->pACMDriver->hDrvr = padid->hInstModule;
|
pad->hDrvr = padid->hInstModule;
|
||||||
|
|
||||||
if (!padid->pACMDriver->hDrvr) {
|
if (!pad->hDrvr) {
|
||||||
HeapFree(MSACM_hHeap, 0, padid->pACMDriver);
|
HeapFree(MSACM_hHeap, 0, pad);
|
||||||
padid->pACMDriver = NULL;
|
|
||||||
return MMSYSERR_ERROR;
|
return MMSYSERR_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
padid->pACMDriver->pfnDriverProc = GetProcAddress(padid->pACMDriver->hDrvr, "DriverProc");
|
pad->pfnDriverProc = GetProcAddress(pad->hDrvr, "DriverProc");
|
||||||
|
|
||||||
|
/* insert new pad at beg of list */
|
||||||
|
pad->pNextACMDriver = padid->pACMDriverList;
|
||||||
|
padid->pACMDriverList = pad;
|
||||||
|
|
||||||
/* FIXME: Create a WINE_ACMDRIVER32 */
|
/* FIXME: Create a WINE_ACMDRIVER32 */
|
||||||
*phad = (HACMDRIVER) padid->pACMDriver;
|
*phad = (HACMDRIVER)pad;
|
||||||
|
|
||||||
return MMSYSERR_NOERROR;
|
return MMSYSERR_NOERROR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,9 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
|
||||||
padid->pszFileName = HEAP_strdupA(MSACM_hHeap, 0, pszFileName);
|
padid->pszFileName = HEAP_strdupA(MSACM_hHeap, 0, pszFileName);
|
||||||
padid->hInstModule = hinstModule;
|
padid->hInstModule = hinstModule;
|
||||||
padid->bEnabled = TRUE;
|
padid->bEnabled = TRUE;
|
||||||
padid->pACMDriver = NULL;
|
padid->pACMDriverList = NULL;
|
||||||
padid->pNextACMDriverID = NULL;
|
padid->pNextACMDriverID = NULL;
|
||||||
padid->pPreviousACMDriverID = MSACM_pLastACMDriverID;
|
padid->pPrevACMDriverID = MSACM_pLastACMDriverID;
|
||||||
if (MSACM_pLastACMDriverID)
|
if (MSACM_pLastACMDriverID)
|
||||||
MSACM_pLastACMDriverID->pNextACMDriverID = padid;
|
MSACM_pLastACMDriverID->pNextACMDriverID = padid;
|
||||||
MSACM_pLastACMDriverID = padid;
|
MSACM_pLastACMDriverID = padid;
|
||||||
|
@ -100,8 +100,8 @@ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
|
||||||
{
|
{
|
||||||
PWINE_ACMDRIVERID pNextACMDriverID;
|
PWINE_ACMDRIVERID pNextACMDriverID;
|
||||||
|
|
||||||
if (p->pACMDriver)
|
while (p->pACMDriverList)
|
||||||
acmDriverClose((HACMDRIVER) p->pACMDriver, 0);
|
acmDriverClose((HACMDRIVER) p->pACMDriverList, 0);
|
||||||
|
|
||||||
if (p->pszDriverAlias)
|
if (p->pszDriverAlias)
|
||||||
HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);
|
HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);
|
||||||
|
@ -111,12 +111,12 @@ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
|
||||||
if (p == MSACM_pFirstACMDriverID)
|
if (p == MSACM_pFirstACMDriverID)
|
||||||
MSACM_pFirstACMDriverID = p->pNextACMDriverID;
|
MSACM_pFirstACMDriverID = p->pNextACMDriverID;
|
||||||
if (p == MSACM_pLastACMDriverID)
|
if (p == MSACM_pLastACMDriverID)
|
||||||
MSACM_pLastACMDriverID = p->pPreviousACMDriverID;
|
MSACM_pLastACMDriverID = p->pPrevACMDriverID;
|
||||||
|
|
||||||
if (p->pPreviousACMDriverID)
|
if (p->pPrevACMDriverID)
|
||||||
p->pPreviousACMDriverID->pNextACMDriverID = p->pNextACMDriverID;
|
p->pPrevACMDriverID->pNextACMDriverID = p->pNextACMDriverID;
|
||||||
if (p->pNextACMDriverID)
|
if (p->pNextACMDriverID)
|
||||||
p->pNextACMDriverID->pPreviousACMDriverID = p->pPreviousACMDriverID;
|
p->pNextACMDriverID->pPrevACMDriverID = p->pPrevACMDriverID;
|
||||||
|
|
||||||
pNextACMDriverID = p->pNextACMDriverID;
|
pNextACMDriverID = p->pNextACMDriverID;
|
||||||
|
|
||||||
|
|
|
@ -89,34 +89,71 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
|
||||||
{
|
{
|
||||||
PWINE_ACMOBJ pao = MSACM_GetObj(hao);
|
PWINE_ACMOBJ pao = MSACM_GetObj(hao);
|
||||||
BOOL bLocal = TRUE;
|
BOOL bLocal = TRUE;
|
||||||
|
PWINE_ACMDRIVERID padid;
|
||||||
|
DWORD val = 0;
|
||||||
|
|
||||||
FIXME("(0x%08x, %d, %p): stub\n", hao, uMetric, pMetric);
|
FIXME("(0x%08x, %d, %p): stub\n", hao, uMetric, pMetric);
|
||||||
|
|
||||||
switch (uMetric) {
|
switch (uMetric) {
|
||||||
case ACM_METRIC_COUNT_DRIVERS:
|
case ACM_METRIC_COUNT_DRIVERS:
|
||||||
bLocal = FALSE;
|
bLocal = FALSE;
|
||||||
|
/* fall thru */
|
||||||
case ACM_METRIC_COUNT_LOCAL_DRIVERS:
|
case ACM_METRIC_COUNT_LOCAL_DRIVERS:
|
||||||
if (!pao)
|
if (!pao)
|
||||||
return MMSYSERR_INVALHANDLE;
|
return MMSYSERR_INVALHANDLE;
|
||||||
return MMSYSERR_NOTSUPPORTED;
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
||||||
|
if (padid->bEnabled /* && (local(padid) || !bLocal) */)
|
||||||
|
val++;
|
||||||
|
*(LPDWORD)pMetric = val;
|
||||||
|
return 0;
|
||||||
|
|
||||||
case ACM_METRIC_COUNT_CODECS:
|
case ACM_METRIC_COUNT_CODECS:
|
||||||
|
if (!pao)
|
||||||
|
return MMSYSERR_INVALHANDLE;
|
||||||
bLocal = FALSE;
|
bLocal = FALSE;
|
||||||
|
/* fall thru */
|
||||||
case ACM_METRIC_COUNT_LOCAL_CODECS:
|
case ACM_METRIC_COUNT_LOCAL_CODECS:
|
||||||
return MMSYSERR_NOTSUPPORTED;
|
/* FIXME: don't know how to differentiate codec, converters & filters yet */
|
||||||
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
||||||
|
if (padid->bEnabled /* && (local(padid) || !bLocal) */)
|
||||||
|
val++;
|
||||||
|
*(LPDWORD)pMetric = val;
|
||||||
|
return 0;
|
||||||
|
|
||||||
case ACM_METRIC_COUNT_CONVERTERS:
|
case ACM_METRIC_COUNT_CONVERTERS:
|
||||||
bLocal = FALSE;
|
bLocal = FALSE;
|
||||||
|
/* fall thru */
|
||||||
case ACM_METRIC_COUNT_LOCAL_CONVERTERS:
|
case ACM_METRIC_COUNT_LOCAL_CONVERTERS:
|
||||||
return MMSYSERR_NOTSUPPORTED;
|
/* FIXME: don't know how to differentiate codec, converters & filters yet */
|
||||||
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
||||||
|
if (padid->bEnabled /* && (local(padid) || !bLocal) */)
|
||||||
|
val++;
|
||||||
|
*(LPDWORD)pMetric = val;
|
||||||
|
return 0;
|
||||||
|
|
||||||
case ACM_METRIC_COUNT_FILTERS:
|
case ACM_METRIC_COUNT_FILTERS:
|
||||||
bLocal = FALSE;
|
bLocal = FALSE;
|
||||||
|
/* fall thru */
|
||||||
case ACM_METRIC_COUNT_LOCAL_FILTERS:
|
case ACM_METRIC_COUNT_LOCAL_FILTERS:
|
||||||
return MMSYSERR_NOTSUPPORTED;
|
/* FIXME: don't know how to differentiate codec, converters & filters yet */
|
||||||
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
||||||
|
if (padid->bEnabled /* && (local(padid) || !bLocal) */)
|
||||||
|
val++;
|
||||||
|
*(LPDWORD)pMetric = val;
|
||||||
|
return 0;
|
||||||
|
|
||||||
case ACM_METRIC_COUNT_DISABLED:
|
case ACM_METRIC_COUNT_DISABLED:
|
||||||
bLocal = FALSE;
|
bLocal = FALSE;
|
||||||
|
/* fall thru */
|
||||||
case ACM_METRIC_COUNT_LOCAL_DISABLED:
|
case ACM_METRIC_COUNT_LOCAL_DISABLED:
|
||||||
if (!pao)
|
if (!pao)
|
||||||
return MMSYSERR_INVALHANDLE;
|
return MMSYSERR_INVALHANDLE;
|
||||||
return MMSYSERR_NOTSUPPORTED;
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
|
||||||
|
if (!padid->bEnabled /* && (local(padid) || !bLocal) */)
|
||||||
|
val++;
|
||||||
|
*(LPDWORD)pMetric = val;
|
||||||
|
return 0;
|
||||||
|
|
||||||
case ACM_METRIC_COUNT_HARDWARE:
|
case ACM_METRIC_COUNT_HARDWARE:
|
||||||
case ACM_METRIC_HARDWARE_WAVE_INPUT:
|
case ACM_METRIC_HARDWARE_WAVE_INPUT:
|
||||||
case ACM_METRIC_HARDWARE_WAVE_OUTPUT:
|
case ACM_METRIC_HARDWARE_WAVE_OUTPUT:
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* Wine specific - Win32
|
* Wine specific - Win32
|
||||||
*/
|
*/
|
||||||
typedef struct _WINE_ACMDRIVERID *PWINE_ACMDRIVERID;
|
typedef struct _WINE_ACMDRIVERID *PWINE_ACMDRIVERID;
|
||||||
|
typedef struct _WINE_ACMDRIVER *PWINE_ACMDRIVER;
|
||||||
|
|
||||||
typedef struct _WINE_ACMOBJ
|
typedef struct _WINE_ACMOBJ
|
||||||
{
|
{
|
||||||
|
@ -15,7 +16,8 @@ typedef struct _WINE_ACMDRIVER
|
||||||
WINE_ACMOBJ obj;
|
WINE_ACMOBJ obj;
|
||||||
HDRVR hDrvr;
|
HDRVR hDrvr;
|
||||||
DRIVERPROC pfnDriverProc;
|
DRIVERPROC pfnDriverProc;
|
||||||
} WINE_ACMDRIVER, *PWINE_ACMDRIVER;
|
PWINE_ACMDRIVER pNextACMDriver;
|
||||||
|
} WINE_ACMDRIVER;
|
||||||
|
|
||||||
typedef struct _WINE_ACMSTREAM
|
typedef struct _WINE_ACMSTREAM
|
||||||
{
|
{
|
||||||
|
@ -32,9 +34,9 @@ typedef struct _WINE_ACMDRIVERID
|
||||||
HINSTANCE hInstModule; /* NULL if global */
|
HINSTANCE hInstModule; /* NULL if global */
|
||||||
DWORD dwProcessID; /* ID of process which installed a local driver */
|
DWORD dwProcessID; /* ID of process which installed a local driver */
|
||||||
BOOL bEnabled;
|
BOOL bEnabled;
|
||||||
PWINE_ACMDRIVER pACMDriver; /* NULL if not open; shouldn't this be a list ? */
|
PWINE_ACMDRIVER pACMDriverList;
|
||||||
PWINE_ACMDRIVERID pNextACMDriverID;
|
PWINE_ACMDRIVERID pNextACMDriverID;
|
||||||
PWINE_ACMDRIVERID pPreviousACMDriverID;
|
PWINE_ACMDRIVERID pPrevACMDriverID;
|
||||||
} WINE_ACMDRIVERID;
|
} WINE_ACMDRIVERID;
|
||||||
|
|
||||||
/* From internal.c */
|
/* From internal.c */
|
||||||
|
|
Loading…
Reference in New Issue