mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:43:31 +00:00
quartz: Implement dynamic format changing in directsound renderer.
This commit is contained in:
parent
ca0db58808
commit
b2d20154fa
1 changed files with 34 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue