Module: wine Branch: master Commit: 2722f2cbfcd5f45a3f53e5b818439fba1de2c14f URL: http://source.winehq.org/git/wine.git/?a=commit;h=2722f2cbfcd5f45a3f53e5b818...
Author: Jörg Höhle hoehle@users.sourceforge.net Date: Sun Mar 10 14:43:51 2013 +0100
winmm: Fix GetPosition when using MSACM codecs.
---
dlls/winmm/waveform.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c index 0368790..594d82c 100644 --- a/dlls/winmm/waveform.c +++ b/dlls/winmm/waveform.c @@ -2035,7 +2035,7 @@ static LRESULT WINMM_Reset(HWAVE hwave) }
static MMRESULT WINMM_FramesToMMTime(MMTIME *time, UINT32 played_frames, - UINT32 sample_rate, UINT32 bytes_per_frame) + UINT32 sample_rate, UINT32 bytes_per_sec) { switch(time->wType){ case TIME_SAMPLES: @@ -2058,7 +2058,7 @@ static MMRESULT WINMM_FramesToMMTime(MMTIME *time, UINT32 played_frames, time->wType = TIME_BYTES; /* fall through */ case TIME_BYTES: - time->u.cb = played_frames * bytes_per_frame; + time->u.cb = MulDiv(played_frames, bytes_per_sec, sample_rate); return MMSYSERR_NOERROR; } } @@ -2066,7 +2066,7 @@ static MMRESULT WINMM_FramesToMMTime(MMTIME *time, UINT32 played_frames, static LRESULT WINMM_GetPosition(HWAVE hwave, MMTIME *time) { WINMM_Device *device = WINMM_GetDeviceFromHWAVE(hwave); - UINT32 played_frames, sample_rate, bytes_per_frame; + UINT32 played_frames, sample_rate, bytes_per_sec;
TRACE("(%p, %p)\n", hwave, time);
@@ -2075,12 +2075,11 @@ static LRESULT WINMM_GetPosition(HWAVE hwave, MMTIME *time)
played_frames = device->played_frames; sample_rate = device->orig_fmt->nSamplesPerSec; - bytes_per_frame = device->orig_fmt->nBlockAlign; + bytes_per_sec = device->orig_fmt->nAvgBytesPerSec;
LeaveCriticalSection(&device->lock);
- return WINMM_FramesToMMTime(time, played_frames, sample_rate, - bytes_per_frame); + return WINMM_FramesToMMTime(time, played_frames, sample_rate, bytes_per_sec); }
static WINMM_MMDevice *WINMM_GetMixerMMDevice(HMIXEROBJ hmix, DWORD flags,