msacm32: Try to suggest PCM to PCM conversion first.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2017-06-07 16:07:53 -05:00 committed by Alexandre Julliard
parent 8e88af31cd
commit ab2760ec33
2 changed files with 16 additions and 2 deletions

View File

@ -733,6 +733,22 @@ MMRESULT WINAPI acmFormatSuggest(HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
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;

View File

@ -1062,7 +1062,6 @@ static void test_acmFormatSuggest(void)
suggest = 0;
memset(&dst, 0, sizeof(dst));
rc = acmFormatSuggest(NULL, &src, &dst, sizeof(PCMWAVEFORMAT), suggest);
todo_wine {
ok(rc == MMSYSERR_NOERROR, "failed with error 0x%x\n", rc);
ok(src.wFormatTag == dst.wFormatTag, "expected %d, got %d\n", src.wFormatTag, dst.wFormatTag);
ok(src.nChannels == dst.nChannels, "expected %d, got %d\n", src.nChannels, dst.nChannels);
@ -1070,7 +1069,6 @@ static void test_acmFormatSuggest(void)
ok(src.nAvgBytesPerSec == dst.nAvgBytesPerSec, "expected %d, got %d\n", src.nAvgBytesPerSec, dst.nAvgBytesPerSec);
ok(src.nBlockAlign == dst.nBlockAlign, "expected %d, got %d\n", src.nBlockAlign, dst.nBlockAlign);
ok(src.wBitsPerSample == dst.wBitsPerSample, "expected %d, got %d\n", src.wBitsPerSample, dst.wBitsPerSample);
}
/* All parameters from destination are valid */
suggest = ACM_FORMATSUGGESTF_NCHANNELS