Commit 15346b36 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf/evr: Derive stream attributes from mixer input attributes.

parent 1deea8e1
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment