Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/mixer.c | 11 ++++++++++- dlls/evr/tests/evr.c | 31 +++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index e19520fa7ed..9227e6a1777 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -686,7 +686,16 @@ static HRESULT WINAPI video_mixer_transform_SetInputType(IMFTransform *iface, DW &count, &guids))) { if (SUCCEEDED(hr = video_mixer_collect_output_types(mixer, &video_desc, service, count, guids))) - FIXME("Set input type.\n"); + { + GUID subtype = { 0 }; + + if (FAILED(hr = IMFMediaType_GetGUID(media_type, &MF_MT_SUBTYPE, &subtype))) + WARN("Failed to get subtype %#x.\n", hr); + + if (SUCCEEDED(hr = MFCreateVideoMediaTypeFromSubtype(&subtype, &mixer->inputs[0].media_type))) + hr = IMFMediaType_CopyAllItems(media_type, (IMFAttributes *)mixer->inputs[0].media_type); + + } CoTaskMemFree(guids); } } diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index bf33051d6e1..e6f6251be60 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -896,17 +896,15 @@ static void test_default_mixer_type_negotiation(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); -if (hr == S_OK) -{ ok(media_type != (IMFMediaType *)video_type, "Unexpected media type instance.\n"); + hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type2); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(media_type == media_type2, "Unexpected media type instance.\n"); IMFMediaType_Release(media_type); IMFMediaType_Release(media_type2); -} + hr = IMFTransform_QueryInterface(transform, &IID_IMFVideoProcessor, (void **)&processor); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@@ -919,31 +917,24 @@ todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - if (SUCCEEDED(hr)) - { - ok(media_type != (IMFMediaType *)video_type, "Unexpected pointer.\n"); - hr = IMFMediaType_QueryInterface(media_type, &IID_IMFVideoMediaType, (void **)&unk); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - IUnknown_Release(unk); - IMFMediaType_Release(media_type); - } + ok(media_type != (IMFMediaType *)video_type, "Unexpected pointer.\n"); + hr = IMFMediaType_QueryInterface(media_type, &IID_IMFVideoMediaType, (void **)&unk); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IUnknown_Release(unk); + IMFMediaType_Release(media_type);
hr = IMFVideoProcessor_GetAvailableVideoProcessorModes(processor, &count, &guids); todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
- if (SUCCEEDED(hr)) - { - hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - IMFMediaType_Release(media_type); - } + hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); +todo_wine + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IMFMediaType_Release(media_type);
hr = IMFVideoProcessor_GetVideoProcessorMode(processor, &guid); todo_wine
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/mixer.c | 76 ++++++++++++++++++++++++++++++++++++++++++++ dlls/evr/tests/evr.c | 4 +++ 2 files changed, 80 insertions(+)
diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index 9227e6a1777..4ada26d074f 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -61,6 +61,7 @@ struct video_mixer IMFVideoPositionMapper IMFVideoPositionMapper_iface; IMFVideoProcessor IMFVideoProcessor_iface; IMFAttributes IMFAttributes_iface; + IMFQualityAdvise IMFQualityAdvise_iface; IUnknown IUnknown_inner; IUnknown *outer_unk; LONG refcount; @@ -129,6 +130,11 @@ static struct video_mixer *impl_from_IMFAttributes(IMFAttributes *iface) return CONTAINING_RECORD(iface, struct video_mixer, IMFAttributes_iface); }
+static struct video_mixer *impl_from_IMFQualityAdvise(IMFQualityAdvise *iface) +{ + return CONTAINING_RECORD(iface, struct video_mixer, IMFQualityAdvise_iface); +} + static int video_mixer_compare_input_id(const void *a, const void *b) { const unsigned int *key = a; @@ -217,6 +223,10 @@ static HRESULT WINAPI video_mixer_inner_QueryInterface(IUnknown *iface, REFIID r { *obj = &mixer->IMFAttributes_iface; } + else if (IsEqualIID(riid, &IID_IMFQualityAdvise)) + { + *obj = &mixer->IMFQualityAdvise_iface; + } else { WARN("Unsupported interface %s.\n", debugstr_guid(riid)); @@ -1685,6 +1695,71 @@ static const IMFAttributesVtbl video_mixer_attributes_vtbl = video_mixer_attributes_CopyAllItems };
+static HRESULT WINAPI video_mixer_quality_advise_QueryInterface(IMFQualityAdvise *iface, REFIID riid, void **out) +{ + struct video_mixer *mixer = impl_from_IMFQualityAdvise(iface); + return IMFTransform_QueryInterface(&mixer->IMFTransform_iface, riid, out); +} + +static ULONG WINAPI video_mixer_quality_advise_AddRef(IMFQualityAdvise *iface) +{ + struct video_mixer *mixer = impl_from_IMFQualityAdvise(iface); + return IMFTransform_AddRef(&mixer->IMFTransform_iface); +} + +static ULONG WINAPI video_mixer_quality_Release(IMFQualityAdvise *iface) +{ + struct video_mixer *mixer = impl_from_IMFQualityAdvise(iface); + return IMFTransform_Release(&mixer->IMFTransform_iface); +} + +static HRESULT WINAPI video_mixer_quality_advise_SetDropMode(IMFQualityAdvise *iface, MF_QUALITY_DROP_MODE mode) +{ + FIXME("%p, %u.\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_mixer_quality_advise_SetQualityLevel(IMFQualityAdvise *iface, MF_QUALITY_LEVEL level) +{ + FIXME("%p, %u.\n", iface, level); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_mixer_quality_advise_GetDropMode(IMFQualityAdvise *iface, MF_QUALITY_DROP_MODE *mode) +{ + FIXME("%p, %p.\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_mixer_quality_advise_GetQualityLevel(IMFQualityAdvise *iface, MF_QUALITY_LEVEL *level) +{ + FIXME("%p, %p.\n", iface, level); + + return E_NOTIMPL; +} + +static HRESULT WINAPI video_mixer_quality_advise_DropTime(IMFQualityAdvise *iface, LONGLONG interval) +{ + FIXME("%p, %s.\n", iface, wine_dbgstr_longlong(interval)); + + return E_NOTIMPL; +} + +static const IMFQualityAdviseVtbl video_mixer_quality_advise_vtbl = +{ + video_mixer_quality_advise_QueryInterface, + video_mixer_quality_advise_AddRef, + video_mixer_quality_Release, + video_mixer_quality_advise_SetDropMode, + video_mixer_quality_advise_SetQualityLevel, + video_mixer_quality_advise_GetDropMode, + video_mixer_quality_advise_GetQualityLevel, + video_mixer_quality_advise_DropTime, +}; + HRESULT WINAPI MFCreateVideoMixer(IUnknown *owner, REFIID riid_device, REFIID riid, void **obj) { TRACE("%p, %s, %s, %p.\n", owner, debugstr_guid(riid_device), debugstr_guid(riid), obj); @@ -1715,6 +1790,7 @@ HRESULT evr_mixer_create(IUnknown *outer, void **out) object->IMFVideoPositionMapper_iface.lpVtbl = &video_mixer_position_mapper_vtbl; object->IMFVideoProcessor_iface.lpVtbl = &video_mixer_processor_vtbl; object->IMFAttributes_iface.lpVtbl = &video_mixer_attributes_vtbl; + object->IMFQualityAdvise_iface.lpVtbl = &video_mixer_quality_advise_vtbl; object->IUnknown_inner.lpVtbl = &video_mixer_inner_vtbl; object->outer_unk = outer ? outer : &object->IUnknown_inner; object->refcount = 1; diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index e6f6251be60..7fa28e75229 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -438,6 +438,10 @@ static void test_default_mixer(void) hr = MFCreateVideoMixer(NULL, &IID_IDirect3DDevice9, &IID_IMFTransform, (void **)&transform); ok(hr == S_OK, "Failed to create default mixer, hr %#x.\n", hr);
+ hr = IMFTransform_QueryInterface(transform, &IID_IMFQualityAdvise, (void **)&unk); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IUnknown_Release(unk); + hr = IMFTransform_QueryInterface(transform, &IID_IMFTopologyServiceLookupClient, (void **)&unk); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); IUnknown_Release(unk);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/presenter.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ dlls/evr/tests/evr.c | 4 ++++ 2 files changed, 48 insertions(+)
diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c index a7da0704927..5e458f72f11 100644 --- a/dlls/evr/presenter.c +++ b/dlls/evr/presenter.c @@ -46,6 +46,7 @@ struct video_presenter IMFTopologyServiceLookupClient IMFTopologyServiceLookupClient_iface; IMFVideoDisplayControl IMFVideoDisplayControl_iface; IMFRateSupport IMFRateSupport_iface; + IMFGetService IMFGetService_iface; IUnknown IUnknown_inner; IUnknown *outer_unk; LONG refcount; @@ -88,6 +89,11 @@ static struct video_presenter *impl_from_IMFRateSupport(IMFRateSupport *iface) return CONTAINING_RECORD(iface, struct video_presenter, IMFRateSupport_iface); }
+static struct video_presenter *impl_from_IMFGetService(IMFGetService *iface) +{ + return CONTAINING_RECORD(iface, struct video_presenter, IMFGetService_iface); +} + static HRESULT WINAPI video_presenter_inner_QueryInterface(IUnknown *iface, REFIID riid, void **obj) { struct video_presenter *presenter = impl_from_IUnknown(iface); @@ -119,6 +125,10 @@ static HRESULT WINAPI video_presenter_inner_QueryInterface(IUnknown *iface, REFI { *obj = &presenter->IMFRateSupport_iface; } + else if (IsEqualIID(riid, &IID_IMFGetService)) + { + *obj = &presenter->IMFGetService_iface; + } else { WARN("Unimplemented interface %s.\n", debugstr_guid(riid)); @@ -576,6 +586,39 @@ static const IMFRateSupportVtbl video_presenter_rate_support_vtbl = video_presenter_rate_support_IsRateSupported, };
+static HRESULT WINAPI video_presenter_getservice_QueryInterface(IMFGetService *iface, REFIID riid, void **obj) +{ + struct video_presenter *presenter = impl_from_IMFGetService(iface); + return IMFVideoPresenter_QueryInterface(&presenter->IMFVideoPresenter_iface, riid, obj); +} + +static ULONG WINAPI video_presenter_getservice_AddRef(IMFGetService *iface) +{ + struct video_presenter *presenter = impl_from_IMFGetService(iface); + return IMFVideoPresenter_AddRef(&presenter->IMFVideoPresenter_iface); +} + +static ULONG WINAPI video_presenter_getservice_Release(IMFGetService *iface) +{ + struct video_presenter *presenter = impl_from_IMFGetService(iface); + return IMFVideoPresenter_Release(&presenter->IMFVideoPresenter_iface); +} + +static HRESULT WINAPI video_presenter_getservice_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj) +{ + FIXME("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj); + + return E_NOTIMPL; +} + +static const IMFGetServiceVtbl video_presenter_getservice_vtbl = +{ + video_presenter_getservice_QueryInterface, + video_presenter_getservice_AddRef, + video_presenter_getservice_Release, + video_presenter_getservice_GetService, +}; + HRESULT WINAPI MFCreateVideoPresenter(IUnknown *owner, REFIID riid_device, REFIID riid, void **obj) { TRACE("%p, %s, %s, %p.\n", owner, debugstr_guid(riid_device), debugstr_guid(riid), obj); @@ -600,6 +643,7 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out) object->IMFTopologyServiceLookupClient_iface.lpVtbl = &video_presenter_service_client_vtbl; object->IMFVideoDisplayControl_iface.lpVtbl = &video_presenter_control_vtbl; object->IMFRateSupport_iface.lpVtbl = &video_presenter_rate_support_vtbl; + object->IMFGetService_iface.lpVtbl = &video_presenter_getservice_vtbl; object->IUnknown_inner.lpVtbl = &video_presenter_inner_vtbl; object->outer_unk = outer ? outer : &object->IUnknown_inner; object->refcount = 1; diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index 7fa28e75229..b59da51e475 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -1002,6 +1002,10 @@ static void test_default_presenter(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr); IUnknown_Release(unk);
+ hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFGetService, (void **)&unk); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IUnknown_Release(unk); + /* Rate support. */ hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFRateSupport, (void **)&rate_support); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/Makefile.in | 2 +- dlls/evr/presenter.c | 21 ++++++++++++++++++++- dlls/evr/tests/evr.c | 37 +++++++++++++++++++++++++++++++++++-- 3 files changed, 56 insertions(+), 4 deletions(-)
diff --git a/dlls/evr/Makefile.in b/dlls/evr/Makefile.in index c8178297dab..6d936d65b79 100644 --- a/dlls/evr/Makefile.in +++ b/dlls/evr/Makefile.in @@ -1,6 +1,6 @@ MODULE = evr.dll IMPORTLIB = evr -IMPORTS = mfuuid strmiids strmbase uuid dxguid ole32 oleaut32 +IMPORTS = mfuuid strmiids strmbase uuid dxguid ole32 oleaut32 dxva2 DELAYIMPORTS = mfplat
EXTRADLLFLAGS = -mno-cygwin diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c index 5e458f72f11..b60de4b82a1 100644 --- a/dlls/evr/presenter.c +++ b/dlls/evr/presenter.c @@ -22,6 +22,7 @@ #include "d3d9.h" #include "mfapi.h" #include "mferror.h" +#include "dxva2api.h"
#include "evr_classes.h" #include "evr_private.h" @@ -55,6 +56,8 @@ struct video_presenter IMFClock *clock; IMediaEventSink *event_sink;
+ IDirect3DDeviceManager9 *device_manager; + UINT reset_token; unsigned int state; CRITICAL_SECTION cs; }; @@ -174,6 +177,8 @@ static ULONG WINAPI video_presenter_inner_Release(IUnknown *iface) { video_presenter_clear_container(presenter); DeleteCriticalSection(&presenter->cs); + if (presenter->device_manager) + IDirect3DDeviceManager9_Release(presenter->device_manager); heap_free(presenter); }
@@ -606,7 +611,14 @@ static ULONG WINAPI video_presenter_getservice_Release(IMFGetService *iface)
static HRESULT WINAPI video_presenter_getservice_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj) { - FIXME("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj); + struct video_presenter *presenter = impl_from_IMFGetService(iface); + + TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj); + + if (IsEqualGUID(&MR_VIDEO_ACCELERATION_SERVICE, service)) + return IDirect3DDeviceManager9_QueryInterface(presenter->device_manager, riid, obj); + + FIXME("Unimplemented service %s.\n", debugstr_guid(service));
return E_NOTIMPL; } @@ -634,6 +646,7 @@ HRESULT WINAPI MFCreateVideoPresenter(IUnknown *owner, REFIID riid_device, REFII HRESULT evr_presenter_create(IUnknown *outer, void **out) { struct video_presenter *object; + HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object)))) return E_OUTOFMEMORY; @@ -649,6 +662,12 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out) object->refcount = 1; InitializeCriticalSection(&object->cs);
+ if (FAILED(hr = DXVA2CreateDirect3DDeviceManager9(&object->reset_token, &object->device_manager))) + { + IUnknown_Release(&object->IUnknown_inner); + return hr; + } + *out = &object->IUnknown_inner;
return S_OK; diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index b59da51e475..0dff691b59f 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -966,9 +966,14 @@ done:
static void test_default_presenter(void) { + D3DDEVICE_CREATION_PARAMETERS device_params = { 0 }; IMFVideoPresenter *presenter; IMFRateSupport *rate_support; + IDirect3DDevice9 *d3d_device; + IDirect3DDeviceManager9 *dm; IMFVideoDeviceID *deviceid; + IMFGetService *gs; + HANDLE handle; IUnknown *unk; float rate; HRESULT hr; @@ -1002,9 +1007,37 @@ static void test_default_presenter(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr); IUnknown_Release(unk);
- hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFGetService, (void **)&unk); + hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFGetService, (void **)&gs); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - IUnknown_Release(unk); + + hr = IMFGetService_GetService(gs, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, (void **)&dm); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IDirect3DDeviceManager9_OpenDeviceHandle(dm, &handle); +todo_wine + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IDirect3DDeviceManager9_LockDevice(dm, handle, &d3d_device, FALSE); +todo_wine + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + +if (SUCCEEDED(hr)) +{ + hr = IDirect3DDevice9_GetCreationParameters(d3d_device, &device_params); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(device_params.hFocusWindow == GetDesktopWindow(), "Unexpected window %p.\n", device_params.hFocusWindow); + + IDirect3DDevice9_Release(d3d_device); + + hr = IDirect3DDeviceManager9_UnlockDevice(dm, handle, FALSE); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IDirect3DDeviceManager9_CloseDeviceHandle(dm, handle); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); +} + IDirect3DDeviceManager9_Release(dm); + + IMFGetService_Release(gs);
/* Rate support. */ hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFRateSupport, (void **)&rate_support);