Maarten Lankhorst : quartz: Implement dynamic format changing in directsound renderer.
Alexandre Julliard
julliard at winehq.org
Wed Oct 22 07:59:56 CDT 2008
Module: wine
Branch: master
Commit: b2d20154fa6c644c88af0c08ed4d86170f0df5fe
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b2d20154fa6c644c88af0c08ed4d86170f0df5fe
Author: Maarten Lankhorst <maarten at codeweavers.com>
Date: Tue Oct 21 12:50:36 2008 +0200
quartz: Implement dynamic format changing in directsound renderer.
---
dlls/quartz/dsoundrender.c | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c
index aae7e68..a92e866 100644
--- a/dlls/quartz/dsoundrender.c
+++ b/dlls/quartz/dsoundrender.c
@@ -238,6 +238,7 @@ static HRESULT DSoundRender_Sample(LPVOID iface, IMediaSample * pSample)
long cbSrcStream = 0;
REFERENCE_TIME tStart, tStop;
HRESULT hr;
+ AM_MEDIA_TYPE *amt;
TRACE("%p %p\n", iface, pSample);
@@ -259,6 +260,39 @@ static HRESULT DSoundRender_Sample(LPVOID iface, IMediaSample * pSample)
return VFW_E_WRONG_STATE;
}
+ if (IMediaSample_GetMediaType(pSample, &amt) == S_OK)
+ {
+ AM_MEDIA_TYPE *orig = &This->pInputPin->pin.mtCurrent;
+ WAVEFORMATEX *origfmt = (WAVEFORMATEX *)orig->pbFormat;
+ WAVEFORMATEX *newfmt = (WAVEFORMATEX *)amt->pbFormat;
+
+ if (origfmt->wFormatTag == newfmt->wFormatTag &&
+ origfmt->nChannels == newfmt->nChannels &&
+ origfmt->nBlockAlign == newfmt->nBlockAlign &&
+ origfmt->wBitsPerSample == newfmt->wBitsPerSample &&
+ origfmt->cbSize == newfmt->cbSize)
+ {
+ if (origfmt->nSamplesPerSec != newfmt->nSamplesPerSec)
+ {
+ hr = IDirectSoundBuffer_SetFrequency(This->dsbuffer,
+ newfmt->nSamplesPerSec);
+ if (FAILED(hr))
+ {
+ LeaveCriticalSection(&This->csFilter);
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ FreeMediaType(orig);
+ CopyMediaType(orig, amt);
+ IMediaSample_SetMediaType(pSample, NULL);
+ }
+ }
+ else
+ {
+ LeaveCriticalSection(&This->csFilter);
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ }
+
SetEvent(This->state_change);
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
More information about the wine-cvs
mailing list