From cf73a26c6bc20e03904f23cc9c55546db27f44d8 Mon Sep 17 00:00:00 2001 From: Julius Schwartzenberg Date: Tue, 12 Jan 2010 00:30:54 +0100 Subject: [PATCH] avifil32: Overwrite dwRate in the audiostream with the nBlockAlign from the wave header. --- dlls/avifil32/avifile.c | 9 ++++++++- dlls/avifil32/tests/api.c | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c index 57ebb114d6f..aa1df3bc912 100644 --- a/dlls/avifil32/avifile.c +++ b/dlls/avifil32/avifile.c @@ -1819,7 +1819,14 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This) if (FAILED(hr)) return hr; }; - + if (pStream->lpFormat != NULL && pStream->sInfo.fccType == streamtypeAUDIO) + { + WAVEFORMATEX *wfx = pStream->lpFormat; /* wfx->nBlockAlign = wfx->nChannels * wfx->wBitsPerSample / 8; could be added */ + pStream->sInfo.dwSampleSize = wfx->nBlockAlign; /* to deal with corrupt wfx->nBlockAlign but Windows doesn't do this */ + TRACE("Block size reset to %u, chan=%u bpp=%u\n", wfx->nBlockAlign, wfx->nChannels, wfx->wBitsPerSample); + pStream->sInfo.dwScale = 1; + pStream->sInfo.dwRate = wfx->nSamplesPerSec; + } if (mmioAscend(This->hmmio, &ck, 0) != S_OK) return AVIERR_FILEREAD; } diff --git a/dlls/avifil32/tests/api.c b/dlls/avifil32/tests/api.c index 28bae04c6fe..a68ce9cc2da 100644 --- a/dlls/avifil32/tests/api.c +++ b/dlls/avifil32/tests/api.c @@ -404,7 +404,7 @@ static void test_ash1_corruption(void) /* The result will still be 2, because the value is dynamically replaced with the nBlockAlign value from the stream format header. The next test will prove this */ - todo_wine{ ok(asi1.dwSampleSize == 2, "got %u (expected 2)\n", asi1.dwSampleSize); } + ok(asi1.dwSampleSize == 2, "got %u (expected 2)\n", asi1.dwSampleSize); AVIStreamRelease(pStream1); AVIFileRelease(pFile); @@ -438,7 +438,7 @@ static void test_ash1_corruption2(void) ok(AVIStreamInfo(pStream1, &asi1, sizeof(AVISTREAMINFO)) == 0, "Unable to read stream info\n"); /* The result will also be the corrupt value, as explained above. */ - todo_wine{ ok(asi1.dwSampleSize == 0xdead, "got 0x%x (expected 0xdead)\n", asi1.dwSampleSize); } + ok(asi1.dwSampleSize == 0xdead, "got 0x%x (expected 0xdead)\n", asi1.dwSampleSize); AVIStreamRelease(pStream1); AVIFileRelease(pFile);