It doesn't check for hardware acceleration for the adapter that we're actually going to use, and we don't actually care what the swapchain format is anyway. If the device doesn't support hardware acceleration we'll fail later when trying to actually create it.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/quartz/vmr9.c | 20 -------------------- 1 file changed, 20 deletions(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 4bde811c6d7..f992f1136c7 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -2987,8 +2987,6 @@ static IDirect3D9 *init_d3d9(HMODULE d3d9_handle) static HRESULT VMR9DefaultAllocatorPresenterImpl_create(struct quartz_vmr *parent, LPVOID * ppv) { struct default_presenter *object; - HRESULT hr = S_OK; - int i;
if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY; @@ -3001,24 +2999,6 @@ static HRESULT VMR9DefaultAllocatorPresenterImpl_create(struct quartz_vmr *paren return VFW_E_DDRAW_CAPS_NOT_SUITABLE; }
- i = 0; - do - { - D3DDISPLAYMODE mode; - - hr = IDirect3D9_EnumAdapterModes(object->d3d9_ptr, i++, D3DFMT_X8R8G8B8, 0, &mode); - if (hr == D3DERR_INVALIDCALL) break; /* out of adapters */ - } while (FAILED(hr)); - if (FAILED(hr)) - ERR("HR: %08x\n", hr); - if (hr == D3DERR_NOTAVAILABLE) - { - ERR("Format not supported\n"); - IDirect3D9_Release(object->d3d9_ptr); - free(object); - return VFW_E_DDRAW_CAPS_NOT_SUITABLE; - } - object->IVMRImagePresenter9_iface.lpVtbl = &VMR9_ImagePresenter; object->IVMRSurfaceAllocator9_iface.lpVtbl = &VMR9_SurfaceAllocator;
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/quartz/vmr9.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index f992f1136c7..78e47bbb908 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -2778,21 +2778,15 @@ static ULONG WINAPI VMR9_SurfaceAllocator_Release(IVMRSurfaceAllocator9 *iface) return IVMRImagePresenter9_Release(&presenter->IVMRImagePresenter9_iface); }
-static HRESULT VMR9_SurfaceAllocator_SetAllocationSettings(struct default_presenter *This, VMR9AllocationInfo *allocinfo) +static void adjust_surface_size(const D3DCAPS9 *caps, VMR9AllocationInfo *allocinfo) { - D3DCAPS9 caps; UINT width, height; - HRESULT hr;
+ /* There are no restrictions on the size of offscreen surfaces. */ if (!(allocinfo->dwFlags & VMR9AllocFlag_TextureSurface)) - /* Only needed for texture surfaces */ - return S_OK; + return;
- hr = IDirect3DDevice9_GetDeviceCaps(This->d3d9_dev, &caps); - if (FAILED(hr)) - return hr; - - if (!(caps.TextureCaps & D3DPTEXTURECAPS_POW2) || (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)) + if (!(caps->TextureCaps & D3DPTEXTURECAPS_POW2) || (caps->TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)) { width = allocinfo->dwWidth; height = allocinfo->dwHeight; @@ -2808,7 +2802,7 @@ static HRESULT VMR9_SurfaceAllocator_SetAllocationSettings(struct default_presen FIXME("NPOW2 support missing, not using proper surfaces!\n"); }
- if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY) + if (caps->TextureCaps & D3DPTEXTURECAPS_SQUAREONLY) { if (height > width) width = height; @@ -2819,8 +2813,6 @@ static HRESULT VMR9_SurfaceAllocator_SetAllocationSettings(struct default_presen
allocinfo->dwHeight = height; allocinfo->dwWidth = width; - - return hr; }
static UINT d3d9_adapter_from_hwnd(IDirect3D9 *d3d9, HWND hwnd, HMONITOR *mon_out) @@ -2899,19 +2891,13 @@ static HRESULT WINAPI VMR9_SurfaceAllocator_InitializeDevice(IVMRSurfaceAllocato if (!(This->d3d9_surfaces = calloc(*numbuffers, sizeof(IDirect3DSurface9 *)))) return E_OUTOFMEMORY;
- hr = VMR9_SurfaceAllocator_SetAllocationSettings(This, info); - if (FAILED(hr)) - ERR("Setting allocation settings failed: %08x\n", hr); - - if (SUCCEEDED(hr)) - { - hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(This->SurfaceAllocatorNotify, info, numbuffers, This->d3d9_surfaces); - if (FAILED(hr)) - ERR("Allocating surfaces failed: %08x\n", hr); - } + adjust_surface_size(&caps, info);
+ hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(This->SurfaceAllocatorNotify, + info, numbuffers, This->d3d9_surfaces); if (FAILED(hr)) { + ERR("Failed to allocate surfaces, hr %#x.\n", hr); IVMRSurfaceAllocator9_TerminateDevice(This->pVMR9->allocator, This->pVMR9->cookie); return hr; }
From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/quartz/filtergraph.c | 57 +++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 26 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index d20687c1b38..a98b0360e20 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -1650,47 +1650,52 @@ static ULONG WINAPI MediaControl_Release(IMediaControl *iface)
}
-/*** IDispatch methods ***/ -static HRESULT WINAPI MediaControl_GetTypeInfoCount(IMediaControl *iface, UINT *pctinfo) +static HRESULT WINAPI MediaControl_GetTypeInfoCount(IMediaControl *iface, UINT *count) { - struct filter_graph *This = impl_from_IMediaControl(iface); - - TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo); - + TRACE("iface %p, count %p.\n", iface, count); + *count = 1; return S_OK; }
-static HRESULT WINAPI MediaControl_GetTypeInfo(IMediaControl *iface, UINT iTInfo, LCID lcid, - ITypeInfo **ppTInfo) +static HRESULT WINAPI MediaControl_GetTypeInfo(IMediaControl *iface, UINT index, + LCID lcid, ITypeInfo **typeinfo) { - struct filter_graph *This = impl_from_IMediaControl(iface); - - TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo); - - return S_OK; + TRACE("iface %p, index %u, lcid %#x, typeinfo %p.\n", iface, index, lcid, typeinfo); + return strmbase_get_typeinfo(IMediaControl_tid, typeinfo); }
-static HRESULT WINAPI MediaControl_GetIDsOfNames(IMediaControl *iface, REFIID riid, - LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +static HRESULT WINAPI MediaControl_GetIDsOfNames(IMediaControl *iface, REFIID iid, + LPOLESTR *names, UINT count, LCID lcid, DISPID *ids) { - struct filter_graph *This = impl_from_IMediaControl(iface); + ITypeInfo *typeinfo; + HRESULT hr;
- TRACE("(%p/%p)->(%s, %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), rgszNames, - cNames, lcid, rgDispId); + TRACE("iface %p, iid %s, names %p, count %u, lcid %#x, ids %p.\n", + iface, debugstr_guid(iid), names, count, lcid, ids);
- return S_OK; + if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaControl_tid, &typeinfo))) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids); + ITypeInfo_Release(typeinfo); + } + return hr; }
-static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface, DISPID dispIdMember, REFIID riid, - LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExepInfo, - UINT *puArgErr) +static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface, DISPID id, REFIID iid, LCID lcid, + WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg) { - struct filter_graph *This = impl_from_IMediaControl(iface); + ITypeInfo *typeinfo; + HRESULT hr;
- TRACE("(%p/%p)->(%d, %s, %d, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, - debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr); + TRACE("iface %p, id %d, iid %s, lcid %#x, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n", + iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
- return S_OK; + if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaControl_tid, &typeinfo))) + { + hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg); + ITypeInfo_Release(typeinfo); + } + return hr; }
static void update_render_count(struct filter_graph *graph)
From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/quartz/filtergraph.c | 49 ++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 13 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index a98b0360e20..7e3d9fac16a 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -2543,29 +2543,52 @@ static ULONG WINAPI MediaPosition_Release(IMediaPosition *iface) return IUnknown_Release(graph->outer_unk); }
-/*** IDispatch methods ***/ -static HRESULT WINAPI MediaPosition_GetTypeInfoCount(IMediaPosition *iface, UINT* pctinfo) +static HRESULT WINAPI MediaPosition_GetTypeInfoCount(IMediaPosition *iface, UINT *count) { - FIXME("(%p) stub!\n", iface); - return E_NOTIMPL; + TRACE("iface %p, count %p.\n", iface, count); + *count = 1; + return S_OK; }
-static HRESULT WINAPI MediaPosition_GetTypeInfo(IMediaPosition *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +static HRESULT WINAPI MediaPosition_GetTypeInfo(IMediaPosition *iface, UINT index, + LCID lcid, ITypeInfo **typeinfo) { - FIXME("(%p) stub!\n", iface); - return E_NOTIMPL; + TRACE("iface %p, index %u, lcid %#x, typeinfo %p.\n", iface, index, lcid, typeinfo); + return strmbase_get_typeinfo(IMediaPosition_tid, typeinfo); }
-static HRESULT WINAPI MediaPosition_GetIDsOfNames(IMediaPosition* iface, REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId) +static HRESULT WINAPI MediaPosition_GetIDsOfNames(IMediaPosition *iface, REFIID iid, + LPOLESTR *names, UINT count, LCID lcid, DISPID *ids) { - FIXME("(%p) stub!\n", iface); - return E_NOTIMPL; + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("iface %p, iid %s, names %p, count %u, lcid %#x, ids %p.\n", + iface, debugstr_guid(iid), names, count, lcid, ids); + + if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaPosition_tid, &typeinfo))) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids); + ITypeInfo_Release(typeinfo); + } + return hr; }
-static HRESULT WINAPI MediaPosition_Invoke(IMediaPosition* iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) +static HRESULT WINAPI MediaPosition_Invoke(IMediaPosition *iface, DISPID id, REFIID iid, LCID lcid, + WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg) { - FIXME("(%p) stub!\n", iface); - return E_NOTIMPL; + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("iface %p, id %d, iid %s, lcid %#x, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n", + iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg); + + if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaPosition_tid, &typeinfo))) + { + hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg); + ITypeInfo_Release(typeinfo); + } + return hr; }
static HRESULT ConvertFromREFTIME(IMediaSeeking *seek, REFTIME time_in, LONGLONG *time_out)
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/quartz/filtergraph.c | 58 ++++++++++++++++++--------------- dlls/quartz/tests/filtergraph.c | 35 ++++++++++++++++++++ 2 files changed, 66 insertions(+), 27 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 7e3d9fac16a..4132ffa5b2f 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -4733,50 +4733,54 @@ static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface) return IUnknown_Release(graph->outer_unk); }
-/*** IDispatch methods ***/ -static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface, UINT *pctinfo) +static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface, UINT *count) { - struct filter_graph *This = impl_from_IMediaEventEx(iface); - - TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo); - + TRACE("iface %p, count %p.\n", iface, count); + *count = 1; return S_OK; }
-static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface, UINT iTInfo, LCID lcid, - ITypeInfo **ppTInfo) +static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface, UINT index, + LCID lcid, ITypeInfo **typeinfo) { - struct filter_graph *This = impl_from_IMediaEventEx(iface); - - TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo); - - return S_OK; + TRACE("iface %p, index %u, lcid %#x, typeinfo %p.\n", iface, index, lcid, typeinfo); + return strmbase_get_typeinfo(IMediaEvent_tid, typeinfo); }
-static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface, REFIID riid, - LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface, REFIID iid, + LPOLESTR *names, UINT count, LCID lcid, DISPID *ids) { - struct filter_graph *This = impl_from_IMediaEventEx(iface); + ITypeInfo *typeinfo; + HRESULT hr;
- TRACE("(%p/%p)->(%s, %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), rgszNames, - cNames, lcid, rgDispId); + TRACE("iface %p, iid %s, names %p, count %u, lcid %#x, ids %p.\n", + iface, debugstr_guid(iid), names, count, lcid, ids);
- return S_OK; + if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaEvent_tid, &typeinfo))) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids); + ITypeInfo_Release(typeinfo); + } + return hr; }
-static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface, DISPID dispIdMember, REFIID riid, - LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExepInfo, - UINT *puArgErr) +static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface, DISPID id, REFIID iid, LCID lcid, + WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg) { - struct filter_graph *This = impl_from_IMediaEventEx(iface); + ITypeInfo *typeinfo; + HRESULT hr;
- TRACE("(%p/%p)->(%d, %s, %d, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, - debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr); + TRACE("iface %p, id %d, iid %s, lcid %#x, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n", + iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
- return S_OK; + if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaEvent_tid, &typeinfo))) + { + hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg); + ITypeInfo_Release(typeinfo); + } + return hr; }
-/*** IMediaEvent methods ***/ static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface, OAEVENT *event) { struct filter_graph *graph = impl_from_IMediaEventEx(iface); diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 620a1a56bad..bd086445a3b 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -5663,6 +5663,40 @@ static void test_events(void) SysFreeString(status); }
+static void test_event_dispatch(void) +{ + IFilterGraph2 *graph = create_graph(); + IMediaEventEx *event_ex; + ITypeInfo *typeinfo; + IMediaEvent *event; + TYPEATTR *typeattr; + unsigned int count; + HRESULT hr; + ULONG ref; + + IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&event); + IFilterGraph2_QueryInterface(graph, &IID_IMediaEventEx, (void **)&event_ex); + ok((void *)event == event_ex, "Interface pointers didn't match.\n"); + IMediaEventEx_Release(event_ex); + + hr = IMediaEvent_GetTypeInfoCount(event, &count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + + hr = IMediaEvent_GetTypeInfo(event, 0, 0, &typeinfo); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(typeattr->typekind == TKIND_DISPATCH, "Got kind %u.\n", typeattr->typekind); + ok(IsEqualGUID(&typeattr->guid, &IID_IMediaEvent), "Got IID %s.\n", debugstr_guid(&typeattr->guid)); + ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr); + ITypeInfo_Release(typeinfo); + + IMediaEvent_Release(event); + ref = IFilterGraph2_Release(graph); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(filtergraph) { CoInitializeEx(NULL, COINIT_MULTITHREADED); @@ -5690,6 +5724,7 @@ START_TEST(filtergraph) test_autoplug_uyvy(); test_set_notify_flags(); test_events(); + test_event_dispatch();
CoUninitialize(); test_render_with_multithread();