From f9cccaa3def66a288117a7204ba2ab1b1383c579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Tue, 5 Nov 2013 23:59:54 +0100 Subject: [PATCH] quartz: Add Video Mixing Renderer 7. --- dlls/quartz/main.c | 1 + dlls/quartz/quartz_private.h | 1 + dlls/quartz/quartz_strmif.idl | 7 +++ dlls/quartz/regsvr.c | 12 +++++ dlls/quartz/vmr9.c | 83 +++++++++++++++++++++-------------- include/uuids.h | 1 + 6 files changed, 73 insertions(+), 32 deletions(-) diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c index 2a4071c5603..81f9ab857fb 100644 --- a/dlls/quartz/main.c +++ b/dlls/quartz/main.c @@ -75,6 +75,7 @@ static const struct object_creation_info object_creation[] = { &CLSID_MPEG1Splitter, MPEGSplitter_create }, { &CLSID_VideoRenderer, VideoRenderer_create }, { &CLSID_NullRenderer, NullRenderer_create }, + { &CLSID_VideoMixingRenderer, VMR7Impl_create }, { &CLSID_VideoMixingRenderer9, VMR9Impl_create }, { &CLSID_VideoRendererDefault, VideoRendererDefault_create }, { &CLSID_DSoundRender, DSoundRender_create }, diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index af0300e8005..7cad3a75640 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -54,6 +54,7 @@ HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT WAVEParser_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; +HRESULT VMR7Impl_create(IUnknown *pUnkOuter, LPVOID *ppv) DECLSPEC_HIDDEN; HRESULT VMR9Impl_create(IUnknown *pUnkOuter, LPVOID *ppv) DECLSPEC_HIDDEN; HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG nMonikerCount, IEnumMoniker ** ppEnum) DECLSPEC_HIDDEN; diff --git a/dlls/quartz/quartz_strmif.idl b/dlls/quartz/quartz_strmif.idl index 7ad8a7b88ad..44dc668ae51 100644 --- a/dlls/quartz/quartz_strmif.idl +++ b/dlls/quartz/quartz_strmif.idl @@ -154,6 +154,13 @@ coclass ACMWrapper { interface IBaseFilter; } ] coclass WAVEParser { interface IBaseFilter; } +[ + helpstring("Video Mixing Renderer"), + threading(both), + uuid(b87beb7b-8d29-423f-ae4d-6582c10175ac) +] +coclass VideoMixingRenderer { interface IBaseFilter; } + [ helpstring("Video Mixing Renderer 9"), threading(both), diff --git a/dlls/quartz/regsvr.c b/dlls/quartz/regsvr.c index d5adf8a9da2..6afce5a3e36 100644 --- a/dlls/quartz/regsvr.c +++ b/dlls/quartz/regsvr.c @@ -952,6 +952,18 @@ static struct regsvr_filter const filter_list[] = { { 0xFFFFFFFF }, } }, + { &CLSID_VideoMixingRenderer, + &CLSID_LegacyAmFilterCategory, + {'V','i','d','e','o',' ','M','i','x','i','n','g',' ','R','e','n','d','e','r','e','r',0}, + 0x200000, + { { REG_PINFLAG_B_RENDERER, + { { &MEDIATYPE_Video, &GUID_NULL }, + { NULL } + }, + }, + { 0xFFFFFFFF }, + } + }, { &CLSID_VideoMixingRenderer9, &CLSID_LegacyAmFilterCategory, {'V','i','d','e','o',' ','M','i','x','i','n','g',' ','R','e','n','d','e','r','e','r',' ','9',0}, diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 09e595d077e..1c72b86e971 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -880,7 +880,7 @@ static ULONG WINAPI VMR9_Release(IBaseFilter * iface) return 0; } -static const IBaseFilterVtbl VMR9_Vtbl = +static const IBaseFilterVtbl VMR_Vtbl = { VMR9_QueryInterface, VMR9_AddRef, @@ -1581,67 +1581,86 @@ static const IVMRSurfaceAllocatorNotify9Vtbl IVMRSurfaceAllocatorNotify9_Vtbl = VMR9SurfaceAllocatorNotify_NotifyEvent }; -HRESULT VMR9Impl_create(IUnknown * outer_unk, LPVOID * ppv) +static HRESULT vmr_create(IUnknown *outer_unk, LPVOID *ppv, const CLSID *clsid) { HRESULT hr; - struct quartz_vmr* pVMR9; + struct quartz_vmr* pVMR; TRACE("(%p, %p)\n", outer_unk, ppv); *ppv = NULL; - pVMR9 = CoTaskMemAlloc(sizeof(struct quartz_vmr)); + pVMR = CoTaskMemAlloc(sizeof(struct quartz_vmr)); - pVMR9->hD3d9 = LoadLibraryA("d3d9.dll"); - if (!pVMR9->hD3d9 ) + pVMR->hD3d9 = LoadLibraryA("d3d9.dll"); + if (!pVMR->hD3d9 ) { WARN("Could not load d3d9.dll\n"); - CoTaskMemFree(pVMR9); + CoTaskMemFree(pVMR); return VFW_E_DDRAW_CAPS_NOT_SUITABLE; } - pVMR9->outer_unk = outer_unk; - pVMR9->bUnkOuterValid = FALSE; - pVMR9->bAggregatable = FALSE; - pVMR9->IUnknown_inner.lpVtbl = &IInner_VTable; - pVMR9->IAMFilterMiscFlags_iface.lpVtbl = &IAMFilterMiscFlags_Vtbl; + pVMR->outer_unk = outer_unk; + pVMR->bUnkOuterValid = FALSE; + pVMR->bAggregatable = FALSE; + pVMR->IUnknown_inner.lpVtbl = &IInner_VTable; + pVMR->IAMFilterMiscFlags_iface.lpVtbl = &IAMFilterMiscFlags_Vtbl; - pVMR9->mode = 0; - pVMR9->allocator_d3d9_dev = NULL; - pVMR9->allocator_mon= NULL; - pVMR9->num_surfaces = pVMR9->cur_surface = 0; - pVMR9->allocator = NULL; - pVMR9->presenter = NULL; - pVMR9->hWndClippingWindow = NULL; - pVMR9->IVMRFilterConfig9_iface.lpVtbl = &VMR9_FilterConfig_Vtbl; - pVMR9->IVMRWindowlessControl9_iface.lpVtbl = &VMR9_WindowlessControl_Vtbl; - pVMR9->IVMRSurfaceAllocatorNotify9_iface.lpVtbl = &IVMRSurfaceAllocatorNotify9_Vtbl; + pVMR->mode = 0; + pVMR->allocator_d3d9_dev = NULL; + pVMR->allocator_mon= NULL; + pVMR->num_surfaces = pVMR->cur_surface = 0; + pVMR->allocator = NULL; + pVMR->presenter = NULL; + pVMR->hWndClippingWindow = NULL; + pVMR->IVMRFilterConfig9_iface.lpVtbl = &VMR9_FilterConfig_Vtbl; + pVMR->IVMRWindowlessControl9_iface.lpVtbl = &VMR9_WindowlessControl_Vtbl; + pVMR->IVMRSurfaceAllocatorNotify9_iface.lpVtbl = &IVMRSurfaceAllocatorNotify9_Vtbl; + + if (IsEqualGUID(clsid, &CLSID_VideoMixingRenderer)) + hr = BaseRenderer_Init(&pVMR->renderer, &VMR_Vtbl, outer_unk, &CLSID_VideoMixingRenderer, + (DWORD_PTR)(__FILE__ ": VMR7Impl.csFilter"), &BaseFuncTable); + else + hr = BaseRenderer_Init(&pVMR->renderer, &VMR_Vtbl, outer_unk, &CLSID_VideoMixingRenderer9, + (DWORD_PTR)(__FILE__ ": VMR9Impl.csFilter"), &BaseFuncTable); - hr = BaseRenderer_Init(&pVMR9->renderer, &VMR9_Vtbl, outer_unk, &CLSID_VideoMixingRenderer9, (DWORD_PTR)(__FILE__ ": VMR9Impl.csFilter"), &BaseFuncTable); if (FAILED(hr)) goto fail; - hr = BaseControlWindow_Init(&pVMR9->baseControlWindow, &IVideoWindow_VTable, &pVMR9->renderer.filter, &pVMR9->renderer.filter.csFilter, &pVMR9->renderer.pInputPin->pin, &renderer_BaseWindowFuncTable); + hr = BaseControlWindow_Init(&pVMR->baseControlWindow, &IVideoWindow_VTable, &pVMR->renderer.filter, + &pVMR->renderer.filter.csFilter, &pVMR->renderer.pInputPin->pin, + &renderer_BaseWindowFuncTable); if (FAILED(hr)) goto fail; - hr = BaseControlVideo_Init(&pVMR9->baseControlVideo, &IBasicVideo_VTable, &pVMR9->renderer.filter, &pVMR9->renderer.filter.csFilter, &pVMR9->renderer.pInputPin->pin, &renderer_BaseControlVideoFuncTable); + hr = BaseControlVideo_Init(&pVMR->baseControlVideo, &IBasicVideo_VTable, &pVMR->renderer.filter, + &pVMR->renderer.filter.csFilter, &pVMR->renderer.pInputPin->pin, + &renderer_BaseControlVideoFuncTable); if (FAILED(hr)) goto fail; - *ppv = (LPVOID)pVMR9; - ZeroMemory(&pVMR9->source_rect, sizeof(RECT)); - ZeroMemory(&pVMR9->target_rect, sizeof(RECT)); - TRACE("Created at %p\n", pVMR9); + *ppv = (LPVOID)pVMR; + ZeroMemory(&pVMR->source_rect, sizeof(RECT)); + ZeroMemory(&pVMR->target_rect, sizeof(RECT)); + TRACE("Created at %p\n", pVMR); return hr; fail: - BaseRendererImpl_Release(&pVMR9->renderer.filter.IBaseFilter_iface); - CloseHandle(pVMR9->hD3d9); - CoTaskMemFree(pVMR9); + BaseRendererImpl_Release(&pVMR->renderer.filter.IBaseFilter_iface); + CloseHandle(pVMR->hD3d9); + CoTaskMemFree(pVMR); return hr; } +HRESULT VMR7Impl_create(IUnknown *outer_unk, LPVOID *ppv) +{ + return vmr_create(outer_unk, ppv, &CLSID_VideoMixingRenderer); +} + +HRESULT VMR9Impl_create(IUnknown *outer_unk, LPVOID *ppv) +{ + return vmr_create(outer_unk, ppv, &CLSID_VideoMixingRenderer9); +} static HRESULT WINAPI VMR9_ImagePresenter_QueryInterface(IVMRImagePresenter9 *iface, REFIID riid, LPVOID * ppv) diff --git a/include/uuids.h b/include/uuids.h index 376cca748fc..c385f3e9148 100644 --- a/include/uuids.h +++ b/include/uuids.h @@ -275,6 +275,7 @@ OUR_GUID_ENTRY(CLSID_VideoProcAmpPropertyPage, 0x71f96464, 0x78f3, 0x11d0, OUR_GUID_ENTRY(CLSID_CameraControlPropertyPage, 0x71f96465, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x00, 0xa0, 0xc9, 0x11, 0x89, 0x56) OUR_GUID_ENTRY(CLSID_AnalogVideoDecoderPropertyPage, 0x71f96466, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x00, 0xa0, 0xc9, 0x11, 0x89, 0x56) OUR_GUID_ENTRY(CLSID_VideoStreamConfigPropertyPage, 0x71f96467, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x00, 0xa0, 0xc9, 0x11, 0x89, 0x56) +OUR_GUID_ENTRY(CLSID_VideoMixingRenderer, 0xb87beb7b, 0x8d29, 0x423f, 0xae, 0x4d, 0x65, 0x82, 0xc1, 0x01, 0x75, 0xac) OUR_GUID_ENTRY(CLSID_VideoMixingRenderer9, 0x51b4abf3, 0x748f, 0x4e3b, 0xa2, 0x76, 0xc8, 0x28, 0x33, 0x0e, 0x92, 0x6a) #undef OUR_GUID_ENTRY