Author: akhaldi Date: Sun Sep 17 22:55:04 2017 New Revision: 75886 URL: http://svn.reactos.org/svn/reactos?rev=75886&view=rev Log: [MSACM32] Sync with Wine Staging 2.16. CORE-13762
993faf5 msacm32: Implement ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT. 84e61e6 msacm32: Add invalid parameter checks for acmFormatChoose(). 5e2c243 msacm32: Don't add a format entry if it is decode-only. cadedd7 msacm32: Rewrite PCM conversion functions. 7493364 msacm32: Check correct variable. ab2760e msacm32: Try to suggest PCM to PCM conversion first. 8e88af3 msacm32: Add more invalid parameter checks for acmFormatSuggest(). 1e30f79 msacm32: Add invalid parameter checks for acmFormatDetails(). c984aa5 msacm32: Add more invalid parameter checks for acmFormatEnum(). 4e0c370 msacm32: Don't write cbSize if the format is WAVE_FORMAT_PCM. Removed: trunk/reactos/dll/win32/msacm32/msacm.spec trunk/reactos/dll/win32/msacm32/msacm_main.c Modified: trunk/reactos/dll/win32/msacm32/format.c trunk/reactos/dll/win32/msacm32/pcmconverter.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/msacm32/format.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msacm32/format.c?rev=75886&r1=75885&r2=75886&view=diff ============================================================================== --- trunk/reactos/dll/win32/msacm32/format.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msacm32/format.c [iso-8859-1] Sun Sep 17 22:55:04 2017 @@ -41,18 +41,29 @@ switch (affd->mode) { case WINE_ACMFF_TAG: - if (SendDlgItemMessageW(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, - CB_FINDSTRINGEXACT, -1, - (LPARAM)paftd->szFormatTag) == CB_ERR) - SendDlgItemMessageW(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, - CB_ADDSTRING, 0, (LPARAM)paftd->szFormatTag); + if (paftd->cStandardFormats > 0) + { + if (SendDlgItemMessageW(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, + CB_FINDSTRINGEXACT, -1, + (LPARAM)paftd->szFormatTag) == CB_ERR) + { + int index = SendDlgItemMessageW(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, + CB_ADDSTRING, 0, (LPARAM)paftd->szFormatTag); + if (((affd->afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT) && + (paftd->dwFormatTag == affd->afc->pwfx->wFormatTag)) || + (!(affd->afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT) && + (paftd->dwFormatTag == WAVE_FORMAT_PCM))) + SendDlgItemMessageW(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, + CB_SETCURSEL, index, 0); + } + } break; case WINE_ACMFF_FORMAT: if (strcmpW(affd->szFormatTag, paftd->szFormatTag) == 0) { HACMDRIVER had; if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) { - ACMFORMATDETAILSW afd; + ACMFORMATDETAILSW afd = {0}; unsigned int i, len; MMRESULT mmr; WCHAR buffer[ACMFORMATDETAILS_FORMAT_CHARS+16]; @@ -62,14 +73,16 @@ afd.pwfx = HeapAlloc(MSACM_hHeap, 0, paftd->cbFormatSize); if (!afd.pwfx) return FALSE; afd.pwfx->wFormatTag = paftd->dwFormatTag; - afd.pwfx->cbSize = paftd->cbFormatSize; + if (paftd->dwFormatTag != WAVE_FORMAT_PCM) + afd.pwfx->cbSize = paftd->cbFormatSize - sizeof(WAVEFORMATEX); afd.cbwfx = paftd->cbFormatSize; for (i = 0; i < paftd->cStandardFormats; i++) { static const WCHAR fmtW[] = {'%','d',' ','K','o','/','s','\0'}; - int j; + int j, index; afd.dwFormatIndex = i; + afd.fdwSupport = 0; mmr = acmFormatDetailsW(had, &afd, ACM_FORMATDETAILSF_INDEX); if (mmr == MMSYSERR_NOERROR) { lstrcpynW(buffer, afd.szFormat, ACMFORMATTAGDETAILS_FORMATTAG_CHARS + 1); @@ -78,14 +91,17 @@ buffer[j] = ' '; wsprintfW(buffer + ACMFORMATTAGDETAILS_FORMATTAG_CHARS, fmtW, (afd.pwfx->nAvgBytesPerSec + 512) / 1024); - SendDlgItemMessageW(affd->hWnd, + index = SendDlgItemMessageW(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_ADDSTRING, 0, (LPARAM)buffer); + if ((affd->afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT) && + affd->afc->cbwfx >= paftd->cbFormatSize && + !memcmp(afd.pwfx, affd->afc->pwfx, paftd->cbFormatSize)) + SendDlgItemMessageW(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, + CB_SETCURSEL, index, 0); } } acmDriverClose(had, 0); - SendDlgItemMessageW(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, - CB_SETCURSEL, 0, 0); HeapFree(MSACM_hHeap, 0, afd.pwfx); } } @@ -95,7 +111,7 @@ HACMDRIVER had; if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) { - ACMFORMATDETAILSW afd; + ACMFORMATDETAILSW afd = {0}; afd.cbStruct = sizeof(afd); afd.dwFormatTag = paftd->dwFormatTag; @@ -117,7 +133,7 @@ return TRUE; } -static BOOL MSACM_FillFormatTags(HWND hWnd) +static BOOL MSACM_FillFormatTags(HWND hWnd, PACMFORMATCHOOSEW afc) { ACMFORMATTAGDETAILSW aftd; struct MSACM_FillFormatData affd; @@ -127,13 +143,15 @@ affd.hWnd = hWnd; affd.mode = WINE_ACMFF_TAG; + affd.afc = afc; acmFormatTagEnumW(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD_PTR)&affd, 0); - SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, CB_SETCURSEL, 0, 0); + if (SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, CB_GETCURSEL, 0, 0) == CB_ERR) + SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, CB_SETCURSEL, 0, 0); return TRUE; } -static BOOL MSACM_FillFormat(HWND hWnd) +static BOOL MSACM_FillFormat(HWND hWnd, PACMFORMATCHOOSEW afc) { ACMFORMATTAGDETAILSW aftd; struct MSACM_FillFormatData affd; @@ -145,6 +163,7 @@ affd.hWnd = hWnd; affd.mode = WINE_ACMFF_FORMAT; + affd.afc = afc; SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, CB_GETLBTEXT, SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, @@ -152,7 +171,8 @@ (LPARAM)affd.szFormatTag); acmFormatTagEnumW(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD_PTR)&affd, 0); - SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_SETCURSEL, 0, 0); + if (SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_GETCURSEL, 0, 0) == CB_ERR) + SendDlgItemMessageW(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_SETCURSEL, 0, 0); return TRUE; } @@ -191,10 +211,11 @@ case WM_INITDIALOG: afc = (PACMFORMATCHOOSEW)lParam; SetPropW(hWnd, fmt_prop, (HANDLE)afc); - MSACM_FillFormatTags(hWnd); - MSACM_FillFormat(hWnd); + MSACM_FillFormatTags(hWnd, afc); + MSACM_FillFormat(hWnd, afc); if ((afc->fdwStyle & ~(ACMFORMATCHOOSE_STYLEF_CONTEXTHELP| ACMFORMATCHOOSE_STYLEF_SHOWHELP| + ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT| ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE| ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE)) != 0) FIXME("Unsupported style %08x\n", afc->fdwStyle); @@ -213,7 +234,7 @@ case IDD_ACMFORMATCHOOSE_CMB_FORMATTAG: switch (HIWORD(wParam)) { case CBN_SELCHANGE: - MSACM_FillFormat(hWnd); + MSACM_FillFormat(hWnd, afc); break; default: TRACE("Dropped dlgNotif (fmtTag): 0x%08x 0x%08lx\n", @@ -266,6 +287,9 @@ LPWSTR name = NULL; LPWSTR templ = NULL; DWORD sz; + + if (pafmtc->cbStruct < sizeof(ACMFORMATCHOOSEA)) + return MMSYSERR_INVALPARAM; afcw.cbStruct = sizeof(afcw); afcw.fdwStyle = pafmtc->fdwStyle; @@ -338,6 +362,12 @@ */ MMRESULT WINAPI acmFormatChooseW(PACMFORMATCHOOSEW pafmtc) { + if (pafmtc->cbStruct < sizeof(ACMFORMATCHOOSEW)) + return MMSYSERR_INVALPARAM; + + if (!pafmtc->pwfx) + return MMSYSERR_INVALPARAM; + if (pafmtc->fdwStyle & ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE) return DialogBoxIndirectParamW(MSACM_hInstance32, (LPCDLGTEMPLATEW)pafmtc->hInstance, pafmtc->hwndOwner, FormatChooseDlgProc, (LPARAM)pafmtc); @@ -358,11 +388,15 @@ { ACMFORMATDETAILSW afdw; MMRESULT mmr; + + if (!pafd) + return MMSYSERR_INVALPARAM; memset(&afdw, 0, sizeof(afdw)); afdw.cbStruct = sizeof(afdw); afdw.dwFormatIndex = pafd->dwFormatIndex; afdw.dwFormatTag = pafd->dwFormatTag; + afdw.fdwSupport = pafd->fdwSupport; afdw.pwfx = pafd->pwfx; afdw.cbwfx = pafd->cbwfx; @@ -384,10 +418,26 @@ MMRESULT mmr; static const WCHAR fmt1[] = {'%','d',' ','H','z',0}; static const WCHAR fmt2[] = {';',' ','%','d',' ','b','i','t','s',0}; + ACMFORMATTAGDETAILSW aftd = {0}; TRACE("(%p, %p, %d)\n", had, pafd, fdwDetails); + if (!pafd) + return MMSYSERR_INVALPARAM; + if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM; + + if (!pafd->pwfx) + return MMSYSERR_INVALPARAM; + + if (pafd->cbwfx < sizeof(PCMWAVEFORMAT)) + return MMSYSERR_INVALPARAM; + + if (pafd->fdwSupport) + return MMSYSERR_INVALPARAM; + + if (pafd->dwFormatTag == WAVE_FORMAT_UNKNOWN) + return MMSYSERR_INVALPARAM; switch (fdwDetails) { case ACM_FORMATDETAILSF_FORMAT: @@ -413,7 +463,16 @@ } break; case ACM_FORMATDETAILSF_INDEX: - /* should check pafd->dwFormatIndex < aftd->cStandardFormats */ + aftd.cbStruct = sizeof(aftd); + aftd.dwFormatTag = pafd->dwFormatTag; + mmr = acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_FORMATTAG); + if (mmr != MMSYSERR_NOERROR) + break; + if (pafd->dwFormatIndex >= aftd.cStandardFormats) + { + mmr = MMSYSERR_INVALPARAM; + break; + } mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails); break; default: @@ -475,6 +534,9 @@ if (!pafda) return MMSYSERR_INVALPARAM; + if (!fnCallback) + return MMSYSERR_INVALPARAM; + if (pafda->cbStruct < sizeof(*pafda)) return MMSYSERR_INVALPARAM; @@ -482,6 +544,7 @@ afdw.cbStruct = sizeof(afdw); afdw.dwFormatIndex = pafda->dwFormatIndex; afdw.dwFormatTag = pafda->dwFormatTag; + afdw.fdwSupport = pafda->fdwSupport; afdw.pwfx = pafda->pwfx; afdw.cbwfx = pafda->cbwfx; @@ -560,6 +623,7 @@ for (j = 0; j < aftd.cStandardFormats; j++) { pafd->dwFormatIndex = j; pafd->dwFormatTag = aftd.dwFormatTag; + pafd->fdwSupport = 0; if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_INDEX) != MMSYSERR_NOERROR) continue; @@ -596,6 +660,8 @@ PWINE_ACMDRIVERID padid; WAVEFORMATEX wfxRef; BOOL ret; + DWORD cbwfxMax; + MMRESULT mmr; TRACE("(%p, %p, %p, %ld, %d)\n", had, pafd, fnCallback, dwInstance, fdwEnum); @@ -603,7 +669,16 @@ if (!pafd) return MMSYSERR_INVALPARAM; + if (!fnCallback) + return MMSYSERR_INVALPARAM; + if (pafd->cbStruct < sizeof(*pafd)) + return MMSYSERR_INVALPARAM; + + if (pafd->fdwSupport) + return MMSYSERR_INVALPARAM; + + if (!pafd->pwfx) return MMSYSERR_INVALPARAM; if (fdwEnum & (ACM_FORMATENUMF_WFORMATTAG|ACM_FORMATENUMF_NCHANNELS| @@ -621,6 +696,12 @@ if (fdwEnum & (ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT)) FIXME("Unsupported fdwEnum values %08x\n", fdwEnum); + + mmr = acmMetrics((HACMOBJ)had, ACM_METRIC_MAX_SIZE_FORMAT, &cbwfxMax); + if (mmr != MMSYSERR_NOERROR) + return mmr; + if (pafd->cbwfx < cbwfxMax) + return MMSYSERR_INVALPARAM; if (had) { HACMDRIVERID hadid; @@ -650,6 +731,7 @@ MMRESULT WINAPI acmFormatSuggest(HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest) { + ACMFORMATTAGDETAILSW aftd = {0}; ACMDRVFORMATSUGGEST adfg; MMRESULT mmr; @@ -662,6 +744,32 @@ if (fdwSuggest & ~(ACM_FORMATSUGGESTF_NCHANNELS|ACM_FORMATSUGGESTF_NSAMPLESPERSEC| ACM_FORMATSUGGESTF_WBITSPERSAMPLE|ACM_FORMATSUGGESTF_WFORMATTAG)) return MMSYSERR_INVALFLAG; + + /* if we were given PCM, try to convert to PCM */ + if (pwfxSrc->wFormatTag == WAVE_FORMAT_PCM && !had && + !(fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG)) + { + ACMFORMATDETAILSW afd = {0}; + afd.cbStruct = sizeof(afd); + afd.dwFormatTag = WAVE_FORMAT_PCM; + afd.pwfx = pwfxSrc; + afd.cbwfx = sizeof(PCMWAVEFORMAT); + if (!acmFormatDetailsW(had, &afd, ACM_FORMATDETAILSF_FORMAT)) + { + memcpy(pwfxDst, pwfxSrc, sizeof(PCMWAVEFORMAT)); + return MMSYSERR_NOERROR; + } + } + + aftd.cbStruct = sizeof(aftd); + if (fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG) + aftd.dwFormatTag = pwfxDst->wFormatTag; + mmr = acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE); + if ((fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG) && mmr == ACMERR_NOTPOSSIBLE) + return ACMERR_NOTPOSSIBLE; + + if (cbwfxDst < aftd.cbFormatSize) + return MMSYSERR_INVALPARAM; adfg.cbStruct = sizeof(adfg); adfg.fdwSuggest = fdwSuggest; Removed: trunk/reactos/dll/win32/msacm32/msacm.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msacm32/msacm.spec?rev=75885 ============================================================================== --- trunk/reactos/dll/win32/msacm32/msacm.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msacm32/msacm.spec (removed) @@ -1,40 +0,0 @@ - 1 stub WEP - 2 stub DRIVERPROC - 3 stub ___EXPORTEDSTUB - 7 pascal acmGetVersion() acmGetVersion16 - 8 pascal -ret16 acmMetrics(word word ptr) acmMetrics16 - 10 pascal -ret16 acmDriverEnum(ptr long long) acmDriverEnum16 - 11 pascal -ret16 acmDriverDetails(word ptr long) acmDriverDetails16 - 12 pascal -ret16 acmDriverAdd(ptr word long long long) acmDriverAdd16 - 13 pascal -ret16 acmDriverRemove(word long) acmDriverRemove16 - 14 pascal -ret16 acmDriverOpen(ptr word long) acmDriverOpen16 - 15 pascal -ret16 acmDriverClose(word long) acmDriverClose16 - 16 pascal acmDriverMessage(word word long long) acmDriverMessage16 - 17 pascal -ret16 acmDriverID(word ptr long) acmDriverID16 - 18 pascal -ret16 acmDriverPriority(word long long) acmDriverPriority16 - 30 pascal -ret16 acmFormatTagDetails(word ptr long) acmFormatTagDetails16 - 31 pascal -ret16 acmFormatTagEnum(word ptr ptr long long) acmFormatTagEnum16 - 40 pascal -ret16 acmFormatChoose(ptr) acmFormatChoose16 - 41 pascal -ret16 acmFormatDetails(word ptr long) acmFormatDetails16 - 42 pascal -ret16 acmFormatEnum(word ptr ptr long long) acmFormatEnum16 - 45 pascal -ret16 acmFormatSuggest(word ptr ptr long long) acmFormatSuggest16 - 50 pascal -ret16 acmFilterTagDetails(word ptr long) acmFilterTagDetails16 - 51 pascal -ret16 acmFilterTagEnum(word ptr ptr long long) acmFilterTagEnum16 - 60 pascal -ret16 acmFilterChoose(ptr) acmFilterChoose16 - 61 pascal -ret16 acmFilterDetails(word ptr long) acmFilterDetails16 - 62 pascal -ret16 acmFilterEnum(word ptr ptr long long) acmFilterEnum16 - 70 pascal -ret16 acmStreamOpen(ptr word ptr ptr ptr long long long) acmStreamOpen16 - 71 pascal -ret16 acmStreamClose(word long) acmStreamClose16 - 72 pascal -ret16 acmStreamSize(word long ptr long) acmStreamSize16 - 75 pascal -ret16 acmStreamConvert(word ptr long) acmStreamConvert16 - 76 pascal -ret16 acmStreamReset(word long) acmStreamReset16 - 77 pascal -ret16 acmStreamPrepareHeader(word ptr long) acmStreamPrepareHeader16 - 78 pascal -ret16 acmStreamUnprepareHeader(word ptr long) acmStreamUnprepareHeader16 -150 stub ACMAPPLICATIONEXIT -175 stub ACMHUGEPAGELOCK -176 stub ACMHUGEPAGEUNLOCK -200 stub ACMOPENCONVERSION -201 stub ACMCLOSECONVERSION -202 stub ACMCONVERT -203 stub ACMCHOOSEFORMAT -255 pascal DllEntryPoint(long word word word long word) MSACM_DllEntryPoint Removed: trunk/reactos/dll/win32/msacm32/msacm_main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msacm32/msacm_main.c?rev=75885 ============================================================================== --- trunk/reactos/dll/win32/msacm32/msacm_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msacm32/msacm_main.c (removed) @@ -1,451 +0,0 @@ -/* - * MSACM library - * - * Copyright 1998 Patrik Stridvall - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "wineacm.h" - -/************************************************************************** - * DllEntryPoint (MSACM.255) - * - * MSACM DLL entry point - * - */ -BOOL WINAPI MSACM_DllEntryPoint(DWORD fdwReason, HINSTANCE16 hinstDLL, WORD ds, - WORD wHeapSize, DWORD dwReserved1, WORD wReserved2) -{ - static HANDLE hndl; - - TRACE("0x%x 0x%lx\n", hinstDLL, fdwReason); - - switch (fdwReason) { - case DLL_PROCESS_ATTACH: - if (!hndl && !(hndl = LoadLibraryA("MSACM32.DLL"))) { - ERR("Could not load sibling MsAcm32.dll\n"); - return FALSE; - } - break; - case DLL_PROCESS_DETACH: - FreeLibrary(hndl); - hndl = 0; - break; - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - break; - } - return TRUE; -} - -/*********************************************************************** - * acmGetVersion (MSACM.7) - */ -DWORD WINAPI acmGetVersion16(void) -{ - return acmGetVersion(); -} - -/*********************************************************************** - * acmMetrics (MSACM.8) - */ - -MMRESULT16 WINAPI acmMetrics16( - HACMOBJ16 hao, UINT16 uMetric, LPVOID pMetric) -{ - FIXME("(0x%04x, %d, %p): semi-stub\n", hao, uMetric, pMetric); - - if(!hao) return acmMetrics(0, uMetric, pMetric); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmDriverEnum (MSACM.10) - */ -MMRESULT16 WINAPI acmDriverEnum16( - ACMDRIVERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum) -{ - FIXME("(%p, %ld, %ld): stub\n", - fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmDriverDetails (MSACM.11) - */ - -MMRESULT16 WINAPI acmDriverDetails16( - HACMDRIVERID16 hadid, LPACMDRIVERDETAILS16 padd, DWORD fdwDetails) -{ - FIXME("(0x%04x, %p, %ld): stub\n", hadid, padd, fdwDetails); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmDriverAdd (MSACM.12) - */ -MMRESULT16 WINAPI acmDriverAdd16( - LPHACMDRIVERID16 phadid, HINSTANCE16 hinstModule, - LPARAM lParam, DWORD dwPriority, DWORD fdwAdd) -{ - FIXME("(%p, 0x%04x, %ld, %ld, %ld): stub\n", - phadid, hinstModule, lParam, dwPriority, fdwAdd - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmDriverRemove (MSACM.13) - */ -MMRESULT16 WINAPI acmDriverRemove16( - HACMDRIVERID16 hadid, DWORD fdwRemove) -{ - FIXME("(0x%04x, %ld): stub\n", hadid, fdwRemove); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmDriverOpen (MSACM.14) - */ -MMRESULT16 WINAPI acmDriverOpen16( - LPHACMDRIVER16 phad, HACMDRIVERID16 hadid, DWORD fdwOpen) -{ - FIXME("(%p, 0x%04x, %ld): stub\n", phad, hadid, fdwOpen); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmDriverClose (MSACM.15) - */ -MMRESULT16 WINAPI acmDriverClose16( - HACMDRIVER16 had, DWORD fdwClose) -{ - FIXME("(0x%04x, %ld): stub\n", had, fdwClose); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmDriverMessage (MSACM.16) - */ -LRESULT WINAPI acmDriverMessage16( - HACMDRIVER16 had, UINT16 uMsg, LPARAM lParam1, LPARAM lParam2) -{ - FIXME("(0x%04x, %d, %ld, %ld): stub\n", - had, uMsg, lParam1, lParam2 - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - -/*********************************************************************** - * acmDriverID (MSACM.17) - */ -MMRESULT16 WINAPI acmDriverID16( - HACMOBJ16 hao, LPHACMDRIVERID16 phadid, DWORD fdwDriverID) -{ - FIXME("(0x%04x, %p, %ld): stub\n", hao, phadid, fdwDriverID); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmDriverPriority (MSACM.18) - */ -MMRESULT16 WINAPI acmDriverPriority16( - HACMDRIVERID16 hadid, DWORD dwPriority, DWORD fdwPriority) -{ - FIXME("(0x%04x, %ld, %ld): stub\n", - hadid, dwPriority, fdwPriority - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmFormatTagDetails (MSACM.30) - */ -MMRESULT16 WINAPI acmFormatTagDetails16( - HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd, DWORD fdwDetails) -{ - FIXME("(0x%04x, %p, %ld): stub\n", had, paftd, fdwDetails); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmFormatTagEnum (MSACM.31) - */ -MMRESULT16 WINAPI acmFormatTagEnum16( - HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd, - ACMFORMATTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum) -{ - FIXME("(0x%04x, %p, %p, %ld, %ld): stub\n", - had, paftd, fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmFormatChoose (MSACM.40) - */ -MMRESULT16 WINAPI acmFormatChoose16( - LPACMFORMATCHOOSE16 pafmtc) -{ - FIXME("(%p): stub\n", pafmtc); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmFormatDetails (MSACM.41) - */ -MMRESULT16 WINAPI acmFormatDetails16( - HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd, DWORD fdwDetails) -{ - FIXME("(0x%04x, %p, %ld): stub\n", had, pafd, fdwDetails); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmFormatEnum (MSACM.42) - */ -MMRESULT16 WINAPI acmFormatEnum16( - HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd, - ACMFORMATENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum) -{ - FIXME("(0x%04x, %p, %p, %ld, %ld): stub\n", - had, pafd, fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmFormatSuggest (MSACM.45) - */ -MMRESULT16 WINAPI acmFormatSuggest16( - HACMDRIVER16 had, LPWAVEFORMATEX pwfxSrc, - LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest) -{ - FIXME("(0x%04x, %p, %p, %ld, %ld): stub\n", - had, pwfxSrc, pwfxDst, cbwfxDst, fdwSuggest - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmFilterTagDetails (MSACM.50) - */ -MMRESULT16 WINAPI acmFilterTagDetails16( - HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd, DWORD fdwDetails) -{ - FIXME("(0x%04x, %p, %ld): stub\n", had, paftd, fdwDetails); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmFilterTagEnum (MSACM.51) - */ -MMRESULT16 WINAPI acmFilterTagEnum16( - HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd, - ACMFILTERTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum) -{ - FIXME("(0x%04x, %p, %p, %ld, %ld): stub\n", - had, paftd, fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmFilterChoose (MSACM.60) - */ -MMRESULT16 WINAPI acmFilterChoose16( - LPACMFILTERCHOOSE16 pafltrc) -{ - FIXME("(%p): stub\n", pafltrc); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmFilterDetails (MSACM.61) - */ -MMRESULT16 WINAPI acmFilterDetails16( - HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd, DWORD fdwDetails) -{ - FIXME("(0x%04x, %p, %ld): stub\n", had, pafd, fdwDetails); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmFilterEnum (MSACM.62) - */ -MMRESULT16 WINAPI acmFilterEnum16( - HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd, - ACMFILTERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum) -{ - FIXME("(0x%04x, %p, %p, %ld, %ld): stub\n", - had, pafd, fnCallback, dwInstance, fdwEnum - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmStreamOpen (MSACM.70) - */ -MMRESULT16 WINAPI acmStreamOpen16( - LPHACMSTREAM16 phas, HACMDRIVER16 had, - LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, - LPWAVEFILTER pwfltr, DWORD dwCallback, - DWORD dwInstance, DWORD fdwOpen) -{ - FIXME("(%p, 0x%04x, %p, %p, %p, %ld, %ld, %ld): stub\n", - phas, had, pwfxSrc, pwfxDst, pwfltr, - dwCallback, dwInstance, fdwOpen - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmStreamClose (MSACM.71) - */ -MMRESULT16 WINAPI acmStreamClose16( - HACMSTREAM16 has, DWORD fdwClose) -{ - FIXME("(0x%04x, %ld): stub\n", has, fdwClose); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmStreamSize (MSACM.72) - */ -MMRESULT16 WINAPI acmStreamSize16( - HACMSTREAM16 has, DWORD cbInput, - LPDWORD pdwOutputBytes, DWORD fdwSize) -{ - FIXME("(0x%04x, %ld, %p, %ld): stub\n", - has, cbInput, pdwOutputBytes, fdwSize - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmStreamConvert (MSACM.75) - */ -MMRESULT16 WINAPI acmStreamConvert16( - HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwConvert) -{ - FIXME("(0x%04x, %p, %ld): stub\n", has, pash, fdwConvert); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmStreamReset (MSACM.76) - */ -MMRESULT16 WINAPI acmStreamReset16( - HACMSTREAM16 has, DWORD fdwReset) -{ - FIXME("(0x%04x, %ld): stub\n", has, fdwReset); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmStreamPrepareHeader (MSACM.77) - */ -MMRESULT16 WINAPI acmStreamPrepareHeader16( - HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwPrepare) -{ - FIXME("(0x%04x, %p, %ld): stub\n", has, pash, fdwPrepare); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * acmStreamUnprepareHeader (MSACM.78) - */ -MMRESULT16 WINAPI acmStreamUnprepareHeader16( - HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwUnprepare) -{ - FIXME("(0x%04x, %p, %ld): stub\n", - has, pash, fdwUnprepare - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; -} - -/*********************************************************************** - * ACMAPPLICATIONEXIT (MSACM.150) - * FIXME - * No documentation found. - */ - -/*********************************************************************** - * ACMHUGEPAGELOCK (MSACM.175) - *FIXME - * No documentation found. - */ - -/*********************************************************************** - * ACMHUGEPAGEUNLOCK (MSACM.176) - * FIXME - * No documentation found. - */ - -/*********************************************************************** - * ACMOPENCONVERSION (MSACM.200) - * FIXME - * No documentation found. - */ - -/*********************************************************************** - * ACMCLOSECONVERSION (MSACM.201) - * FIXME - * No documentation found. - */ - -/*********************************************************************** - * ACMCONVERT (MSACM.202) - * FIXME - * No documentation found. - */ - -/*********************************************************************** - * ACMCHOOSEFORMAT (MSACM.203) - * FIXME - * No documentation found. - */ - - Modified: trunk/reactos/dll/win32/msacm32/pcmconverter.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msacm32/pcmconverter.c?rev=75886&r1=75885&r2=75886&view=diff ============================================================================== --- trunk/reactos/dll/win32/msacm32/pcmconverter.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msacm32/pcmconverter.c [iso-8859-1] Sun Sep 17 22:55:04 2017 @@ -58,13 +58,16 @@ /* flags for fdwDriver */ #define PCM_RESAMPLE 1 +typedef void (*PCM_CONVERT_KEEP_RATE)(const unsigned char*, int, unsigned char*); + +typedef void (*PCM_CONVERT_CHANGE_RATE)(const DWORD, const unsigned char*, DWORD*, const DWORD, unsigned char*, DWORD*); + /* data used while converting */ typedef struct tagAcmPcmData { /* conversion routine, depending if rate conversion is required */ union { - void (*cvtKeepRate)(const unsigned char*, int, unsigned char*); - void (*cvtChangeRate)(DWORD, const unsigned char*, LPDWORD, - DWORD, unsigned char*, LPDWORD); + PCM_CONVERT_KEEP_RATE cvtKeepRate; + PCM_CONVERT_CHANGE_RATE cvtChangeRate; } cvt; } AcmPcmData; @@ -502,8 +505,6 @@ } -typedef void (*PCM_CONVERT_KEEP_RATE)(const unsigned char*, int, unsigned char*); - static const PCM_CONVERT_KEEP_RATE PCM_ConvertKeepRate[] = { cvtSS88K, cvtSM88K, cvtMS88K, cvtMM88K, cvtSS816K, cvtSM816K, cvtMS816K, cvtMM816K, @@ -524,397 +525,416 @@ * <M> is the number of bits of output channel (8 or 16) * */ -static void cvtSS88C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - *dst++ = *src; - *dst++ = *src; - error = error + srcRate; - while (error > dstRate) { - src += 2; - (*nsrc)--; - if (*nsrc == 0) - return; - error = error - dstRate; - } - } -} - -static void cvtSM88C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - *dst++ = M8(src[0], src[1]); - error = error + srcRate; - while (error > dstRate) { - src += 2; - (*nsrc)--; - if (*nsrc == 0) - return; - error = error - dstRate; - } - } -} - -static void cvtMS88C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - *dst++ = *src; - *dst++ = *src; - error = error + srcRate; - while (error > dstRate) { - src++; - (*nsrc)--; - if (*nsrc == 0) - return; - error = error - dstRate; - } - } -} - -static void cvtMM88C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - *dst++ = *src; - error = error + srcRate; - while (error > dstRate) { - src++; - (*nsrc)--; - if (*nsrc==0) - return; - error = error - dstRate; - } - } -} - -static void cvtSS816C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - W16(dst, C816(src[0])); dst += 2; - W16(dst, C816(src[1])); dst += 2; - error = error + srcRate; - while (error > dstRate) { - src += 2; - (*nsrc)--; - if (*nsrc==0) - return; - error = error - dstRate; - } - } -} - -static void cvtSM816C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - W16(dst, M16(C816(src[0]), C816(src[1]))); dst += 2; - error = error + srcRate; - while (error > dstRate) { - src += 2; - (*nsrc)--; - if (*nsrc==0) - return; - error = error - dstRate; - } - } -} - -static void cvtMS816C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - W16(dst, C816(*src)); dst += 2; - W16(dst, C816(*src)); dst += 2; - error = error + srcRate; - while (error > dstRate) { - src++; - (*nsrc)--; - if (*nsrc==0) - return; - error = error - dstRate; - } - } -} - -static void cvtMM816C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - W16(dst, C816(*src)); dst += 2; - error = error + srcRate; - while (error > dstRate) { - src++; - (*nsrc)--; - if (*nsrc==0) - return; - error = error - dstRate; - } - } -} - -static void cvtSS168C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - *dst++ = C168(R16(src)); - *dst++ = C168(R16(src + 2)); - error = error + srcRate; - while (error > dstRate) { - src += 4; - (*nsrc)--; - if (*nsrc==0) - return; - error = error - dstRate; - } - } -} - -static void cvtSM168C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - *dst++ = C168(M16(R16(src), R16(src + 2))); - error = error + srcRate; - while (error > dstRate) { - src += 4; - (*nsrc)--; - if (*nsrc==0) - return; - error = error - dstRate; - } - } -} - -static void cvtMS168C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - *dst++ = C168(R16(src)); - *dst++ = C168(R16(src)); - error = error + srcRate; - while (error > dstRate) { - src += 2; - (*nsrc)--; - if (*nsrc==0) - return; - error = error - dstRate; - } - } -} - -static void cvtMM168C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - *dst++ = C168(R16(src)); - error = error + srcRate; - while (error > dstRate) { - src += 2; - (*nsrc)--; - if (*nsrc == 0) - return; - error = error - dstRate; - } - } -} - -static void cvtSS1616C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - W16(dst, R16(src)); dst += 2; - W16(dst, R16(src)); dst += 2; - error = error + srcRate; - while (error > dstRate) { - src += 4; - (*nsrc)--; - if (*nsrc == 0) - return; - error = error - dstRate; - } - } -} - -static void cvtSM1616C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - W16(dst, M16(R16(src), R16(src + 2))); dst += 2; - error = error + srcRate; - while (error > dstRate) { - src += 4; - (*nsrc)--; - if (*nsrc == 0) - return; - error = error - dstRate; - } - } -} - -static void cvtMS1616C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while((*ndst)--) { - W16(dst, R16(src)); dst += 2; - W16(dst, R16(src)); dst += 2; - error = error + srcRate; - while (error > dstRate) { - src += 2; - (*nsrc)--; - if (*nsrc == 0) - return; - error = error - dstRate; - } - } -} - -static void cvtMM1616C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - W16(dst, R16(src)); dst += 2; - error = error + srcRate; - while (error > dstRate) { - src += 2; - (*nsrc)--; - if (*nsrc == 0) - return; - error = error - dstRate; - } - } -} - -static void cvtSS2424C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - W24(dst, R24(src)); dst += 3; - W24(dst, R24(src)); dst += 3; - error = error + srcRate; - while (error > dstRate) { - src += 6; - (*nsrc)--; - if (*nsrc == 0) - return; - error = error - dstRate; - } - } -} - -static void cvtSM2424C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - W24(dst, M24(R24(src), R24(src + 3))); dst += 3; - error = error + srcRate; - while (error > dstRate) { - src += 6; - (*nsrc)--; - if (*nsrc == 0) - return; - error = error - dstRate; - } - } -} - -static void cvtMS2424C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while((*ndst)--) { - W24(dst, R24(src)); dst += 3; - W24(dst, R24(src)); dst += 3; - error = error + srcRate; - while (error > dstRate) { - src += 3; - (*nsrc)--; - if (*nsrc == 0) - return; - error = error - dstRate; - } - } -} - -static void cvtMM2424C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, - DWORD dstRate, unsigned char* dst, LPDWORD ndst) -{ - DWORD error = dstRate / 2; - TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - - while ((*ndst)--) { - W24(dst, R24(src)); dst += 3; - error = error + srcRate; - while (error > dstRate) { - src += 3; - (*nsrc)--; - if (*nsrc == 0) - return; - error = error - dstRate; - } - } -} - -typedef void (*PCM_CONVERT_CHANGE_RATE)(DWORD, const unsigned char*, LPDWORD, DWORD, unsigned char*, LPDWORD); + +static void cvtSS88C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + *dst++ = src[0]; + *dst++ = src[1]; + } + src += 2; + } +} + +static void cvtSM88C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + *dst++ = M8(src[0], src[1]); + } + src += 2; + } +} + +static void cvtMS88C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + *dst++ = src[0]; + *dst++ = src[0]; + } + src += 1; + } +} + +static void cvtMM88C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + *dst++ = src[0]; + } + src += 1; + } +} + +static void cvtSS816C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + W16(dst, C816(src[0])); dst += 2; + W16(dst, C816(src[1])); dst += 2; + } + src += 2; + } +} + +static void cvtSM816C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + W16(dst, M16(C816(src[0]), C816(src[1]))); dst += 2; + } + src += 2; + } +} + +static void cvtMS816C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + W16(dst, C816(src[0])); dst += 2; + W16(dst, C816(src[0])); dst += 2; + } + src += 1; + } +} + +static void cvtMM816C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + W16(dst, C816(src[0])); dst += 2; + } + src += 1; + } +} + +static void cvtSS168C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + *dst++ = C168(R16(src)); + *dst++ = C168(R16(src + 2)); + } + src += 4; + } +} + +static void cvtSM168C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + *dst++ = C168(M16(R16(src), R16(src + 2))); + } + src += 4; + } +} + +static void cvtMS168C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + *dst++ = C168(R16(src)); + *dst++ = C168(R16(src)); + } + src += 2; + } +} + +static void cvtMM168C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + *dst++ = C168(R16(src)); + } + src += 2; + } +} + +static void cvtSS1616C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + W16(dst, R16(src)); dst += 2; + W16(dst, R16(src + 2)); dst += 2; + } + src += 4; + } +} + +static void cvtSM1616C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + W16(dst, M16(R16(src), R16(src + 2))); dst += 2; + } + src += 4; + } +} + +static void cvtMS1616C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + W16(dst, R16(src)); dst += 2; + W16(dst, R16(src)); dst += 2; + } + src += 2; + } +} + +static void cvtMM1616C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + W16(dst, R16(src)); dst += 2; + } + src += 2; + } +} + +static void cvtSS2424C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + W24(dst, R24(src)); dst += 3; + W24(dst, R24(src + 3)); dst += 3; + } + src += 6; + } +} + +static void cvtSM2424C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + W24(dst, M24(R24(src), R24(src + 3))); dst += 3; + } + src += 6; + } +} + +static void cvtMS2424C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + W24(dst, R24(src)); dst += 3; + W24(dst, R24(src)); dst += 3; + } + src += 3; + } +} + +static void cvtMM2424C(const DWORD srcRate, const unsigned char *src, DWORD *nsrc, + const DWORD dstRate, unsigned char *dst, DWORD *ndst) +{ + DWORD error = srcRate / 2; + DWORD maxSrc = *nsrc, maxDst = *ndst; + *ndst = 0; + for (*nsrc = 0; *nsrc < maxSrc; (*nsrc)++) { + error += dstRate; + while (error > srcRate) { + if (*ndst == maxDst) + return; + (*ndst)++; + error -= srcRate; + + W24(dst, R24(src)); dst += 3; + } + src += 3; + } +} static const PCM_CONVERT_CHANGE_RATE PCM_ConvertChangeRate[] = { cvtSS88C, cvtSM88C, cvtMS88C, cvtMM88C, @@ -1268,12 +1288,8 @@ /* do the job */ if (adsi->fdwDriver & PCM_RESAMPLE) { - DWORD nsrc2 = nsrc; - DWORD ndst2 = ndst; - apd->cvt.cvtChangeRate(adsi->pwfxSrc->nSamplesPerSec, adsh->pbSrc, &nsrc2, - adsi->pwfxDst->nSamplesPerSec, adsh->pbDst, &ndst2); - nsrc -= nsrc2; - ndst -= ndst2; + apd->cvt.cvtChangeRate(adsi->pwfxSrc->nSamplesPerSec, adsh->pbSrc, &nsrc, + adsi->pwfxDst->nSamplesPerSec, adsh->pbDst, &ndst); } else { if (nsrc < ndst) ndst = nsrc; else nsrc = ndst; Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=75886&r1=75885&r2=75886&view=diff ============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Sep 17 22:55:04 2017 @@ -100,7 +100,7 @@ reactos/dll/win32/mmdevapi # Synced to WineStaging-1.9.23 reactos/dll/win32/mpr # Synced to WineStaging-2.9 reactos/dll/win32/mprapi # Synced to WineStaging-2.9 -reactos/dll/win32/msacm32 # Synced to WineStaging-2.9 +reactos/dll/win32/msacm32 # Synced to WineStaging-2.16 reactos/dll/win32/msacm32.drv # Synced to WineStaging-2.9 reactos/dll/win32/msadp32.acm # Synced to WineStaging-2.9 reactos/dll/win32/mscat32 # Synced to WineStaging-2.9