Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 369 +++++++++++++++++++++++++++++++++++++++++++-- dlls/mf/tests/mf.c | 32 +++- 2 files changed, 386 insertions(+), 15 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index 8fa4e33f4e3..4be59331b6b 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -56,12 +56,14 @@ struct video_stream IMFStreamSink IMFStreamSink_iface; IMFMediaTypeHandler IMFMediaTypeHandler_iface; IMFGetService IMFGetService_iface; + IMFAttributes IMFAttributes_iface; LONG refcount; unsigned int id; unsigned int flags; struct video_renderer *parent; IMFMediaEventQueue *event_queue; IMFVideoSampleAllocator *allocator; + IMFAttributes *attributes; CRITICAL_SECTION cs; };
@@ -162,6 +164,11 @@ static struct video_stream *impl_from_stream_IMFGetService(IMFGetService *iface) return CONTAINING_RECORD(iface, struct video_stream, IMFGetService_iface); }
+static struct video_stream *impl_from_stream_IMFAttributes(IMFAttributes *iface) +{ + return CONTAINING_RECORD(iface, struct video_stream, IMFAttributes_iface); +} + static void video_renderer_release_services(struct video_renderer *renderer) { IMFTopologyServiceLookupClient *lookup_client; @@ -189,8 +196,6 @@ static HRESULT WINAPI video_stream_sink_QueryInterface(IMFStreamSink *iface, REF
TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
- *obj = NULL; - if (IsEqualIID(riid, &IID_IMFStreamSink) || IsEqualIID(riid, &IID_IMFMediaEventGenerator) || IsEqualIID(riid, &IID_IUnknown)) @@ -205,16 +210,20 @@ static HRESULT WINAPI video_stream_sink_QueryInterface(IMFStreamSink *iface, REF { *obj = &stream->IMFGetService_iface; } - - if (*obj) + else if (IsEqualIID(riid, &IID_IMFAttributes)) { - IUnknown_AddRef((IUnknown *)*obj); - return S_OK; + *obj = &stream->IMFAttributes_iface; + } + else + { + WARN("Unsupported interface %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; }
- WARN("Unsupported interface %s.\n", debugstr_guid(riid)); - *obj = NULL; - return E_NOINTERFACE; + IUnknown_AddRef((IUnknown *)*obj); + + return S_OK; }
static ULONG WINAPI video_stream_sink_AddRef(IMFStreamSink *iface) @@ -236,6 +245,8 @@ static ULONG WINAPI video_stream_sink_Release(IMFStreamSink *iface) { if (stream->event_queue) IMFMediaEventQueue_Release(stream->event_queue); + if (stream->attributes) + IMFAttributes_Release(stream->attributes); if (stream->allocator) IMFVideoSampleAllocator_Release(stream->allocator); DeleteCriticalSection(&stream->cs); @@ -595,6 +606,342 @@ static const IMFGetServiceVtbl video_stream_get_service_vtbl = video_stream_get_service_GetService, };
+static HRESULT WINAPI video_stream_attributes_QueryInterface(IMFAttributes *iface, REFIID riid, void **obj) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + return IMFStreamSink_QueryInterface(&stream->IMFStreamSink_iface, riid, obj); +} + +static ULONG WINAPI video_stream_attributes_AddRef(IMFAttributes *iface) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + return IMFStreamSink_AddRef(&stream->IMFStreamSink_iface); +} + +static ULONG WINAPI video_stream_attributes_Release(IMFAttributes *iface) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + return IMFStreamSink_Release(&stream->IMFStreamSink_iface); +} + +static HRESULT WINAPI video_stream_attributes_GetItem(IMFAttributes *iface, REFGUID key, PROPVARIANT *value) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), value); + + return IMFAttributes_GetItem(stream->attributes, key, value); +} + +static HRESULT WINAPI video_stream_attributes_GetItemType(IMFAttributes *iface, REFGUID key, MF_ATTRIBUTE_TYPE *type) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), type); + + return IMFAttributes_GetItemType(stream->attributes, key, type); +} + +static HRESULT WINAPI video_stream_attributes_CompareItem(IMFAttributes *iface, REFGUID key, REFPROPVARIANT value, + BOOL *result) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p, %p.\n", iface, debugstr_guid(key), value, result); + + return IMFAttributes_CompareItem(stream->attributes, key, value, result); +} + +static HRESULT WINAPI video_stream_attributes_Compare(IMFAttributes *iface, IMFAttributes *theirs, + MF_ATTRIBUTES_MATCH_TYPE type, BOOL *result) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %p, %d, %p.\n", iface, theirs, type, result); + + return IMFAttributes_Compare(stream->attributes, theirs, type, result); +} + +static HRESULT WINAPI video_stream_attributes_GetUINT32(IMFAttributes *iface, REFGUID key, UINT32 *value) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), value); + + return IMFAttributes_GetUINT32(stream->attributes, key, value); +} + +static HRESULT WINAPI video_stream_attributes_GetUINT64(IMFAttributes *iface, REFGUID key, UINT64 *value) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), value); + + return IMFAttributes_GetUINT64(stream->attributes, key, value); +} + +static HRESULT WINAPI video_stream_attributes_GetDouble(IMFAttributes *iface, REFGUID key, double *value) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), value); + + return IMFAttributes_GetDouble(stream->attributes, key, value); +} + +static HRESULT WINAPI video_stream_attributes_GetGUID(IMFAttributes *iface, REFGUID key, GUID *value) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), value); + + return IMFAttributes_GetGUID(stream->attributes, key, value); +} + +static HRESULT WINAPI video_stream_attributes_GetStringLength(IMFAttributes *iface, REFGUID key, + UINT32 *length) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), length); + + return IMFAttributes_GetStringLength(stream->attributes, key, length); +} + +static HRESULT WINAPI video_stream_attributes_GetString(IMFAttributes *iface, REFGUID key, WCHAR *value, + UINT32 size, UINT32 *length) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p, %u, %p.\n", iface, debugstr_guid(key), value, size, length); + + return IMFAttributes_GetString(stream->attributes, key, value, size, length); +} + +static HRESULT WINAPI video_stream_attributes_GetAllocatedString(IMFAttributes *iface, REFGUID key, + WCHAR **value, UINT32 *length) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p, %p.\n", iface, debugstr_guid(key), value, length); + + return IMFAttributes_GetAllocatedString(stream->attributes, key, value, length); +} + +static HRESULT WINAPI video_stream_attributes_GetBlobSize(IMFAttributes *iface, REFGUID key, UINT32 *size) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), size); + + return IMFAttributes_GetBlobSize(stream->attributes, key, size); +} + +static HRESULT WINAPI video_stream_attributes_GetBlob(IMFAttributes *iface, REFGUID key, UINT8 *buf, + UINT32 bufsize, UINT32 *blobsize) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p, %u, %p.\n", iface, debugstr_guid(key), buf, bufsize, blobsize); + + return IMFAttributes_GetBlob(stream->attributes, key, buf, bufsize, blobsize); +} + +static HRESULT WINAPI video_stream_attributes_GetAllocatedBlob(IMFAttributes *iface, REFGUID key, + UINT8 **buf, UINT32 *size) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p, %p.\n", iface, debugstr_guid(key), buf, size); + + return IMFAttributes_GetAllocatedBlob(stream->attributes, key, buf, size); +} + +static HRESULT WINAPI video_stream_attributes_GetUnknown(IMFAttributes *iface, REFGUID key, REFIID riid, void **out) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(key), debugstr_guid(riid), out); + + return IMFAttributes_GetUnknown(stream->attributes, key, riid, out); +} + +static HRESULT WINAPI video_stream_attributes_SetItem(IMFAttributes *iface, REFGUID key, REFPROPVARIANT value) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), value); + + return IMFAttributes_SetItem(stream->attributes, key, value); +} + +static HRESULT WINAPI video_stream_attributes_DeleteItem(IMFAttributes *iface, REFGUID key) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s.\n", iface, debugstr_guid(key)); + + return IMFAttributes_DeleteItem(stream->attributes, key); +} + +static HRESULT WINAPI video_stream_attributes_DeleteAllItems(IMFAttributes *iface) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p.\n", iface); + + return IMFAttributes_DeleteAllItems(stream->attributes); +} + +static HRESULT WINAPI video_stream_attributes_SetUINT32(IMFAttributes *iface, REFGUID key, UINT32 value) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %u.\n", iface, debugstr_guid(key), value); + + return IMFAttributes_SetUINT32(stream->attributes, key, value); +} + +static HRESULT WINAPI video_stream_attributes_SetUINT64(IMFAttributes *iface, REFGUID key, UINT64 value) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %s.\n", iface, debugstr_guid(key), wine_dbgstr_longlong(value)); + + return IMFAttributes_SetUINT64(stream->attributes, key, value); +} + +static HRESULT WINAPI video_stream_attributes_SetDouble(IMFAttributes *iface, REFGUID key, double value) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %f.\n", iface, debugstr_guid(key), value); + + return IMFAttributes_SetDouble(stream->attributes, key, value); +} + +static HRESULT WINAPI video_stream_attributes_SetGUID(IMFAttributes *iface, REFGUID key, REFGUID value) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %s.\n", iface, debugstr_guid(key), debugstr_guid(value)); + + return IMFAttributes_SetGUID(stream->attributes, key, value); +} + +static HRESULT WINAPI video_stream_attributes_SetString(IMFAttributes *iface, REFGUID key, + const WCHAR *value) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %s.\n", iface, debugstr_guid(key), debugstr_w(value)); + + return IMFAttributes_SetString(stream->attributes, key, value); +} + +static HRESULT WINAPI video_stream_attributes_SetBlob(IMFAttributes *iface, REFGUID key, + const UINT8 *buf, UINT32 size) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p, %u.\n", iface, debugstr_guid(key), buf, size); + + return IMFAttributes_SetBlob(stream->attributes, key, buf, size); +} + +static HRESULT WINAPI video_stream_attributes_SetUnknown(IMFAttributes *iface, REFGUID key, + IUnknown *unknown) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), unknown); + + return IMFAttributes_SetUnknown(stream->attributes, key, unknown); +} + +static HRESULT WINAPI video_stream_attributes_LockStore(IMFAttributes *iface) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p.\n", iface); + + return IMFAttributes_LockStore(stream->attributes); +} + +static HRESULT WINAPI video_stream_attributes_UnlockStore(IMFAttributes *iface) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p.\n", iface); + + return IMFAttributes_UnlockStore(stream->attributes); +} + +static HRESULT WINAPI video_stream_attributes_GetCount(IMFAttributes *iface, UINT32 *count) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %p.\n", iface, count); + + return IMFAttributes_GetCount(stream->attributes, count); +} + +static HRESULT WINAPI video_stream_attributes_GetItemByIndex(IMFAttributes *iface, UINT32 index, + GUID *key, PROPVARIANT *value) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %u, %p, %p.\n", iface, index, key, value); + + return IMFAttributes_GetItemByIndex(stream->attributes, index, key, value); +} + +static HRESULT WINAPI video_stream_attributes_CopyAllItems(IMFAttributes *iface, IMFAttributes *dest) +{ + struct video_stream *stream = impl_from_stream_IMFAttributes(iface); + + TRACE("%p, %p.\n", iface, dest); + + return IMFAttributes_CopyAllItems(stream->attributes, dest); +} + +static const IMFAttributesVtbl video_stream_attributes_vtbl = +{ + video_stream_attributes_QueryInterface, + video_stream_attributes_AddRef, + video_stream_attributes_Release, + video_stream_attributes_GetItem, + video_stream_attributes_GetItemType, + video_stream_attributes_CompareItem, + video_stream_attributes_Compare, + video_stream_attributes_GetUINT32, + video_stream_attributes_GetUINT64, + video_stream_attributes_GetDouble, + video_stream_attributes_GetGUID, + video_stream_attributes_GetStringLength, + video_stream_attributes_GetString, + video_stream_attributes_GetAllocatedString, + video_stream_attributes_GetBlobSize, + video_stream_attributes_GetBlob, + video_stream_attributes_GetAllocatedBlob, + video_stream_attributes_GetUnknown, + video_stream_attributes_SetItem, + video_stream_attributes_DeleteItem, + video_stream_attributes_DeleteAllItems, + video_stream_attributes_SetUINT32, + video_stream_attributes_SetUINT64, + video_stream_attributes_SetDouble, + video_stream_attributes_SetGUID, + video_stream_attributes_SetString, + video_stream_attributes_SetBlob, + video_stream_attributes_SetUnknown, + video_stream_attributes_LockStore, + video_stream_attributes_UnlockStore, + video_stream_attributes_GetCount, + video_stream_attributes_GetItemByIndex, + video_stream_attributes_CopyAllItems, +}; + static HRESULT video_renderer_stream_create(struct video_renderer *renderer, unsigned int id, struct video_stream **ret) { @@ -607,12 +954,16 @@ static HRESULT video_renderer_stream_create(struct video_renderer *renderer, uns stream->IMFStreamSink_iface.lpVtbl = &video_stream_sink_vtbl; stream->IMFMediaTypeHandler_iface.lpVtbl = &video_stream_type_handler_vtbl; stream->IMFGetService_iface.lpVtbl = &video_stream_get_service_vtbl; + stream->IMFAttributes_iface.lpVtbl = &video_stream_attributes_vtbl; stream->refcount = 1; InitializeCriticalSection(&stream->cs);
if (FAILED(hr = MFCreateEventQueue(&stream->event_queue))) goto failed;
+ if (FAILED(hr = MFCreateAttributes(&stream->attributes, 0))) + goto failed; + stream->parent = renderer; IMFMediaSink_AddRef(&stream->parent->IMFMediaSink_iface); stream->id = id; diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 43dc9a49ee7..aabdc51e577 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3242,14 +3242,14 @@ static void test_evr(void) IMFVideoRenderer *video_renderer; IMFMediaSink *sink, *sink2; IMFAttributes *attributes; + DWORD flags, count, value; IMFActivate *activate; HWND window, window2; - DWORD flags, count; LONG sample_count; IMFGetService *gs; IMFSample *sample; IUnknown *unk; - UINT64 value; + UINT64 window3; HRESULT hr; GUID guid;
@@ -3272,9 +3272,9 @@ static void test_evr(void) hr = MFCreateVideoRendererActivate(window, &activate); ok(hr == S_OK, "Failed to create activate object, hr %#x.\n", hr);
- hr = IMFActivate_GetUINT64(activate, &MF_ACTIVATE_VIDEO_WINDOW, &value); + hr = IMFActivate_GetUINT64(activate, &MF_ACTIVATE_VIDEO_WINDOW, &window3); ok(hr == S_OK, "Failed to get attribute, hr %#x.\n", hr); - ok(UlongToHandle(value) == window, "Unexpected value.\n"); + ok(UlongToHandle(window3) == window, "Unexpected value.\n");
hr = IMFActivate_ActivateObject(activate, &IID_IMFMediaSink, (void **)&sink); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); @@ -3307,9 +3307,9 @@ static void test_evr(void) ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr); ok(count == 1, "Unexpected count %u.\n", count);
- hr = IMFActivate_GetUINT64(activate, &MF_ACTIVATE_VIDEO_WINDOW, &value); + hr = IMFActivate_GetUINT64(activate, &MF_ACTIVATE_VIDEO_WINDOW, &window3); ok(hr == S_OK, "Failed to get attribute, hr %#x.\n", hr); - ok(!value, "Unexpected value.\n"); + ok(!window3, "Unexpected value.\n");
hr = IMFActivate_ActivateObject(activate, &IID_IMFMediaSink, (void **)&sink); ok(hr == S_OK, "Failed to activate, hr %#x.\n", hr); @@ -3337,6 +3337,26 @@ static void test_evr(void) hr = IMFMediaSink_GetStreamSinkById(sink, 0, &stream_sink); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = IMFStreamSink_QueryInterface(stream_sink, &IID_IMFAttributes, (void **)&attributes); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFAttributes_GetCount(attributes, &count); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); +todo_wine { + ok(count == 2, "Unexpected count %u.\n", count); + value = 0; + hr = IMFAttributes_GetUINT32(attributes, &MF_SA_REQUIRED_SAMPLE_COUNT, &value); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(value == 1, "Unexpected attribute value %u.\n", value); + value = 0; + hr = IMFAttributes_GetUINT32(attributes, &MF_SA_D3D_AWARE, &value); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(value == 1, "Unexpected attribute value %u.\n", value); +} + hr = IMFAttributes_QueryInterface(attributes, &IID_IMFStreamSink, (void **)&unk); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IUnknown_Release(unk); + IMFAttributes_Release(attributes); + hr = IMFStreamSink_GetMediaTypeHandler(stream_sink, &type_handler); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/tests/evr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index 18822e1e4fa..bebffada509 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -1384,10 +1384,10 @@ static void test_MFCreateVideoSampleAllocator(void) hr = MFCreateMediaType(&media_type); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
- /* It expects IMFVideoMediaType. */ + /* It expects IMFVideoMediaType aka video major type. Exact return code is E_NOINTERFACE, + likely coming from querying for IMFVideoMediaType. Does not seem valuable to match it. */ hr = IMFVideoSampleAllocator_InitializeSampleAllocator(allocator, 2, media_type); -todo_wine - ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); + ok(FAILED(hr), "Unexpected hr %#x.\n", hr);
video_type = create_video_type(&MFVideoFormat_RGB32);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 42 +++++++++++++++++++++++++++++++----------- dlls/mf/tests/mf.c | 3 +-- 2 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index 4be59331b6b..47a506a94c6 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -942,10 +942,26 @@ static const IMFAttributesVtbl video_stream_attributes_vtbl = video_stream_attributes_CopyAllItems, };
+static BOOL video_renderer_is_mixer_d3d_aware(const struct video_renderer *renderer) +{ + IMFAttributes *attributes; + unsigned int value = 0; + BOOL ret; + + if (FAILED(IMFTransform_QueryInterface(renderer->mixer, &IID_IMFAttributes, (void **)&attributes))) + return FALSE; + + ret = SUCCEEDED(IMFAttributes_GetUINT32(attributes, &MF_SA_D3D_AWARE, &value)) && value; + IMFAttributes_Release(attributes); + return ret; +} + static HRESULT video_renderer_stream_create(struct video_renderer *renderer, unsigned int id, struct video_stream **ret) { struct video_stream *stream; + IMFAttributes *attributes; + unsigned int value; HRESULT hr;
if (!(stream = heap_alloc_zero(sizeof(*stream)))) @@ -968,6 +984,16 @@ static HRESULT video_renderer_stream_create(struct video_renderer *renderer, uns IMFMediaSink_AddRef(&stream->parent->IMFMediaSink_iface); stream->id = id;
+ if (video_renderer_is_mixer_d3d_aware(renderer)) + IMFAttributes_SetUINT32(stream->attributes, &MF_SA_D3D_AWARE, 1); + + if (SUCCEEDED(IMFTransform_GetInputStreamAttributes(renderer->mixer, id, &attributes))) + { + if (SUCCEEDED(IMFAttributes_GetUINT32(attributes, &MF_SA_REQUIRED_SAMPLE_COUNT, &value))) + IMFAttributes_SetUINT32(stream->attributes, &MF_SA_REQUIRED_SAMPLE_COUNT, value); + IMFAttributes_Release(attributes); + } + *ret = stream;
return S_OK; @@ -1491,7 +1517,6 @@ static HRESULT video_renderer_create_presenter(struct video_renderer *renderer, static HRESULT video_renderer_configure_mixer(struct video_renderer *renderer) { IMFTopologyServiceLookupClient *lookup_client; - IMFAttributes *attributes; HRESULT hr;
if (SUCCEEDED(hr = IMFTransform_QueryInterface(renderer->mixer, &IID_IMFTopologyServiceLookupClient, @@ -1537,21 +1562,16 @@ static HRESULT video_renderer_configure_mixer(struct video_renderer *renderer) }
/* Set device manager that presenter should have created. */ - if (SUCCEEDED(IMFTransform_QueryInterface(renderer->mixer, &IID_IMFAttributes, (void **)&attributes))) + if (video_renderer_is_mixer_d3d_aware(renderer)) { IDirect3DDeviceManager9 *device_manager; - unsigned int value;
- if (SUCCEEDED(IMFAttributes_GetUINT32(attributes, &MF_SA_D3D_AWARE, &value)) && value) + if (SUCCEEDED(MFGetService((IUnknown *)renderer->presenter, &MR_VIDEO_ACCELERATION_SERVICE, + &IID_IDirect3DDeviceManager9, (void **)&device_manager))) { - if (SUCCEEDED(MFGetService((IUnknown *)renderer->presenter, &MR_VIDEO_ACCELERATION_SERVICE, - &IID_IDirect3DDeviceManager9, (void **)&device_manager))) - { - IMFTransform_ProcessMessage(renderer->mixer, MFT_MESSAGE_SET_D3D_MANAGER, (ULONG_PTR)device_manager); - IDirect3DDeviceManager9_Release(device_manager); - } + IMFTransform_ProcessMessage(renderer->mixer, MFT_MESSAGE_SET_D3D_MANAGER, (ULONG_PTR)device_manager); + IDirect3DDeviceManager9_Release(device_manager); } - IMFAttributes_Release(attributes); }
return hr; diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index aabdc51e577..78a3d75e0a7 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3341,7 +3341,6 @@ static void test_evr(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr); hr = IMFAttributes_GetCount(attributes, &count); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); -todo_wine { ok(count == 2, "Unexpected count %u.\n", count); value = 0; hr = IMFAttributes_GetUINT32(attributes, &MF_SA_REQUIRED_SAMPLE_COUNT, &value); @@ -3351,7 +3350,7 @@ todo_wine { hr = IMFAttributes_GetUINT32(attributes, &MF_SA_D3D_AWARE, &value); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(value == 1, "Unexpected attribute value %u.\n", value); -} + hr = IMFAttributes_QueryInterface(attributes, &IID_IMFStreamSink, (void **)&unk); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); IUnknown_Release(unk);