quartz/dsoundrender: Move DSoundRender_create() to avoid forward declarations.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d21dbf960b
commit
3f2b813da6
|
@ -39,10 +39,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
|||
*/
|
||||
static const REFERENCE_TIME DSoundRenderer_Max_Fill = 150 * 10000;
|
||||
|
||||
static const IBasicAudioVtbl IBasicAudio_Vtbl;
|
||||
static const IReferenceClockVtbl IReferenceClock_Vtbl;
|
||||
static const IAMDirectSoundVtbl IAMDirectSound_Vtbl;
|
||||
|
||||
typedef struct DSoundRenderImpl
|
||||
{
|
||||
struct strmbase_renderer renderer;
|
||||
|
@ -577,62 +573,6 @@ static const struct strmbase_renderer_ops renderer_ops =
|
|||
.renderer_query_interface = dsound_render_query_interface,
|
||||
};
|
||||
|
||||
HRESULT DSoundRender_create(IUnknown *outer, void **out)
|
||||
{
|
||||
static const WCHAR sink_name[] = {'A','u','d','i','o',' ','I','n','p','u','t',' ','p','i','n',' ','(','r','e','n','d','e','r','e','d',')',0};
|
||||
|
||||
HRESULT hr;
|
||||
DSoundRenderImpl * pDSoundRender;
|
||||
|
||||
*out = NULL;
|
||||
|
||||
pDSoundRender = CoTaskMemAlloc(sizeof(DSoundRenderImpl));
|
||||
if (!pDSoundRender)
|
||||
return E_OUTOFMEMORY;
|
||||
ZeroMemory(pDSoundRender, sizeof(DSoundRenderImpl));
|
||||
|
||||
hr = strmbase_renderer_init(&pDSoundRender->renderer,
|
||||
outer, &CLSID_DSoundRender, sink_name, &renderer_ops);
|
||||
|
||||
pDSoundRender->IBasicAudio_iface.lpVtbl = &IBasicAudio_Vtbl;
|
||||
pDSoundRender->IReferenceClock_iface.lpVtbl = &IReferenceClock_Vtbl;
|
||||
pDSoundRender->IAMDirectSound_iface.lpVtbl = &IAMDirectSound_Vtbl;
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = DirectSoundCreate8(NULL, &pDSoundRender->dsound, NULL);
|
||||
if (FAILED(hr))
|
||||
ERR("Cannot create Direct Sound object (%x)\n", hr);
|
||||
else
|
||||
hr = IDirectSound8_SetCooperativeLevel(pDSoundRender->dsound, GetDesktopWindow(), DSSCL_PRIORITY);
|
||||
if (SUCCEEDED(hr)) {
|
||||
IDirectSoundBuffer *buf;
|
||||
DSBUFFERDESC buf_desc;
|
||||
memset(&buf_desc,0,sizeof(DSBUFFERDESC));
|
||||
buf_desc.dwSize = sizeof(DSBUFFERDESC);
|
||||
buf_desc.dwFlags = DSBCAPS_PRIMARYBUFFER;
|
||||
hr = IDirectSound8_CreateSoundBuffer(pDSoundRender->dsound, &buf_desc, &buf, NULL);
|
||||
if (SUCCEEDED(hr)) {
|
||||
IDirectSoundBuffer_Play(buf, 0, 0, DSBPLAY_LOOPING);
|
||||
IDirectSoundBuffer_Release(buf);
|
||||
}
|
||||
hr = S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
*out = &pDSoundRender->renderer.filter.IUnknown_inner;
|
||||
}
|
||||
else
|
||||
{
|
||||
strmbase_renderer_cleanup(&pDSoundRender->renderer);
|
||||
CoTaskMemFree(pDSoundRender);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/*** IUnknown methods ***/
|
||||
static HRESULT WINAPI Basicaudio_QueryInterface(IBasicAudio *iface,
|
||||
REFIID riid,
|
||||
|
@ -1158,3 +1098,58 @@ static const IAMDirectSoundVtbl IAMDirectSound_Vtbl =
|
|||
AMDirectSound_SetFocusWindow,
|
||||
AMDirectSound_GetFocusWindow
|
||||
};
|
||||
|
||||
HRESULT dsound_render_create(IUnknown *outer, void **out)
|
||||
{
|
||||
static const DSBUFFERDESC buffer_desc = {
|
||||
.dwSize = sizeof(DSBUFFERDESC),
|
||||
.dwFlags = DSBCAPS_PRIMARYBUFFER,
|
||||
};
|
||||
|
||||
IDirectSoundBuffer *buffer;
|
||||
DSoundRenderImpl *object;
|
||||
HRESULT hr;
|
||||
|
||||
if (!(object = CoTaskMemAlloc(sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
memset(object, 0, sizeof(*object));
|
||||
|
||||
if (FAILED(hr = strmbase_renderer_init(&object->renderer, outer,
|
||||
&CLSID_DSoundRender, L"Audio Input pin (rendered)", &renderer_ops)))
|
||||
{
|
||||
CoTaskMemFree(object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
object->IBasicAudio_iface.lpVtbl = &IBasicAudio_Vtbl;
|
||||
object->IReferenceClock_iface.lpVtbl = &IReferenceClock_Vtbl;
|
||||
object->IAMDirectSound_iface.lpVtbl = &IAMDirectSound_Vtbl;
|
||||
|
||||
if (FAILED(hr = DirectSoundCreate8(NULL, &object->dsound, NULL)))
|
||||
{
|
||||
strmbase_renderer_cleanup(&object->renderer);
|
||||
CoTaskMemFree(object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
if (FAILED(hr = IDirectSound8_SetCooperativeLevel(object->dsound,
|
||||
GetDesktopWindow(), DSSCL_PRIORITY)))
|
||||
{
|
||||
IDirectSound8_Release(object->dsound);
|
||||
strmbase_renderer_cleanup(&object->renderer);
|
||||
CoTaskMemFree(object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr = IDirectSound8_CreateSoundBuffer(object->dsound,
|
||||
&buffer_desc, &buffer, NULL)))
|
||||
{
|
||||
IDirectSoundBuffer_Play(buffer, 0, 0, DSBPLAY_LOOPING);
|
||||
IDirectSoundBuffer_Release(buffer);
|
||||
}
|
||||
|
||||
TRACE("Created DirectSound renderer %p.\n", object);
|
||||
*out = &object->renderer.filter.IUnknown_inner;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -73,8 +73,8 @@ static const struct object_creation_info object_creation[] =
|
|||
{ &CLSID_VideoMixingRenderer, VMR7Impl_create },
|
||||
{ &CLSID_VideoMixingRenderer9, VMR9Impl_create },
|
||||
{ &CLSID_VideoRendererDefault, VideoRendererDefault_create },
|
||||
{ &CLSID_DSoundRender, DSoundRender_create },
|
||||
{ &CLSID_AudioRender, DSoundRender_create },
|
||||
{ &CLSID_DSoundRender, dsound_render_create },
|
||||
{ &CLSID_AudioRender, dsound_render_create },
|
||||
{ &CLSID_AVIDec, AVIDec_create },
|
||||
{ &CLSID_SystemClock, QUARTZ_CreateSystemClock },
|
||||
{ &CLSID_ACMWrapper, ACMWrapper_create },
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
|
||||
#define BYTES_FROM_MEDIATIME(time) ((time) / 10000000)
|
||||
|
||||
HRESULT dsound_render_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN;
|
||||
HRESULT filter_graph_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN;
|
||||
HRESULT filter_graph_no_thread_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN;
|
||||
HRESULT FilterMapper2_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
|
||||
|
@ -47,7 +48,6 @@ HRESULT FilterMapper_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
|
|||
HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||
HRESULT StdMemAllocator_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||
HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||
HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||
HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||
HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||
HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue