From b8ba84590bf9a5c43edef2aa1f5dce26e28f2741 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Sat, 26 Aug 2000 04:33:00 +0000 Subject: [PATCH] Implemented most of '*Format*' API. Improved internal object and messages handling. Started some '*Filter*' functions. Fixed standard headers for Winelib. Fixed acmMetrics. --- dlls/msacm/.cvsignore | 1 + dlls/msacm/Makefile.in | 3 + dlls/msacm/driver.c | 50 ++- dlls/msacm/filter.c | 178 +++++---- dlls/msacm/format.c | 773 +++++++++++++++++++++++++++++++++----- dlls/msacm/internal.c | 41 +- dlls/msacm/msacm.rc | 45 +++ dlls/msacm/msacm32.spec | 1 + dlls/msacm/msacm32_main.c | 54 ++- dlls/msacm/stream.c | 2 + dlls/msacm/wineacm.h | 47 ++- include/msacm.h | 55 +++ 12 files changed, 1015 insertions(+), 235 deletions(-) create mode 100644 dlls/msacm/msacm.rc diff --git a/dlls/msacm/.cvsignore b/dlls/msacm/.cvsignore index 52d50c06c1..4be7f8b054 100644 --- a/dlls/msacm/.cvsignore +++ b/dlls/msacm/.cvsignore @@ -3,3 +3,4 @@ Makefile libmsacm.so.1.0 libmsacm32.so.1.0 +msacm.s diff --git a/dlls/msacm/Makefile.in b/dlls/msacm/Makefile.in index 9a41981d89..812b2ef7aa 100644 --- a/dlls/msacm/Makefile.in +++ b/dlls/msacm/Makefile.in @@ -16,6 +16,9 @@ C_SRCS = \ msacm_main.c \ stream.c +RC_SRCS = \ + msacm.rc + @MAKE_DLL_RULES@ ### Dependencies: diff --git a/dlls/msacm/driver.c b/dlls/msacm/driver.c index 9a185ba4e4..574dbd6ed6 100644 --- a/dlls/msacm/driver.c +++ b/dlls/msacm/driver.c @@ -142,8 +142,8 @@ MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, D return MMSYSERR_INVALFLAG; mmr = acmDriverOpen(&acmDrvr, hadid, 0); - if (mmr == 0) { - mmr = (MMRESULT)acmDriverMessage(acmDrvr, ACMDM_DRIVER_DETAILS, (LPARAM) padd, 0); + if (mmr == MMSYSERR_NOERROR) { + mmr = (MMRESULT)MSACM_Message(acmDrvr, ACMDM_DRIVER_DETAILS, (LPARAM)padd, 0); acmDriverClose(acmDrvr, 0); } @@ -157,25 +157,25 @@ MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, D MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum) { PWINE_ACMDRIVERID p; - DWORD fdwSupport; + ACMDRIVERDETAILSW add; - if (!fnCallback) { - return MMSYSERR_INVALPARAM; - } + if (!fnCallback) return MMSYSERR_INVALPARAM; - if (fdwEnum && ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED)) { + if (fdwEnum && ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED)) return MMSYSERR_INVALFLAG; - } + add.cbStruct = sizeof(add); for (p = MSACM_pFirstACMDriverID; p; p = p->pNextACMDriverID) { - fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; + if (acmDriverDetailsW((HACMDRIVERID)p, &add, 0) != MMSYSERR_NOERROR) + continue; if (!p->bEnabled) { if (fdwEnum & ACM_DRIVERENUMF_DISABLED) - fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED; + add.fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED; else continue; } - (*fnCallback)((HACMDRIVERID) p, dwInstance, fdwSupport); + if (!(*fnCallback)((HACMDRIVERID)p, dwInstance, add.fdwSupport)) + break; } return MMSYSERR_NOERROR; @@ -188,16 +188,16 @@ MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID { PWINE_ACMOBJ pao; - pao = MSACM_GetObj(hao); - if (!pao) - return MMSYSERR_INVALHANDLE; - if (!phadid) return MMSYSERR_INVALPARAM; if (fdwDriverID) return MMSYSERR_INVALFLAG; + pao = MSACM_GetObj(hao, WINE_ACMOBJ_DONTCARE); + if (!pao) + return MMSYSERR_INVALHANDLE; + *phadid = (HACMDRIVERID) pao->pACMDriverID; return MMSYSERR_NOERROR; @@ -205,21 +205,16 @@ MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID /*********************************************************************** * acmDriverMessage (MSACM32.9) - * FIXME - * Not implemented + * */ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2) { - PWINE_ACMDRIVER pad = MSACM_GetDriver(had); - if (!pad) - return MMSYSERR_INVALPARAM; - - /* FIXME: Check if uMsg legal */ - - if (!SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2)) - return MMSYSERR_NOTSUPPORTED; - - return MMSYSERR_NOERROR; + if ((uMsg >= ACMDM_USER && uMsg < ACMDM_RESERVED_LOW) || + uMsg == ACMDM_DRIVER_ABOUT || + uMsg == DRV_QUERYCONFIGURE || + uMsg == DRV_CONFIGURE) + return MSACM_Message(had, uMsg, lParam1, lParam2); + return MMSYSERR_INVALPARAM; } @@ -246,6 +241,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER)); if (!pad) return MMSYSERR_NOMEM; + pad->obj.dwType = WINE_ACMOBJ_DRIVER; pad->obj.pACMDriverID = padid; if (!padid->hInstModule) diff --git a/dlls/msacm/filter.c b/dlls/msacm/filter.c index e12e194eb7..fc64de0d29 100644 --- a/dlls/msacm/filter.c +++ b/dlls/msacm/filter.c @@ -1,3 +1,5 @@ +/* -*- tab-width: 8; c-basic-offset: 4 -*- */ + /* * MSACM32 library * @@ -9,148 +11,162 @@ #include "mmsystem.h" #include "msacm.h" #include "msacmdrv.h" +#include "wineacm.h" #include "debugtools.h" -DEFAULT_DEBUG_CHANNEL(msacm) +DEFAULT_DEBUG_CHANNEL(msacm); /*********************************************************************** * acmFilterChooseA (MSACM32.13) */ -MMRESULT WINAPI acmFilterChooseA( - PACMFILTERCHOOSEA pafltrc) +MMRESULT WINAPI acmFilterChooseA(PACMFILTERCHOOSEA pafltrc) { - FIXME("(%p): stub\n", pafltrc); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + FIXME("(%p): stub\n", pafltrc); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return MMSYSERR_ERROR; } /*********************************************************************** * acmFilterChooseW (MSACM32.14) */ -MMRESULT WINAPI acmFilterChooseW( - PACMFILTERCHOOSEW pafltrc) +MMRESULT WINAPI acmFilterChooseW(PACMFILTERCHOOSEW pafltrc) { - FIXME("(%p): stub\n", pafltrc); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + FIXME("(%p): stub\n", pafltrc); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return MMSYSERR_ERROR; } /*********************************************************************** * acmFilterDetailsA (MSACM32.15) */ -MMRESULT WINAPI acmFilterDetailsA( - HACMDRIVER had, PACMFILTERDETAILSA pafd, DWORD fdwDetails) +MMRESULT WINAPI acmFilterDetailsA(HACMDRIVER had, PACMFILTERDETAILSA pafd, + DWORD fdwDetails) { - if(fdwDetails & ~(ACM_FILTERDETAILSF_FILTER)) - return MMSYSERR_INVALFLAG; + ACMFILTERDETAILSW afdw; + MMRESULT mmr; - /* FIXME - * How does the driver know if the ANSI or - * the UNICODE variant of PACMFILTERDETAILS is used? - * It might check cbStruct or does it only accept ANSI. - */ - return (MMRESULT) acmDriverMessage( - had, ACMDM_FILTER_DETAILS, - (LPARAM) pafd, (LPARAM) fdwDetails - ); + memset(&afdw, 0, sizeof(afdw)); + afdw.cbStruct = sizeof(afdw); + afdw.dwFilterIndex = pafd->dwFilterIndex; + afdw.dwFilterTag = pafd->dwFilterTag; + afdw.pwfltr = pafd->pwfltr; + afdw.cbwfltr = pafd->cbwfltr; + + mmr = acmFilterDetailsW(had, &afdw, fdwDetails); + if (mmr == MMSYSERR_NOERROR) { + pafd->dwFilterTag = afdw.dwFilterTag; + pafd->fdwSupport = afdw.fdwSupport; + lstrcpyWtoA(pafd->szFilter, afdw.szFilter); + } + return mmr; } /*********************************************************************** * acmFilterDetailsW (MSACM32.16) */ -MMRESULT WINAPI acmFilterDetailsW( - HACMDRIVER had, PACMFILTERDETAILSW pafd, DWORD fdwDetails) +MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd, + DWORD fdwDetails) { - FIXME("(0x%08x, %p, %ld): stub\n", had, pafd, fdwDetails); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + TRACE("(0x%08x, %p, %ld)\n", had, pafd, fdwDetails); + + if (fdwDetails & ~(ACM_FILTERDETAILSF_FILTER)) + return MMSYSERR_INVALFLAG; + + return MSACM_Message(had, ACMDM_FILTER_DETAILS, + (LPARAM) pafd, (LPARAM) fdwDetails); } /*********************************************************************** * acmFilterEnumA (MSACM32.17) */ -MMRESULT WINAPI acmFilterEnumA( - HACMDRIVER had, PACMFILTERDETAILSA pafd, - ACMFILTERENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum) +MMRESULT WINAPI acmFilterEnumA(HACMDRIVER had, PACMFILTERDETAILSA pafd, + ACMFILTERENUMCBA fnCallback, DWORD dwInstance, + DWORD fdwEnum) { - FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", - had, pafd, fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", + had, pafd, fnCallback, dwInstance, fdwEnum); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return MMSYSERR_ERROR; } /*********************************************************************** * acmFilterEnumW (MSACM32.18) */ -MMRESULT WINAPI acmFilterEnumW( - HACMDRIVER had, PACMFILTERDETAILSW pafd, - ACMFILTERENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum) +MMRESULT WINAPI acmFilterEnumW(HACMDRIVER had, PACMFILTERDETAILSW pafd, + ACMFILTERENUMCBW fnCallback, DWORD dwInstance, + DWORD fdwEnum) { - FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", - had, pafd, fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", + had, pafd, fnCallback, dwInstance, fdwEnum); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return MMSYSERR_ERROR; } /*********************************************************************** * acmFilterTagDetailsA (MSACM32.19) */ -MMRESULT WINAPI acmFilterTagDetailsA( - HACMDRIVER had, PACMFILTERTAGDETAILSA paftd, DWORD fdwDetails) +MMRESULT WINAPI acmFilterTagDetailsA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftda, + DWORD fdwDetails) { - if(fdwDetails & - ~(ACM_FILTERTAGDETAILSF_FILTERTAG| - ACM_FILTERTAGDETAILSF_LARGESTSIZE)) - return MMSYSERR_INVALFLAG; + ACMFILTERTAGDETAILSW aftdw; + MMRESULT mmr; - /* FIXME - * How does the driver know if the ANSI or - * the UNICODE variant of PACMFILTERTAGDETAILS is used? - * It might check cbStruct or does it only accept ANSI. - */ - return (MMRESULT) acmDriverMessage( - had, ACMDM_FILTERTAG_DETAILS, - (LPARAM) paftd, (LPARAM) fdwDetails - ); + memset(&aftdw, 0, sizeof(aftdw)); + aftdw.cbStruct = sizeof(aftdw); + aftdw.dwFilterTagIndex = paftda->dwFilterTagIndex; + aftdw.dwFilterTag = paftda->dwFilterTag; + + mmr = acmFilterTagDetailsW(had, &aftdw, fdwDetails); + if (mmr == MMSYSERR_NOERROR) { + paftda->dwFilterTag = aftdw.dwFilterTag; + paftda->dwFilterTagIndex = aftdw.dwFilterTagIndex; + paftda->cbFilterSize = aftdw.cbFilterSize; + paftda->fdwSupport = aftdw.fdwSupport; + paftda->cStandardFilters = aftdw.cStandardFilters; + lstrcpyWtoA(paftda->szFilterTag, aftdw.szFilterTag); + } + return mmr; } /*********************************************************************** * acmFilterTagDetailsW (MSACM32.20) */ -MMRESULT WINAPI acmFilterTagDetailsW( - HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, DWORD fdwDetails) +MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, + DWORD fdwDetails) { - FIXME("(0x%08x, %p, %ld): stub\n", had, paftd, fdwDetails); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + TRACE("(0x%08x, %p, %ld)\n", had, paftd, fdwDetails); + + if (fdwDetails & + ~(ACM_FILTERTAGDETAILSF_FILTERTAG| + ACM_FILTERTAGDETAILSF_LARGESTSIZE)) + return MMSYSERR_INVALFLAG; + + return MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, + (LPARAM)paftd, (LPARAM)fdwDetails); } /*********************************************************************** * acmFilterTagEnumA (MSACM32.21) */ -MMRESULT WINAPI acmFilterTagEnumA( - HACMDRIVER had, PACMFILTERTAGDETAILSA paftd, - ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum) +MMRESULT WINAPI acmFilterTagEnumA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftd, + ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance, + DWORD fdwEnum) { - FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", - had, paftd, fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", + had, paftd, fnCallback, dwInstance, fdwEnum); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return MMSYSERR_ERROR; } /*********************************************************************** * acmFilterTagEnumW (MSACM32.22) */ -MMRESULT WINAPI acmFilterTagEnumW( - HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, - ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum) +MMRESULT WINAPI acmFilterTagEnumW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, + ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance, + DWORD fdwEnum) { - FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", - had, paftd, fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", + had, paftd, fnCallback, dwInstance, fdwEnum); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return MMSYSERR_ERROR; } diff --git a/dlls/msacm/format.c b/dlls/msacm/format.c index 94b7973b7f..76898dc2e4 100644 --- a/dlls/msacm/format.c +++ b/dlls/msacm/format.c @@ -1,170 +1,765 @@ +/* -*- tab-width: 8; c-basic-offset: 4 -*- */ + /* * MSACM32 library * * Copyright 1998 Patrik Stridvall + * 2000 Eric Pouech */ #include "winbase.h" #include "winerror.h" #include "windef.h" +#include "wingdi.h" +#include "winuser.h" #include "debugtools.h" #include "mmsystem.h" #include "msacm.h" #include "msacmdrv.h" +#include "wineacm.h" -DEFAULT_DEBUG_CHANNEL(msacm) +DEFAULT_DEBUG_CHANNEL(msacm); + +static PACMFORMATCHOOSEA afc; + +struct MSACM_FillFormatData { + HWND hWnd; +#define WINE_ACMFF_TAG 0 +#define WINE_ACMFF_FORMAT 1 +#define WINE_ACMFF_WFX 2 + int mode; + char szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; + PACMFORMATCHOOSEA afc; + DWORD ret; +}; + +static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid, + PACMFORMATTAGDETAILSA paftd, + DWORD dwInstance, DWORD fdwSupport) +{ + struct MSACM_FillFormatData* affd = (struct MSACM_FillFormatData*)dwInstance; + + switch (affd->mode) { + case WINE_ACMFF_TAG: + if (SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, + CB_FINDSTRINGEXACT, + (WPARAM)-1, (LPARAM)paftd->szFormatTag) == CB_ERR) + SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, + CB_ADDSTRING, 0, (DWORD)paftd->szFormatTag); + break; + case WINE_ACMFF_FORMAT: + if (strcmp(affd->szFormatTag, paftd->szFormatTag) == 0) { + HACMDRIVER had; + + if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) { + ACMFORMATDETAILSA afd; + int i, idx; + MMRESULT mmr; + char buffer[64]; + + afd.cbStruct = sizeof(afd); + afd.dwFormatTag = paftd->dwFormatTag; + afd.pwfx = HeapAlloc(GetProcessHeap(), 0, paftd->cbFormatSize); + afd.pwfx->wFormatTag = paftd->dwFormatTag; + afd.pwfx->cbSize = paftd->cbFormatSize; + afd.cbwfx = paftd->cbFormatSize; + + for (i = 0; i < paftd->cStandardFormats; i++) { + afd.dwFormatIndex = i; + mmr = acmFormatDetailsA(had, &afd, ACM_FORMATDETAILSF_INDEX); + if (mmr == MMSYSERR_NOERROR) { + strcpy(buffer, afd.szFormat); + for (idx = strlen(buffer); + idx < ACMFORMATTAGDETAILS_FORMATTAG_CHARS; idx++) + buffer[idx] = ' '; + wsprintfA(buffer + ACMFORMATTAGDETAILS_FORMATTAG_CHARS, + "%d Ko/s", + (afd.pwfx->nAvgBytesPerSec + 512) / 1024); + SendDlgItemMessageA(affd->hWnd, + IDD_ACMFORMATCHOOSE_CMB_FORMAT, + CB_ADDSTRING, 0, (DWORD)buffer); + } + } + acmDriverClose(had, 0); + SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, + CB_SETCURSEL, 0, 0); + } + } + break; + case WINE_ACMFF_WFX: + if (strcmp(affd->szFormatTag, paftd->szFormatTag) == 0) { + HACMDRIVER had; + + if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) { + ACMFORMATDETAILSA afd; + + afd.cbStruct = sizeof(afd); + afd.dwFormatTag = paftd->dwFormatTag; + afd.pwfx = affd->afc->pwfx; + afd.cbwfx = affd->afc->cbwfx; + + afd.dwFormatIndex = SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_GETCURSEL, 0, 0);; + affd->ret = acmFormatDetailsA(had, &afd, ACM_FORMATDETAILSF_INDEX); + acmDriverClose(had, 0); + return TRUE; + } + } + break; + default: + FIXME("Unknown mode (%d)\n", affd->mode); + break; + } + return TRUE; +} + +static BOOL MSACM_FillFormatTags(HWND hWnd) +{ + ACMFORMATTAGDETAILSA aftd; + struct MSACM_FillFormatData affd; + + memset(&aftd, 0, sizeof(aftd)); + aftd.cbStruct = sizeof(aftd); + + affd.hWnd = hWnd; + affd.mode = WINE_ACMFF_TAG; + + acmFormatTagEnumA((HACMDRIVER)0, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0); + SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, CB_SETCURSEL, 0, 0); + return TRUE; +} + +static BOOL MSACM_FillFormat(HWND hWnd) +{ + ACMFORMATTAGDETAILSA aftd; + struct MSACM_FillFormatData affd; + + SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_RESETCONTENT, 0, 0); + + memset(&aftd, 0, sizeof(aftd)); + aftd.cbStruct = sizeof(aftd); + + affd.hWnd = hWnd; + affd.mode = WINE_ACMFF_FORMAT; + SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, + CB_GETLBTEXT, + SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, + CB_GETCURSEL, 0, 0), + (DWORD)affd.szFormatTag); + + acmFormatTagEnumA((HACMDRIVER)0, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0); + SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_SETCURSEL, 0, 0); + return TRUE; +} + +static MMRESULT MSACM_GetWFX(HWND hWnd, PACMFORMATCHOOSEA afc) +{ + ACMFORMATTAGDETAILSA aftd; + struct MSACM_FillFormatData affd; + + memset(&aftd, 0, sizeof(aftd)); + aftd.cbStruct = sizeof(aftd); + + affd.hWnd = hWnd; + affd.mode = WINE_ACMFF_WFX; + affd.afc = afc; + affd.ret = MMSYSERR_NOERROR; + + acmFormatTagEnumA((HACMDRIVER)0, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0); + return affd.ret; +} + +static BOOL WINAPI FormatChooseDlgProc(HWND hWnd, UINT msg, + WPARAM wParam, LPARAM lParam) +{ + + TRACE("hwnd=%i msg=%i 0x%08x 0x%08lx\n", hWnd, msg, wParam, lParam ); + + switch (msg) { + case WM_INITDIALOG: + afc = (PACMFORMATCHOOSEA)lParam; + MSACM_FillFormatTags(hWnd); + MSACM_FillFormat(hWnd); + if ((afc->fdwStyle & ~(ACMFORMATCHOOSE_STYLEF_CONTEXTHELP| + ACMFORMATCHOOSE_STYLEF_SHOWHELP)) != 0) + FIXME("Unsupported style %08lx\n", ((PACMFORMATCHOOSEA)lParam)->fdwStyle); + if (!(afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP)) + ShowWindow(GetDlgItem(hWnd, IDD_ACMFORMATCHOOSE_BTN_HELP), SW_HIDE); + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDOK: + EndDialog(hWnd, MSACM_GetWFX(hWnd, afc)); + return TRUE; + case IDCANCEL: + EndDialog(hWnd, ACMERR_CANCELED); + return TRUE; + case IDD_ACMFORMATCHOOSE_CMB_FORMATTAG: + switch (HIWORD(wParam)) { + case CBN_SELCHANGE: + MSACM_FillFormat(hWnd); + break; + default: + TRACE("Dropped dlgNotif (fmtTag): 0x%08x 0x%08lx\n", + HIWORD(wParam), lParam); + break; + } + break; + case IDD_ACMFORMATCHOOSE_BTN_HELP: + if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP) + SendMessageA(afc->hwndOwner, + RegisterWindowMessageA(ACMHELPMSGSTRINGA), 0L, 0L); + break; + + default: + TRACE("Dropped dlgCmd: ctl=%d ntf=0x%04x 0x%08lx\n", + LOWORD(wParam), HIWORD(wParam), lParam); + break; + } + break; + case WM_CONTEXTMENU: + if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_CONTEXTHELP) + SendMessageA(afc->hwndOwner, + RegisterWindowMessageA(ACMHELPMSGCONTEXTMENUA), + wParam, lParam); + break; +#if defined(WM_CONTEXTHELP) + case WM_CONTEXTHELP: + if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_CONTEXTHELP) + SendMessageA(afc->hwndOwner, + RegisterWindowMessageA(ACMHELPMSGCONTEXTHELPA), + wParam, lParam); + break; +#endif + default: + TRACE("Dropped dlgMsg: hwnd=%i msg=%i 0x%08x 0x%08lx\n", + hWnd, msg, wParam, lParam ); + break; + } + return FALSE; +} /*********************************************************************** * acmFormatChooseA (MSACM32.23) */ -MMRESULT WINAPI acmFormatChooseA( - PACMFORMATCHOOSEA pafmtc) +MMRESULT WINAPI acmFormatChooseA(PACMFORMATCHOOSEA pafmtc) { - FIXME("(%p): stub\n", pafmtc); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + return DialogBoxParamA(MSACM_hInstance32, MAKEINTRESOURCEA(DLG_ACMFORMATCHOOSE_ID), + pafmtc->hwndOwner, FormatChooseDlgProc, (INT)pafmtc); } /*********************************************************************** * acmFormatChooseW (MSACM32.24) */ -MMRESULT WINAPI acmFormatChooseW( - PACMFORMATCHOOSEW pafmtc) +MMRESULT WINAPI acmFormatChooseW(PACMFORMATCHOOSEW pafmtc) { - FIXME("(%p): stub\n", pafmtc); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + FIXME("(%p): stub\n", pafmtc); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return MMSYSERR_ERROR; } /*********************************************************************** * acmFormatDetailsA (MSACM32.25) */ -MMRESULT WINAPI acmFormatDetailsA( - HACMDRIVER had, PACMFORMATDETAILSA pafd, DWORD fdwDetails) +MMRESULT WINAPI acmFormatDetailsA(HACMDRIVER had, PACMFORMATDETAILSA pafd, + DWORD fdwDetails) { - if(fdwDetails & ~(ACM_FORMATDETAILSF_FORMAT)) - return MMSYSERR_INVALFLAG; + ACMFORMATDETAILSW afdw; + MMRESULT mmr; - /* FIXME - * How does the driver know if the ANSI or - * the UNICODE variant of PACMFORMATDETAILS is used? - * It might check cbStruct or does it only accept ANSI. - */ - return (MMRESULT) acmDriverMessage( - had, ACMDM_FORMAT_DETAILS, - (LPARAM) pafd, (LPARAM) fdwDetails - ); + memset(&afdw, 0, sizeof(afdw)); + afdw.cbStruct = sizeof(afdw); + afdw.dwFormatIndex = pafd->dwFormatIndex; + afdw.dwFormatTag = pafd->dwFormatTag; + afdw.pwfx = pafd->pwfx; + afdw.cbwfx = pafd->cbwfx; + + mmr = acmFormatDetailsW(had, &afdw, fdwDetails); + if (mmr == MMSYSERR_NOERROR) { + pafd->dwFormatTag = afdw.dwFormatTag; + pafd->fdwSupport = afdw.fdwSupport; + lstrcpyWtoA(pafd->szFormat, afdw.szFormat); + } + return mmr; } /*********************************************************************** * acmFormatDetailsW (MSACM32.26) */ -MMRESULT WINAPI acmFormatDetailsW( - HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails) +MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, + DWORD fdwDetails) { - FIXME("(0x%08x, %p, %ld): stub\n", had, pafd, fdwDetails); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + MMRESULT mmr; + static WCHAR fmt1[] = {'%','d',' ','H','z',0}; + static WCHAR fmt2[] = {';',' ','%','d',' ','b','i','t','s',0}; + ACMFORMATTAGDETAILSA aftd; + + TRACE("(0x%08x, %p, %ld)\n", had, pafd, fdwDetails); + + memset(&aftd, 0, sizeof(aftd)); + aftd.cbStruct = sizeof(aftd); + + if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM; + + switch (fdwDetails) { + case ACM_FORMATDETAILSF_FORMAT: + if (pafd->dwFormatTag != pafd->pwfx->wFormatTag) + mmr = MMSYSERR_INVALPARAM; + if (had == (HACMDRIVER)NULL) { + PWINE_ACMDRIVERID padid; + + 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) { + mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, + (LPARAM)pafd, (LPARAM)fdwDetails); + acmDriverClose(had, 0); + if (mmr == MMSYSERR_NOERROR) break; + } + } + } else { + mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, + (LPARAM)pafd, (LPARAM)fdwDetails); + } + break; + case ACM_FORMATDETAILSF_INDEX: + /* should check pafd->dwFormatIndex < aftd->cStandardFormats */ + mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, + (LPARAM)pafd, (LPARAM)fdwDetails); + break; + default: + WARN("Unknown fdwDetails %08lx\n", fdwDetails); + mmr = MMSYSERR_INVALFLAG; + break; + } + + if (mmr == MMSYSERR_NOERROR && pafd->szFormat[0] == (WCHAR)0) { + wsprintfW(pafd->szFormat, fmt1, pafd->pwfx->nSamplesPerSec); + if (pafd->pwfx->wBitsPerSample) { + wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), fmt2, + pafd->pwfx->wBitsPerSample); + } + lstrcpyAtoW(pafd->szFormat + lstrlenW(pafd->szFormat), + (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo"); + } + + TRACE("=> %d\n", mmr); + return mmr; +} + +struct MSACM_FormatEnumWtoA_Instance { + PACMFORMATDETAILSA pafda; + DWORD dwInstance; + ACMFORMATENUMCBA fnCallback; +}; + +static BOOL CALLBACK MSACM_FormatEnumCallbackWtoA(HACMDRIVERID hadid, + PACMFORMATDETAILSW pafdw, + DWORD dwInstance, + DWORD fdwSupport) +{ + struct MSACM_FormatEnumWtoA_Instance* pafei; + + pafei = (struct MSACM_FormatEnumWtoA_Instance*)dwInstance; + + pafei->pafda->dwFormatIndex = pafdw->dwFormatIndex; + pafei->pafda->dwFormatTag = pafdw->dwFormatTag; + pafei->pafda->fdwSupport = pafdw->fdwSupport; + lstrcpyWtoA(pafei->pafda->szFormat, pafdw->szFormat); + + return (pafei->fnCallback)(hadid, pafei->pafda, + pafei->dwInstance, fdwSupport); } /*********************************************************************** * acmFormatEnumA (MSACM32.27) - */ -MMRESULT WINAPI acmFormatEnumA( - HACMDRIVER had, PACMFORMATDETAILSA pafd, - ACMFORMATENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum) +s */ +MMRESULT WINAPI acmFormatEnumA(HACMDRIVER had, PACMFORMATDETAILSA pafda, + ACMFORMATENUMCBA fnCallback, DWORD dwInstance, + DWORD fdwEnum) { - FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", - had, pafd, fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + ACMFORMATDETAILSW afdw; + struct MSACM_FormatEnumWtoA_Instance afei; + + memset(&afdw, 0, sizeof(afdw)); + afdw.cbStruct = sizeof(afdw); + afdw.dwFormatIndex = pafda->dwFormatIndex; + afdw.dwFormatTag = pafda->dwFormatTag; + afdw.pwfx = pafda->pwfx; + afdw.cbwfx = pafda->cbwfx; + + afei.pafda = pafda; + afei.dwInstance = dwInstance; + afei.fnCallback = fnCallback; + + return acmFormatEnumW(had, &afdw, MSACM_FormatEnumCallbackWtoA, + (DWORD)&afei, fdwEnum); } /*********************************************************************** * acmFormatEnumW (MSACM32.28) */ -MMRESULT WINAPI acmFormatEnumW( - HACMDRIVER had, PACMFORMATDETAILSW pafd, - ACMFORMATENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum) +static BOOL MSACM_FormatEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had, + PACMFORMATDETAILSW pafd, PWAVEFORMATEX pwfxRef, + ACMFORMATENUMCBW fnCallback, DWORD dwInstance, + DWORD fdwEnum) { - FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", - had, pafd, fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + ACMDRIVERDETAILSW add; + ACMFORMATTAGDETAILSW aftd; + int i, j; + + add.cbStruct = sizeof(add); + + if (acmDriverDetailsW((HACMDRIVERID)padid, &add, 0) != MMSYSERR_NOERROR) return FALSE; + + for (i = 0; i < add.cFormatTags; i++) { + memset(&aftd, 0, sizeof(aftd)); + aftd.cbStruct = sizeof(aftd); + aftd.dwFormatTagIndex = i; + if (acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR) + continue; + + if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && aftd.dwFormatTag != pwfxRef->wFormatTag) + continue; + + for (j = 0; j < aftd.cStandardFormats; j++) { + pafd->dwFormatIndex = j; + pafd->dwFormatTag = aftd.dwFormatTag; + if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_INDEX) != MMSYSERR_NOERROR) + continue; + + if ((fdwEnum & ACM_FORMATENUMF_NCHANNELS) && + pafd->pwfx->nChannels != pwfxRef->nChannels) + continue; + if ((fdwEnum & ACM_FORMATENUMF_NSAMPLESPERSEC) && + pafd->pwfx->nSamplesPerSec != pwfxRef->nSamplesPerSec) + continue; + if ((fdwEnum & ACM_FORMATENUMF_WBITSPERSAMPLE) && + pafd->pwfx->wBitsPerSample != pwfxRef->wBitsPerSample) + continue; + if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) && + !(pafd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_HARDWARE)) + continue; + + /* more checks to be done on fdwEnum */ + + if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, add.fdwSupport)) + return FALSE; + } + /* the "formats" used by the filters are also reported */ + } + return TRUE; +} + +MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd, + ACMFORMATENUMCBW fnCallback, DWORD dwInstance, + DWORD fdwEnum) +{ + PWINE_ACMDRIVERID padid; + WAVEFORMATEX wfxRef; + BOOL ret; + + TRACE("(0x%08x, %p, %p, %ld, %ld)\n", + had, pafd, fnCallback, dwInstance, fdwEnum); + + if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM; + + if (fdwEnum & (ACM_FORMATENUMF_WFORMATTAG|ACM_FORMATENUMF_NCHANNELS| + ACM_FORMATENUMF_NSAMPLESPERSEC|ACM_FORMATENUMF_WBITSPERSAMPLE| + ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_SUGGEST)) + wfxRef = *pafd->pwfx; + + if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) && + !(fdwEnum & (ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT))) + return MMSYSERR_INVALPARAM; + + if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && + (pafd->dwFormatTag != pafd->pwfx->wFormatTag)) + return MMSYSERR_INVALPARAM; + + if (fdwEnum & (ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_SUGGEST| + ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT)) + FIXME("Unsupported fdwEnum values\n"); + + if (had) { + HACMDRIVERID hadid; + + if (acmDriverID(had, &hadid, 0) != MMSYSERR_NOERROR) + return MMSYSERR_INVALHANDLE; + return MSACM_FormatEnumHelper(MSACM_GetDriverID(hadid), had, pafd, &wfxRef, + fnCallback, dwInstance, fdwEnum); + } + for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { + /* should check for codec only */ + if (!padid->bEnabled || acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR) + continue; + ret = MSACM_FormatEnumHelper(padid, had, pafd, &wfxRef, + fnCallback, dwInstance, fdwEnum); + acmDriverClose(had, 0); + if (!ret) break; + } + return MMSYSERR_NOERROR; } /*********************************************************************** * acmFormatSuggest (MSACM32.29) */ -MMRESULT WINAPI acmFormatSuggest( - HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, - DWORD cbwfxDst, DWORD fdwSuggest) +MMRESULT WINAPI acmFormatSuggest(HACMDRIVER had, PWAVEFORMATEX pwfxSrc, + PWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest) { - FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", - had, pwfxSrc, pwfxDst, cbwfxDst, fdwSuggest - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + ACMDRVFORMATSUGGEST adfg; + MMRESULT mmr; + + TRACE("(0x%08x, %p, %p, %ld, %ld)\n", + had, pwfxSrc, pwfxDst, cbwfxDst, fdwSuggest); + + if (fdwSuggest & ~(ACM_FORMATSUGGESTF_NCHANNELS|ACM_FORMATSUGGESTF_NSAMPLESPERSEC| + ACM_FORMATSUGGESTF_WBITSPERSAMPLE|ACM_FORMATSUGGESTF_WFORMATTAG)) + return MMSYSERR_INVALFLAG; + + adfg.cbStruct = sizeof(adfg); + adfg.fdwSuggest = fdwSuggest; + adfg.pwfxSrc = pwfxSrc; + adfg.cbwfxSrc = (pwfxSrc->wFormatTag == WAVE_FORMAT_PCM) ? + sizeof(WAVEFORMATEX) : pwfxSrc->cbSize; + adfg.pwfxDst = pwfxDst; + adfg.cbwfxDst = cbwfxDst; + + if (had == (HACMDRIVER)NULL) { + PWINE_ACMDRIVERID padid; + + /* MS doc says: ACM finds the best suggestion. + * Well, first found will be the "best" + */ + mmr = ACMERR_NOTPOSSIBLE; + for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { + /* should check for codec only */ + if (!padid->bEnabled || + acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR) + continue; + + if (MSACM_Message(had, ACMDM_FORMAT_SUGGEST, + (LPARAM)&adfg, 0L) == MMSYSERR_NOERROR) { + mmr = MMSYSERR_NOERROR; + break; + } + acmDriverClose(had, 0); + } + } else { + mmr = MSACM_Message(had, ACMDM_FORMAT_SUGGEST, (LPARAM)&adfg, 0L); + } + return mmr; } /*********************************************************************** * acmFormatTagDetailsA (MSACM32.30) */ -MMRESULT WINAPI acmFormatTagDetailsA( - HACMDRIVER had, PACMFORMATTAGDETAILSA paftd, DWORD fdwDetails) +MMRESULT WINAPI acmFormatTagDetailsA(HACMDRIVER had, PACMFORMATTAGDETAILSA paftda, + DWORD fdwDetails) { - if(fdwDetails & - ~(ACM_FORMATTAGDETAILSF_FORMATTAG|ACM_FORMATTAGDETAILSF_LARGESTSIZE)) - return MMSYSERR_INVALFLAG; + ACMFORMATTAGDETAILSW aftdw; + MMRESULT mmr; - /* FIXME - * How does the driver know if the ANSI or - * the UNICODE variant of PACMFORMATTAGDETAILS is used? - * It might check cbStruct or does it only accept ANSI. - */ - return (MMRESULT) acmDriverMessage( - had, ACMDM_FORMATTAG_DETAILS, - (LPARAM) paftd, (LPARAM) fdwDetails - ); + memset(&aftdw, 0, sizeof(aftdw)); + aftdw.cbStruct = sizeof(aftdw); + aftdw.dwFormatTagIndex = paftda->dwFormatTagIndex; + aftdw.dwFormatTag = paftda->dwFormatTag; + + mmr = acmFormatTagDetailsW(had, &aftdw, fdwDetails); + if (mmr == MMSYSERR_NOERROR) { + paftda->dwFormatTag = aftdw.dwFormatTag; + paftda->dwFormatTagIndex = aftdw.dwFormatTagIndex; + paftda->cbFormatSize = aftdw.cbFormatSize; + paftda->fdwSupport = aftdw.fdwSupport; + paftda->cStandardFormats = aftdw.cStandardFormats; + lstrcpyWtoA(paftda->szFormatTag, aftdw.szFormatTag); + } + return mmr; } /*********************************************************************** * acmFormatTagDetailsW (MSACM32.31) */ -MMRESULT WINAPI acmFormatTagDetailsW( - HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, DWORD fdwDetails) +MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, + DWORD fdwDetails) { - FIXME("(0x%08x, %p, %ld): stub\n", had, paftd, fdwDetails); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + PWINE_ACMDRIVERID padid; + MMRESULT mmr; + + TRACE("(0x%08x, %p, %ld)\n", had, paftd, fdwDetails); + + if (fdwDetails & ~(ACM_FORMATTAGDETAILSF_FORMATTAG|ACM_FORMATTAGDETAILSF_INDEX| + ACM_FORMATTAGDETAILSF_LARGESTSIZE)) + return MMSYSERR_INVALFLAG; + + switch (fdwDetails) { + case ACM_FORMATTAGDETAILSF_FORMATTAG: + if (had == (HACMDRIVER)NULL) { + 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) { + mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, + (LPARAM)paftd, (LPARAM)fdwDetails); + acmDriverClose(had, 0); + if (mmr == MMSYSERR_NOERROR) break; + } + } + } else { + mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, + (LPARAM)paftd, (LPARAM)fdwDetails); + } + break; + + case ACM_FORMATTAGDETAILSF_INDEX: + /* FIXME should check paftd->dwFormatTagIndex < add.cFormatTags */ + mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, + (LPARAM)paftd, (LPARAM)fdwDetails); + break; + + case ACM_FORMATTAGDETAILSF_LARGESTSIZE: + if (had == (HACMDRIVER)NULL) { + ACMFORMATTAGDETAILSW tmp; + DWORD ft = paftd->dwFormatTag; + + 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) { + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbStruct = sizeof(tmp); + tmp.dwFormatTag = ft; + + if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, + (LPARAM)&tmp, + (LPARAM)fdwDetails) == MMSYSERR_NOERROR) { + if (mmr == ACMERR_NOTPOSSIBLE || + paftd->cbFormatSize < tmp.cbFormatSize) { + *paftd = tmp; + mmr = MMSYSERR_NOERROR; + } + } + acmDriverClose(had, 0); + } + } + } else { + mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, + (LPARAM)paftd, (LPARAM)fdwDetails); + } + break; + + default: + WARN("Unsupported fdwDetails=%08lx\n", fdwDetails); + mmr = MMSYSERR_ERROR; + } + + if (mmr == MMSYSERR_NOERROR && + paftd->dwFormatTag == WAVE_FORMAT_PCM && paftd->szFormatTag[0] == 0) + lstrcpyAtoW(paftd->szFormatTag, "PCM"); + + return mmr; +} + +struct MSACM_FormatTagEnumWtoA_Instance { + PACMFORMATTAGDETAILSA paftda; + DWORD dwInstance; + ACMFORMATTAGENUMCBA fnCallback; +}; + +static BOOL CALLBACK MSACM_FormatTagEnumCallbackWtoA(HACMDRIVERID hadid, + PACMFORMATTAGDETAILSW paftdw, + DWORD dwInstance, + DWORD fdwSupport) +{ + struct MSACM_FormatTagEnumWtoA_Instance* paftei; + + paftei = (struct MSACM_FormatTagEnumWtoA_Instance*)dwInstance; + + paftei->paftda->dwFormatTagIndex = paftdw->dwFormatTagIndex; + paftei->paftda->dwFormatTag = paftdw->dwFormatTag; + paftei->paftda->cbFormatSize = paftdw->cbFormatSize; + paftei->paftda->fdwSupport = paftdw->fdwSupport; + paftei->paftda->cStandardFormats = paftdw->cStandardFormats; + lstrcpyWtoA(paftei->paftda->szFormatTag, paftdw->szFormatTag); + + return (paftei->fnCallback)(hadid, paftei->paftda, + paftei->dwInstance, fdwSupport); } /*********************************************************************** * acmFormatTagEnumA (MSACM32.32) */ -MMRESULT WINAPI acmFormatTagEnumA( - HACMDRIVER had, PACMFORMATTAGDETAILSA paftd, - ACMFORMATTAGENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum) +MMRESULT WINAPI acmFormatTagEnumA(HACMDRIVER had, PACMFORMATTAGDETAILSA paftda, + ACMFORMATTAGENUMCBA fnCallback, DWORD dwInstance, + DWORD fdwEnum) { - FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", - had, paftd, fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + ACMFORMATTAGDETAILSW aftdw; + struct MSACM_FormatTagEnumWtoA_Instance aftei; + + memset(&aftdw, 0, sizeof(aftdw)); + aftdw.cbStruct = sizeof(aftdw); + aftdw.dwFormatTagIndex = paftda->dwFormatTagIndex; + aftdw.dwFormatTag = paftda->dwFormatTag; + + aftei.paftda = paftda; + aftei.dwInstance = dwInstance; + aftei.fnCallback = fnCallback; + + return acmFormatTagEnumW(had, &aftdw, MSACM_FormatTagEnumCallbackWtoA, + (DWORD)&aftei, fdwEnum); } /*********************************************************************** * acmFormatTagEnumW (MSACM32.33) */ -MMRESULT WINAPI acmFormatTagEnumW( - HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, - ACMFORMATTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum) +MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, + ACMFORMATTAGENUMCBW fnCallback, DWORD dwInstance, + DWORD fdwEnum) { - FIXME("(0x%08x, %p, %p, %ld, %ld): stub\n", - had, paftd, fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + PWINE_ACMDRIVERID padid; + ACMDRIVERDETAILSW add; + int i; + BOOL bPcmDone = FALSE; + + TRACE("(0x%08x, %p, %p, %ld, %ld)\n", + had, paftd, fnCallback, dwInstance, fdwEnum); + + if (paftd->cbStruct < sizeof(*paftd)) return MMSYSERR_INVALPARAM; + + if (had) FIXME("had != NULL, not supported\n"); + + for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { + /* should check for codec only */ + if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) { + add.cbStruct = sizeof(add); + + if (acmDriverDetailsW((HACMDRIVERID)padid, &add, 0) == MMSYSERR_NOERROR) { + for (i = 0; i < add.cFormatTags; i++) { + paftd->dwFormatTagIndex = i; + if (acmFormatTagDetailsW(had, paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) { + if (paftd->dwFormatTag == WAVE_FORMAT_PCM) { + /* FIXME (EPP): I'm not sure this is the correct + * algorithm (should make more sense to apply the same + * for all already loaded formats, but this will do + * for now + */ + if (bPcmDone) continue; + bPcmDone = TRUE; + } + if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, + add.fdwSupport)) { + padid = NULL; + break; + } + } + } + } + } + acmDriverClose(had, 0); + } + return MMSYSERR_NOERROR; } diff --git a/dlls/msacm/internal.c b/dlls/msacm/internal.c index 9eb235d9ab..8c8c51aae1 100644 --- a/dlls/msacm/internal.c +++ b/dlls/msacm/internal.c @@ -30,7 +30,7 @@ PWINE_ACMDRIVERID MSACM_pFirstACMDriverID = NULL; PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL; /*********************************************************************** - * MSACM_RegisterDriver32() + * MSACM_RegisterDriver() */ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, HINSTANCE hinstModule) @@ -40,6 +40,8 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, TRACE("('%s', '%s', 0x%08x)\n", pszDriverAlias, pszFileName, hinstModule); padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); + padid->obj.dwType = WINE_ACMOBJ_DRIVERID; + padid->obj.pACMDriverID = padid; padid->pszDriverAlias = HEAP_strdupA(MSACM_hHeap, 0, pszDriverAlias); padid->pszFileName = HEAP_strdupA(MSACM_hHeap, 0, pszFileName); padid->hInstModule = hinstModule; @@ -57,7 +59,7 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, } /*********************************************************************** - * MSACM_RegisterAllDrivers32() + * MSACM_RegisterAllDrivers() */ void MSACM_RegisterAllDrivers(void) { @@ -95,7 +97,7 @@ void MSACM_RegisterAllDrivers(void) } /*********************************************************************** - * MSACM_UnregisterDriver32() + * MSACM_UnregisterDriver() */ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p) { @@ -127,7 +129,7 @@ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p) } /*********************************************************************** - * MSACM_UnregisterAllDrivers32() + * MSACM_UnregisterAllDrivers() * FIXME * Where should this function be called? */ @@ -139,27 +141,40 @@ void MSACM_UnregisterAllDrivers(void) } /*********************************************************************** - * MSACM_GetDriverID32() + * MSACM_GetObj() + */ +PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type) +{ + PWINE_ACMOBJ pao = (PWINE_ACMOBJ)hObj; + + if (IsBadReadPtr(pao, sizeof(WINE_ACMOBJ)) || + ((type != WINE_ACMOBJ_DONTCARE) && (type != pao->dwType))) + return NULL; + return pao; +} + +/*********************************************************************** + * MSACM_GetDriverID() */ PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID) { - return (PWINE_ACMDRIVERID)hDriverID; + return (PWINE_ACMDRIVERID)MSACM_GetObj((HACMOBJ)hDriverID, WINE_ACMOBJ_DRIVERID); } /*********************************************************************** - * MSACM_GetDriver32() + * MSACM_GetDriver() */ PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver) { - return (PWINE_ACMDRIVER)hDriver; + return (PWINE_ACMDRIVER)MSACM_GetObj((HACMOBJ)hDriver, WINE_ACMOBJ_DRIVER); } /*********************************************************************** - * MSACM_GetObj32() + * MSACM_Message() */ -PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj) +MMRESULT MSACM_Message(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2) { - return (PWINE_ACMOBJ)hObj; + PWINE_ACMDRIVER pad = MSACM_GetDriver(had); + + return pad ? SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2) : MMSYSERR_INVALHANDLE; } - - diff --git a/dlls/msacm/msacm.rc b/dlls/msacm/msacm.rc new file mode 100644 index 0000000000..8288809a88 --- /dev/null +++ b/dlls/msacm/msacm.rc @@ -0,0 +1,45 @@ +/* + * Top level resource file for MS ACM + * + */ + +#include "windef.h" +#include "winuser.h" +#include "wineacm.h" + +LANGUAGE 0,0 + +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Sound Selection" +FONT 8, "MS Shell Dlg" +BEGIN + + LTEXT "&Name:", -1, 5, 5, 115, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + PUSHBUTTON "&Save As...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "&Remove", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + + LTEXT "&Format:", -1, 5, 41, 44, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + LTEXT "&Attributes:", -1, 5, 59, 44, 8, NOT WS_GROUP + +#if 0 + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | + CBS_OWNERDRAWFIXED | CBS_HASSTRINGS +#else + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +#endif + DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14 + PUSHBUTTON "Cancel", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "&Help", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + +END diff --git a/dlls/msacm/msacm32.spec b/dlls/msacm/msacm32.spec index 9687de7e35..d8746adb5f 100644 --- a/dlls/msacm/msacm32.spec +++ b/dlls/msacm/msacm32.spec @@ -1,6 +1,7 @@ name msacm32 type win32 init MSACM32_LibMain +rsrc msacm import winmm.dll import kernel32.dll diff --git a/dlls/msacm/msacm32_main.c b/dlls/msacm/msacm32_main.c index 6a9b834f3f..274f9d563a 100644 --- a/dlls/msacm/msacm32_main.c +++ b/dlls/msacm/msacm32_main.c @@ -20,6 +20,7 @@ DEFAULT_DEBUG_CHANNEL(msacm); /**********************************************************************/ static DWORD MSACM_dwProcessesAttached = 0; +HINSTANCE MSACM_hInstance32 = 0; /*********************************************************************** * MSACM_LibMain (MSACM32.init) @@ -32,6 +33,7 @@ BOOL WINAPI MSACM32_LibMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReser case DLL_PROCESS_ATTACH: if (MSACM_dwProcessesAttached == 0) { MSACM_hHeap = HeapCreate(0, 0x10000, 0); + MSACM_hInstance32 = hInstDLL; MSACM_RegisterAllDrivers(); } MSACM_dwProcessesAttached++; @@ -42,6 +44,7 @@ BOOL WINAPI MSACM32_LibMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReser MSACM_UnregisterAllDrivers(); HeapDestroy(MSACM_hHeap); MSACM_hHeap = (HANDLE) NULL; + MSACM_hInstance32 = (HINSTANCE)NULL; } break; case DLL_THREAD_ATTACH: @@ -87,14 +90,15 @@ DWORD WINAPI acmGetVersion(void) /*********************************************************************** * 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); + PWINE_ACMOBJ pao = MSACM_GetObj(hao, WINE_ACMOBJ_DONTCARE); BOOL bLocal = TRUE; PWINE_ACMDRIVERID padid; DWORD val = 0; + MMRESULT mmr = MMSYSERR_NOERROR; - FIXME("(0x%08x, %d, %p): stub\n", hao, uMetric, pMetric); + TRACE("(0x%08x, %d, %p);\n", hao, uMetric, pMetric); switch (uMetric) { case ACM_METRIC_COUNT_DRIVERS: @@ -107,7 +111,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) if (padid->bEnabled /* && (local(padid) || !bLocal) */) val++; *(LPDWORD)pMetric = val; - return 0; + break; case ACM_METRIC_COUNT_CODECS: if (!pao) @@ -120,7 +124,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) if (padid->bEnabled /* && (local(padid) || !bLocal) */) val++; *(LPDWORD)pMetric = val; - return 0; + break; case ACM_METRIC_COUNT_CONVERTERS: bLocal = FALSE; @@ -131,7 +135,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) if (padid->bEnabled /* && (local(padid) || !bLocal) */) val++; *(LPDWORD)pMetric = val; - return 0; + break; case ACM_METRIC_COUNT_FILTERS: bLocal = FALSE; @@ -142,7 +146,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) if (padid->bEnabled /* && (local(padid) || !bLocal) */) val++; *(LPDWORD)pMetric = val; - return 0; + break; case ACM_METRIC_COUNT_DISABLED: bLocal = FALSE; @@ -154,14 +158,33 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) if (!padid->bEnabled /* && (local(padid) || !bLocal) */) val++; *(LPDWORD)pMetric = val; - return 0; + break; case ACM_METRIC_MAX_SIZE_FORMAT: - /* FIXME: According to MSDN, this should return the size of the largest WAVEFORMATEX - structure in the system. How is this calculated? */ - *(LPDWORD)pMetric = sizeof (WAVEFORMATEX); - return 0; - + { + ACMFORMATTAGDETAILSW aftd; + + aftd.cbStruct = sizeof(aftd); + aftd.dwFormatTag = WAVE_FORMAT_UNKNOWN; + + if (hao == (HACMOBJ)NULL) { + mmr = acmFormatTagDetailsW((HACMDRIVER)NULL, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE); + } else if (MSACM_GetObj(hao, WINE_ACMOBJ_DRIVER)) { + mmr = acmFormatTagDetailsW((HACMDRIVER)hao, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE); + } else if (MSACM_GetObj(hao, WINE_ACMOBJ_DRIVERID)) { + HACMDRIVER had; + + if (acmDriverOpen(&had, (HACMDRIVERID)hao, 0) == 0) { + mmr = acmFormatTagDetailsW((HACMDRIVER)hao, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE); + acmDriverClose(had, 0); + } + } else { + mmr = MMSYSERR_INVALHANDLE; + } + if (mmr == MMSYSERR_NOERROR) *(LPDWORD)pMetric = aftd.cbFormatSize; + } + break; + case ACM_METRIC_COUNT_HARDWARE: case ACM_METRIC_HARDWARE_WAVE_INPUT: case ACM_METRIC_HARDWARE_WAVE_OUTPUT: @@ -169,7 +192,8 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) case ACM_METRIC_DRIVER_SUPPORT: case ACM_METRIC_DRIVER_PRIORITY: default: - return MMSYSERR_NOTSUPPORTED; + FIXME("(0x%08x, %d, %p): stub\n", hao, uMetric, pMetric); + mmr = MMSYSERR_NOTSUPPORTED; } - return MMSYSERR_NOERROR; + return mmr; } diff --git a/dlls/msacm/stream.c b/dlls/msacm/stream.c index 4918f87326..0fe1417fb0 100644 --- a/dlls/msacm/stream.c +++ b/dlls/msacm/stream.c @@ -165,6 +165,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw goto errCleanUp; } + was->obj.dwType = WINE_ACMOBJ_STREAM; was->obj.pACMDriverID = wad->obj.pACMDriverID; was->pDrv = wad; was->hAcmDriver = 0; /* not to close it in acmStreamClose */ @@ -180,6 +181,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L); if (ret == MMSYSERR_NOERROR) { if ((wad = MSACM_GetDriver(had)) != 0) { + was->obj.dwType = WINE_ACMOBJ_STREAM; was->obj.pACMDriverID = wad->obj.pACMDriverID; was->pDrv = wad; was->hAcmDriver = had; diff --git a/dlls/msacm/wineacm.h b/dlls/msacm/wineacm.h index b86641cc44..819dd59b87 100644 --- a/dlls/msacm/wineacm.h +++ b/dlls/msacm/wineacm.h @@ -6,9 +6,15 @@ typedef struct _WINE_ACMDRIVERID *PWINE_ACMDRIVERID; typedef struct _WINE_ACMDRIVER *PWINE_ACMDRIVER; +#define WINE_ACMOBJ_DONTCARE 0x5EED0000 +#define WINE_ACMOBJ_DRIVERID 0x5EED0001 +#define WINE_ACMOBJ_DRIVER 0x5EED0002 +#define WINE_ACMOBJ_STREAM 0x5EED0003 + typedef struct _WINE_ACMOBJ { - PWINE_ACMDRIVERID pACMDriverID; + DWORD dwType; + PWINE_ACMDRIVERID pACMDriverID; } WINE_ACMOBJ, *PWINE_ACMOBJ; typedef struct _WINE_ACMDRIVER @@ -29,6 +35,7 @@ typedef struct _WINE_ACMSTREAM typedef struct _WINE_ACMDRIVERID { + WINE_ACMOBJ obj; LPSTR pszDriverAlias; LPSTR pszFileName; HINSTANCE hInstModule; /* NULL if global */ @@ -43,13 +50,33 @@ typedef struct _WINE_ACMDRIVERID 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); +extern PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, + HINSTANCE hinstModule); +extern void MSACM_RegisterAllDrivers(void); +extern PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p); +extern void MSACM_UnregisterAllDrivers(void); +extern PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID); +extern PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver); +extern PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type); +extern MMRESULT MSACM_Message(HACMDRIVER, UINT, LPARAM, LPARAM); + +/* From msacm32.c */ +extern HINSTANCE MSACM_hInstance32; + +/* Dialog box templates */ +#define DLG_ACMFORMATCHOOSE_ID 70 +#define IDD_ACMFORMATCHOOSE_BTN_HELP 9 +#define IDD_ACMFORMATCHOOSE_CMB_CUSTOM 100 +#define IDD_ACMFORMATCHOOSE_CMB_FORMATTAG 101 +#define IDD_ACMFORMATCHOOSE_CMB_FORMAT 102 +#define IDD_ACMFORMATCHOOSE_BTN_SETNAME 103 +#define IDD_ACMFORMATCHOOSE_BTN_DELNAME 104 + +#define DLG_ACMFILTERCHOOSE_ID 71 +#define IDD_ACMFILTERCHOOSE_BTN_HELP 9 +#define IDD_ACMFILTERCHOOSE_CMB_CUSTOM 100 +#define IDD_ACMFILTERCHOOSE_CMB_FILTERTAG 101 +#define IDD_ACMFILTERCHOOSE_CMB_FILTER 102 +#define IDD_ACMFILTERCHOOSE_BTN_SETNAME 103 +#define IDD_ACMFILTERCHOOSE_BTN_DELNAME 104 diff --git a/include/msacm.h b/include/msacm.h index 37a277748d..8e909ad5cb 100644 --- a/include/msacm.h +++ b/include/msacm.h @@ -205,6 +205,7 @@ typedef UINT CALLBACK (*ACMFILTERCHOOSEHOOKPROCA)( typedef UINT CALLBACK (*ACMFILTERCHOOSEHOOKPROCW)( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +#define ACMFILTERCHOOSEHOOKPROC WINELIB_NAME_AW(ACMFILTERCHOOSEHOOKPROC) typedef UINT CALLBACK (*ACMFILTERCHOOSEHOOKPROC16)( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam @@ -217,6 +218,7 @@ typedef UINT CALLBACK (*ACMFORMATCHOOSEHOOKPROCA)( typedef UINT CALLBACK (*ACMFORMATCHOOSEHOOKPROCW)( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +#define ACMFORMATCHOOSEHOOKPROC WINELIB_NAME_AW(ACMFORMATCHOOSEHOOKPROC) typedef UINT16 CALLBACK (*ACMFORMATCHOOSEHOOKPROC16)( HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam @@ -278,6 +280,9 @@ typedef struct _ACMDRIVERDETAILSW WCHAR szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS]; } ACMDRIVERDETAILSW, *PACMDRIVERDETAILSW; +DECL_WINELIB_TYPE_AW(ACMDRIVERDETAILS); +DECL_WINELIB_TYPE_AW(PACMDRIVERDETAILS); + typedef struct _ACMDRIVERDETAILS16 { DWORD cbStruct; @@ -356,6 +361,9 @@ typedef struct _ACMFILTERCHOOSEW ACMFILTERCHOOSEHOOKPROCW pfnHook; } ACMFILTERCHOOSEW, *PACMFILTERCHOOSEW; +DECL_WINELIB_TYPE_AW(ACMFILTERCHOOSE); +DECL_WINELIB_TYPE_AW(PACMFILTERCHOOSE); + typedef struct _ACMFILTERCHOOSE16 { DWORD cbStruct; @@ -404,6 +412,9 @@ typedef struct _ACMFILTERDETAILSW WCHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS]; } ACMFILTERDETAILSW, *PACMFILTERDETAILSW; +DECL_WINELIB_TYPE_AW(ACMFILTERDETAILS); +DECL_WINELIB_TYPE_AW(PACMFILTERDETAILS); + typedef struct _ACMFILTERDETAILS16 { DWORD cbStruct; @@ -437,6 +448,9 @@ typedef struct _ACMFILTERTAGDETAILSW WCHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS]; } ACMFILTERTAGDETAILSW, *PACMFILTERTAGDETAILSW; +DECL_WINELIB_TYPE_AW(ACMFILTERTAGDETAILS); +DECL_WINELIB_TYPE_AW(PACMFILTERTAGDETAILS); + typedef struct _ACMFILTERTAGDETAILS16 { DWORD cbStruct; @@ -500,6 +514,9 @@ typedef struct _ACMFORMATCHOOSEW ACMFORMATCHOOSEHOOKPROCW pfnHook; } ACMFORMATCHOOSEW, *PACMFORMATCHOOSEW; +DECL_WINELIB_TYPE_AW(ACMFORMATCHOOSE); +DECL_WINELIB_TYPE_AW(PACMFORMATCHOOSE); + typedef struct _ACMFORMATCHOOSE16 { DWORD cbStruct; @@ -548,6 +565,9 @@ typedef struct _ACMFORMATDETAILSW WCHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]; } ACMFORMATDETAILSW, *PACMFORMATDETAILSW; +DECL_WINELIB_TYPE_AW(ACMFORMATDETAILS); +DECL_WINELIB_TYPE_AW(PACMFORMATDETAILS); + typedef struct _ACMFORMATDETAILS16 { DWORD cbStruct; @@ -581,6 +601,9 @@ typedef struct _ACMFORMATTAGDETAILSW WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; } ACMFORMATTAGDETAILSW, *PACMFORMATTAGDETAILSW; +DECL_WINELIB_TYPE_AW(ACMFORMATTAGDETAILS); +DECL_WINELIB_TYPE_AW(PACMFORMATTAGDETAILS); + typedef struct _ACMFORMATTAGDETAILS16 { DWORD cbStruct; @@ -623,6 +646,8 @@ typedef BOOL CALLBACK (*ACMFILTERENUMCBW)( DWORD dwInstance, DWORD fdwSupport ); +#define ACMFILTERENUMCB WINELIB_NAME_AW(ACMFILTERENUMCB) + typedef BOOL16 CALLBACK (*ACMFILTERENUMCB16)( HACMDRIVERID16 hadid, LPACMFILTERDETAILS16 pafd, DWORD dwInstance, DWORD fdwSupport @@ -638,6 +663,8 @@ typedef BOOL CALLBACK (*ACMFILTERTAGENUMCBW)( DWORD dwInstance, DWORD fdwSupport ); +#define ACMFILTERTAGENUMCB WINELIB_NAME_AW(ACMFILTERTAGENUMCB) + typedef BOOL16 CALLBACK (*ACMFILTERTAGENUMCB16)( HACMDRIVERID16 hadid, LPACMFILTERTAGDETAILS16 paftd, DWORD dwInstance, DWORD fdwSupport @@ -653,6 +680,8 @@ typedef BOOL CALLBACK (*ACMFORMATENUMCBW)( DWORD dwInstance, DWORD fdwSupport ); +#define ACMFORMATENUMCB WINELIB_NAME_AW(ACMFORMATENUMCB) + typedef BOOL16 CALLBACK (*ACMFORMATENUMCB16)( HACMDRIVERID16 hadid, LPACMFORMATDETAILS16 pafd, DWORD dwInstance, DWORD fdwSupport @@ -668,6 +697,8 @@ typedef BOOL CALLBACK (*ACMFORMATTAGENUMCBW)( DWORD dwInstance, DWORD fdwSupport ); +#define ACMFORMATTAGENUMCB WINELIB_NAME_AW(ACMFORMATTAGENUMCB) + typedef BOOL16 CALLBACK (*ACMFORMATTAGENUMCB16)( HACMDRIVERID16 hadid, LPACMFORMATTAGDETAILS16 paftd, DWORD dwInstance, DWORD fdwSupport @@ -786,6 +817,8 @@ MMRESULT WINAPI acmDriverAddW( PHACMDRIVERID phadid, HINSTANCE hinstModule, LPARAM lParam, DWORD dwPriority, DWORD fdwAdd ); +#define acmDriverAdd WINELIB_NAME_AW(acmDriverAdd) + MMRESULT WINAPI acmDriverClose( HACMDRIVER had, DWORD fdwClose ); @@ -795,6 +828,8 @@ MMRESULT WINAPI acmDriverDetailsA( MMRESULT WINAPI acmDriverDetailsW( HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, DWORD fdwDetails ); +#define acmDriverDetails WINELIB_NAME_AW(acmDriverDetails) + MMRESULT WINAPI acmDriverEnum( ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum ); @@ -819,12 +854,16 @@ MMRESULT WINAPI acmFilterChooseA( MMRESULT WINAPI acmFilterChooseW( PACMFILTERCHOOSEW pafltrc ); +#define acmFilterChoose WINELIB_NAME_AW(acmFilterChoose) + MMRESULT WINAPI acmFilterDetailsA( HACMDRIVER had, PACMFILTERDETAILSA pafd, DWORD fdwDetails ); MMRESULT WINAPI acmFilterDetailsW( HACMDRIVER had, PACMFILTERDETAILSW pafd, DWORD fdwDetails ); +#define acmFilterDetails WINELIB_NAME_AW(acmFilterDetails) + MMRESULT WINAPI acmFilterEnumA( HACMDRIVER had, PACMFILTERDETAILSA pafd, ACMFILTERENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum @@ -833,12 +872,16 @@ MMRESULT WINAPI acmFilterEnumW( HACMDRIVER had, PACMFILTERDETAILSW pafd, ACMFILTERENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum ); +#define acmFilterEnum WINELIB_NAME_AW(acmFilterEnum) + MMRESULT WINAPI acmFilterTagDetailsA( HACMDRIVER had, PACMFILTERTAGDETAILSA paftd, DWORD fdwDetails ); MMRESULT WINAPI acmFilterTagDetailsW( HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, DWORD fdwDetails ); +#define acmFilterTagDetails WINELIB_NAME_AW(acmFilterTagDetails) + MMRESULT WINAPI acmFilterTagEnumA( HACMDRIVER had, PACMFILTERTAGDETAILSA paftd, ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum @@ -847,18 +890,24 @@ MMRESULT WINAPI acmFilterTagEnumW( HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum ); +#define acmFilterTagEnum WINELIB_NAME_AW(acmFilterTagEnum) + MMRESULT WINAPI acmFormatChooseA( PACMFORMATCHOOSEA pafmtc ); MMRESULT WINAPI acmFormatChooseW( PACMFORMATCHOOSEW pafmtc ); +#define acmFormatChoose WINELIB_NAME_AW(acmFormatChoose) + MMRESULT WINAPI acmFormatDetailsA( HACMDRIVER had, PACMFORMATDETAILSA pafd, DWORD fdwDetails ); MMRESULT WINAPI acmFormatDetailsW( HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails ); +#define acmFormatDetails WINELIB_NAME_AW(acmFormatDetails) + MMRESULT WINAPI acmFormatEnumA( HACMDRIVER had, PACMFORMATDETAILSA pafd, ACMFORMATENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum @@ -867,6 +916,8 @@ MMRESULT WINAPI acmFormatEnumW( HACMDRIVER had, PACMFORMATDETAILSW pafd, ACMFORMATENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum ); +#define acmFormatEnum WINELIB_NAME_AW(acmFormatEnum) + MMRESULT WINAPI acmFormatSuggest( HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest @@ -877,6 +928,8 @@ MMRESULT WINAPI acmFormatTagDetailsA( MMRESULT WINAPI acmFormatTagDetailsW( HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, DWORD fdwDetails ); +#define acmFormatTagDetails WINELIB_NAME_AW(acmFormatTagDetails) + MMRESULT WINAPI acmFormatTagEnumA( HACMDRIVER had, PACMFORMATTAGDETAILSA paftd, ACMFORMATTAGENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum @@ -885,6 +938,8 @@ MMRESULT WINAPI acmFormatTagEnumW( HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, ACMFORMATTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum ); +#define acmFormatTagEnum WINELIB_NAME_AW(acmFormatTagEnum) + DWORD WINAPI acmGetVersion( ); MMRESULT WINAPI acmMetrics(