Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/main.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 6394784593e..e4cd1c397ad 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -1579,7 +1579,6 @@ const char *debugstr_attr(const GUID *guid) X(MF_SA_D3D_AWARE), X(MF_MT_MAX_KEYFRAME_SPACING), X(MFT_TRANSFORM_CLSID_Attribute), - X(MFT_TRANSFORM_CLSID_Attribute), X(MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING), X(MF_MT_AM_FORMAT_TYPE), X(MF_SESSION_APPROX_EVENT_OCCURRENCE_TIME),
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/mediatype.c | 2 +- dlls/mfplat/tests/mfplat.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 62d75e80146..2bf9b674ea7 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3011,7 +3011,7 @@ HRESULT WINAPI MFInitMediaTypeFromWaveFormatEx(IMFMediaType *mediatype, const WA mediatype_set_uint32(mediatype, &MF_MT_ALL_SAMPLES_INDEPENDENT, 1, &hr); }
- if (format->cbSize) + if (format->cbSize && format->wFormatTag != WAVE_FORMAT_EXTENSIBLE) mediatype_set_blob(mediatype, &MF_MT_USER_DATA, (const UINT8 *)(format + 1), format->cbSize, &hr);
return hr; diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 38e8acb966e..b361d4da162 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -5625,9 +5625,13 @@ static void test_MFInitMediaTypeFromWaveFormatEx(void) waveformatext.dwChannelMask = 0x8; memcpy(&waveformatext.SubFormat, &MFAudioFormat_Base, sizeof(waveformatext.SubFormat)); waveformatext.SubFormat.Data1 = waveformatex_tests[i].wFormatTag; + hr = MFInitMediaTypeFromWaveFormatEx(mediatype, &waveformatext.Format, sizeof(waveformatext)); ok(hr == S_OK, "Failed to initialize media type, hr %#x.\n", hr);
+ hr = IMFMediaType_GetItem(mediatype, &MF_MT_USER_DATA, NULL); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#x.\n", hr); + validate_media_type(mediatype, &waveformatext.Format); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=82856
Your paranoid android.
=== wvistau64 (64 bit report) ===
mfplat: mfplat: Timeout
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/tests/mf.c | 10 ++++++++-- dlls/mf/topology.c | 27 ++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 20e3e8713c6..d7d7fdfa60e 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -1740,7 +1740,6 @@ static void test_topology_loader(void) { /* PCM -> PCM, different bps. */ &MFMediaType_Audio, - /* Source type */ { { { &MF_MT_SUBTYPE, WAVE_FORMAT_PCM }, @@ -1751,7 +1750,6 @@ static void test_topology_loader(void) { &MF_MT_AUDIO_BITS_PER_SAMPLE, 8 }, } }, - /* Sink type */ { { { &MF_MT_SUBTYPE, WAVE_FORMAT_PCM }, @@ -2039,6 +2037,14 @@ todo_wine { hr = IMFTopologyNode_GetObject(mft_node, &node_object); ok(hr == S_OK, "Failed to get object of transform node, hr %#x.\n", hr);
+ if (test->flags & LOADER_EXPECTED_DECODER) + { + value = 0; + hr = IMFTopologyNode_GetUINT32(mft_node, &MF_TOPONODE_DECODER, &value); + ok(hr == S_OK, "Failed to get attribute, hr %#x.\n", hr); + ok(value == 1, "Unexpected value.\n"); + } + hr = IUnknown_QueryInterface(node_object, &IID_IMFTransform, (void **)&transform); ok(hr == S_OK, "Failed to get IMFTransform from transform node's object, hr %#x.\n", hr); IUnknown_Release(node_object); diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index 7001a33f088..efa28e9f457 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -1996,6 +1996,7 @@ struct transform_output_type { IMFMediaType *type; IMFTransform *transform; + const GUID *category; };
struct connect_context @@ -2053,6 +2054,7 @@ static HRESULT topology_loader_enumerate_output_types(const GUID *category, IMFM unsigned int output_count = 0;
output_type.transform = transform; + output_type.category = category; while (SUCCEEDED(IMFTransform_GetOutputAvailableType(transform, 0, output_count++, &output_type.type))) { hr = connect_func(&output_type, context); @@ -2073,6 +2075,24 @@ static HRESULT topology_loader_enumerate_output_types(const GUID *category, IMFM return hr; }
+static HRESULT topology_loader_create_transform(const struct transform_output_type *output_type, + IMFTopologyNode **node) +{ + HRESULT hr; + + if (FAILED(hr = MFCreateTopologyNode(MF_TOPOLOGY_TRANSFORM_NODE, node))) + return hr; + + IMFTopologyNode_SetObject(*node, (IUnknown *)output_type->transform); + if (IsEqualGUID(output_type->category, &MFT_CATEGORY_AUDIO_DECODER) || + IsEqualGUID(output_type->category, &MFT_CATEGORY_VIDEO_DECODER)) + { + IMFTopologyNode_SetUINT32(*node, &MF_TOPONODE_DECODER, 1); + } + + return hr; +} + static HRESULT connect_to_sink(struct transform_output_type *output_type, struct connect_context *context) { IMFTopologyNode *node; @@ -2081,10 +2101,9 @@ static HRESULT connect_to_sink(struct transform_output_type *output_type, struct if (FAILED(IMFMediaTypeHandler_IsMediaTypeSupported(context->sink_handler, output_type->type, NULL))) return MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_MEDIATYPE_COMBINATION;
- if (FAILED(hr = MFCreateTopologyNode(MF_TOPOLOGY_TRANSFORM_NODE, &node))) + if (FAILED(hr = topology_loader_create_transform(output_type, &node))) return hr;
- IMFTopologyNode_SetObject(node, (IUnknown *)output_type->transform); IMFTopology_AddNode(context->context->output_topology, node); IMFTopologyNode_ConnectOutput(context->upstream_node, 0, node, 0); IMFTopologyNode_ConnectOutput(node, 0, context->sink, 0); @@ -2107,11 +2126,9 @@ static HRESULT connect_to_converter(struct transform_output_type *output_type, s if (SUCCEEDED(connect_to_sink(output_type, context))) return S_OK;
- if (FAILED(hr = MFCreateTopologyNode(MF_TOPOLOGY_TRANSFORM_NODE, &node))) + if (FAILED(hr = topology_loader_create_transform(output_type, &node))) return hr;
- IMFTopologyNode_SetObject(node, (IUnknown *)output_type->transform); - sink_ctx = *context; sink_ctx.upstream_node = node;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=82857
Your paranoid android.
=== wvistau64 (64 bit report) ===
mf: mf: Timeout
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/tests/mf.c | 6 ++++++ dlls/mf/topology.c | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index d7d7fdfa60e..4d4c6283be8 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2045,6 +2045,9 @@ todo_wine { ok(value == 1, "Unexpected value.\n"); }
+ hr = IMFTopologyNode_GetItem(mft_node, &MF_TOPONODE_TRANSFORM_OBJECTID, NULL); + ok(hr == S_OK, "Failed to get attribute, hr %#x.\n", hr); + hr = IUnknown_QueryInterface(node_object, &IID_IMFTransform, (void **)&transform); ok(hr == S_OK, "Failed to get IMFTransform from transform node's object, hr %#x.\n", hr); IUnknown_Release(node_object); @@ -2068,6 +2071,9 @@ todo_wine { ok(hr == S_OK, "Failed to get transform node type in resolved topology, hr %#x.\n", hr); ok(node_type == MF_TOPOLOGY_TRANSFORM_NODE, "Unexpected node type %u.\n", node_type);
+ hr = IMFTopologyNode_GetItem(mft_node, &MF_TOPONODE_TRANSFORM_OBJECTID, NULL); + ok(hr == S_OK, "Failed to get attribute, hr %#x.\n", hr); + hr = IMFTopologyNode_GetObject(mft_node, &node_object); ok(hr == S_OK, "Failed to get object of transform node, hr %#x.\n", hr);
diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index efa28e9f457..77baa1128c4 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -1996,7 +1996,7 @@ struct transform_output_type { IMFMediaType *type; IMFTransform *transform; - const GUID *category; + IMFActivate *activate; };
struct connect_context @@ -2054,7 +2054,7 @@ static HRESULT topology_loader_enumerate_output_types(const GUID *category, IMFM unsigned int output_count = 0;
output_type.transform = transform; - output_type.category = category; + output_type.activate = activates[i]; while (SUCCEEDED(IMFTransform_GetOutputAvailableType(transform, 0, output_count++, &output_type.type))) { hr = connect_func(&output_type, context); @@ -2079,17 +2079,22 @@ static HRESULT topology_loader_create_transform(const struct transform_output_ty IMFTopologyNode **node) { HRESULT hr; + GUID guid;
if (FAILED(hr = MFCreateTopologyNode(MF_TOPOLOGY_TRANSFORM_NODE, node))) return hr;
IMFTopologyNode_SetObject(*node, (IUnknown *)output_type->transform); - if (IsEqualGUID(output_type->category, &MFT_CATEGORY_AUDIO_DECODER) || - IsEqualGUID(output_type->category, &MFT_CATEGORY_VIDEO_DECODER)) + + if (SUCCEEDED(IMFActivate_GetGUID(output_type->activate, &MF_TRANSFORM_CATEGORY_Attribute, &guid)) && + (IsEqualGUID(&guid, &MFT_CATEGORY_AUDIO_DECODER) || IsEqualGUID(&guid, &MFT_CATEGORY_VIDEO_DECODER))) { IMFTopologyNode_SetUINT32(*node, &MF_TOPONODE_DECODER, 1); }
+ if (SUCCEEDED(IMFActivate_GetGUID(output_type->activate, &MFT_TRANSFORM_CLSID_Attribute, &guid))) + IMFTopologyNode_SetGUID(*node, &MF_TOPONODE_TRANSFORM_OBJECTID, &guid); + return hr; }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=82858
Your paranoid android.
=== wvistau64 (64 bit report) ===
mf: mf: Timeout
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/tests/mf.c | 131 ++++++++++++++++++++++++++++++++++++++++++++- dlls/mf/topology.c | 29 ++++++++++ 2 files changed, 158 insertions(+), 2 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 4d4c6283be8..c36a76d83bb 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -1622,8 +1622,11 @@ static void init_source_node(IMFMediaType *mediatype, IMFMediaSource *source, IM hr = IMFTopologyNode_SetUnknown(node, &MF_TOPONODE_STREAM_DESCRIPTOR, (IUnknown *)sd); ok(hr == S_OK, "Failed to set node sd, hr %#x.\n", hr);
- hr = IMFTopologyNode_SetUnknown(node, &MF_TOPONODE_SOURCE, (IUnknown *)source); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + if (source) + { + hr = IMFTopologyNode_SetUnknown(node, &MF_TOPONODE_SOURCE, (IUnknown *)source); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + }
IMFStreamDescriptor_Release(sd); } @@ -2121,6 +2124,129 @@ todo_wine { ok(hr == S_OK, "Shutdown failure, hr %#x.\n", hr); }
+static void test_topology_loader_evr(void) +{ + IMFTopologyNode *node, *source_node, *evr_node; + IMFTopology *topology, *full_topology; + IMFMediaTypeHandler *handler; + unsigned int i, count, value; + IMFStreamSink *stream_sink; + IMFMediaType *media_type; + IMFActivate *activate; + IMFTopoLoader *loader; + IMFMediaSink *sink; + WORD node_count; + HWND window; + HRESULT hr; + + hr = CoInitialize(NULL); + ok(hr == S_OK, "Failed to initialize, hr %#x.\n", hr); + + hr = MFCreateTopoLoader(&loader); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + /* Source node. */ + hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &source_node); + ok(hr == S_OK, "Failed to create topology node, hr %#x.\n", hr); + + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr); + + hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFVideoFormat_RGB32); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, (UINT64)640 << 32 | 480); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + init_source_node(media_type, NULL, source_node); + + /* EVR sink node. */ + window = create_window(); + + hr = MFCreateVideoRendererActivate(window, &activate); + ok(hr == S_OK, "Failed to create activate object, hr %#x.\n", hr); + + hr = IMFActivate_ActivateObject(activate, &IID_IMFMediaSink, (void **)&sink); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaSink_GetStreamSinkById(sink, 0, &stream_sink); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &evr_node); + ok(hr == S_OK, "Failed to create topology node, hr %#x.\n", hr); + + hr = IMFTopologyNode_SetObject(evr_node, (IUnknown *)stream_sink); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFStreamSink_GetMediaTypeHandler(stream_sink, &handler); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFMediaTypeHandler_SetCurrentMediaType(handler, media_type); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IMFMediaTypeHandler_Release(handler); + + IMFStreamSink_Release(stream_sink); + IMFMediaSink_Release(sink); + + hr = MFCreateTopology(&topology); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFTopology_AddNode(topology, source_node); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFTopology_AddNode(topology, evr_node); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFTopologyNode_ConnectOutput(source_node, 0, evr_node, 0); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFTopologyNode_SetUINT32(evr_node, &MF_TOPONODE_CONNECT_METHOD, MF_CONNECT_DIRECT); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFTopologyNode_GetCount(evr_node, &count); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(count == 1, "Unexpected attribute count %u.\n", count); + + hr = IMFTopoLoader_Load(loader, topology, &full_topology, NULL); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFTopology_GetNodeCount(full_topology, &node_count); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); +todo_wine + ok(node_count == 3, "Unexpected node count %u.\n", node_count); + + for (i = 0; i < node_count; ++i) + { + MF_TOPOLOGY_TYPE node_type; + + hr = IMFTopology_GetNode(full_topology, i, &node); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFTopologyNode_GetNodeType(node, &node_type); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + if (node_type == MF_TOPOLOGY_OUTPUT_NODE) + { + value = 1; + hr = IMFTopologyNode_GetUINT32(node, &MF_TOPONODE_STREAMID, &value); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!value, "Unexpected stream id %u.\n", value); + } + } + + IMFTopology_Release(full_topology); + + IMFTopoLoader_Release(loader); + + IMFTopologyNode_Release(source_node); + IMFTopologyNode_Release(evr_node); + IMFTopology_Release(topology); + IMFMediaType_Release(media_type); + DestroyWindow(window); + + CoUninitialize(); +} + static HRESULT WINAPI testshutdown_QueryInterface(IMFShutdown *iface, REFIID riid, void **obj) { if (IsEqualIID(riid, &IID_IMFShutdown) || @@ -4859,6 +4985,7 @@ START_TEST(mf) test_topology(); test_topology_tee_node(); test_topology_loader(); + test_topology_loader_evr(); test_MFGetService(); test_sequencer_source(); test_media_session(); diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index 77baa1128c4..6f73bb859cd 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -2364,6 +2364,32 @@ static HRESULT topology_loader_resolve_nodes(struct topoloader_context *context, return hr; }
+static void topology_loader_resolve_complete(struct topoloader_context *context) +{ + MF_TOPOLOGY_TYPE node_type; + IMFTopologyNode *node; + WORD i, node_count; + + IMFTopology_GetNodeCount(context->output_topology, &node_count); + + for (i = 0; i < node_count; ++i) + { + if (SUCCEEDED(IMFTopology_GetNode(context->output_topology, i, &node))) + { + IMFTopologyNode_GetNodeType(node, &node_type); + + if (node_type == MF_TOPOLOGY_OUTPUT_NODE) + { + /* Make sure MF_TOPONODE_STREAMID is set for all outputs. */ + if (FAILED(IMFTopologyNode_GetItem(node, &MF_TOPONODE_STREAMID, NULL))) + IMFTopologyNode_SetUINT32(node, &MF_TOPONODE_STREAMID, 0); + } + + IMFTopologyNode_Release(node); + } + } +} + static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *input_topology, IMFTopology **ret_topology, IMFTopology *current_topology) { @@ -2451,6 +2477,9 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in break; }
+ if (SUCCEEDED(hr)) + topology_loader_resolve_complete(&context); + *ret_topology = output_topology;
return hr;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=82859
Your paranoid android.
=== wvistau64 (64 bit report) ===
mf: mf: Timeout
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/tests/mf.c | 8 ++++++++ dlls/mf/topology.c | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index c36a76d83bb..b2cb45668cb 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2136,6 +2136,7 @@ static void test_topology_loader_evr(void) IMFTopoLoader *loader; IMFMediaSink *sink; WORD node_count; + UINT64 value64; HWND window; HRESULT hr;
@@ -2232,6 +2233,13 @@ todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(!value, "Unexpected stream id %u.\n", value); } + else if (node_type == MF_TOPOLOGY_SOURCESTREAM_NODE) + { + value64 = 1; + hr = IMFTopologyNode_GetUINT64(node, &MF_TOPONODE_MEDIASTART, &value64); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!value64, "Unexpected value.\n"); + } }
IMFTopology_Release(full_topology); diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index 6f73bb859cd..825b9d538f3 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -2380,10 +2380,16 @@ static void topology_loader_resolve_complete(struct topoloader_context *context)
if (node_type == MF_TOPOLOGY_OUTPUT_NODE) { - /* Make sure MF_TOPONODE_STREAMID is set for all outputs. */ + /* Set MF_TOPONODE_STREAMID for all outputs. */ if (FAILED(IMFTopologyNode_GetItem(node, &MF_TOPONODE_STREAMID, NULL))) IMFTopologyNode_SetUINT32(node, &MF_TOPONODE_STREAMID, 0); } + else if (node_type == MF_TOPOLOGY_SOURCESTREAM_NODE) + { + /* Set MF_TOPONODE_MEDIASTART for all sources. */ + if (FAILED(IMFTopologyNode_GetItem(node, &MF_TOPONODE_MEDIASTART, NULL))) + IMFTopologyNode_SetUINT64(node, &MF_TOPONODE_MEDIASTART, 0); + }
IMFTopologyNode_Release(node); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=82860
Your paranoid android.
=== wvistau64 (64 bit report) ===
mf: mf: Timeout
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/copier.c | 8 +++ dlls/mf/mf_private.h | 2 + dlls/mf/tests/mf.c | 2 +- dlls/mf/topology.c | 115 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 126 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/copier.c b/dlls/mf/copier.c index ba8e316f7e9..cbdac97292b 100644 --- a/dlls/mf/copier.c +++ b/dlls/mf/copier.c @@ -561,6 +561,14 @@ static const IMFTransformVtbl sample_copier_transform_vtbl = sample_copier_transform_ProcessOutput, };
+BOOL mf_is_sample_copier_transform(IUnknown *transform) +{ + return transform->lpVtbl == (IUnknownVtbl *)&sample_copier_transform_vtbl; +} + +/*********************************************************************** + * MFCreateSampleCopierMFT (mf.@) + */ HRESULT WINAPI MFCreateSampleCopierMFT(IMFTransform **transform) { struct sample_copier *object; diff --git a/dlls/mf/mf_private.h b/dlls/mf/mf_private.h index 66d970dfce5..0c4dde0c4fc 100644 --- a/dlls/mf/mf_private.h +++ b/dlls/mf/mf_private.h @@ -79,3 +79,5 @@ static inline const char *debugstr_time(LONGLONG time)
return wine_dbg_sprintf("%s", rev); } + +extern BOOL mf_is_sample_copier_transform(IUnknown *transform) DECLSPEC_HIDDEN; diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index b2cb45668cb..a5b23e35773 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2139,6 +2139,7 @@ static void test_topology_loader_evr(void) UINT64 value64; HWND window; HRESULT hr; + GUID guid;
hr = CoInitialize(NULL); ok(hr == S_OK, "Failed to initialize, hr %#x.\n", hr); @@ -2213,7 +2214,6 @@ static void test_topology_loader_evr(void)
hr = IMFTopology_GetNodeCount(full_topology, &node_count); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); -todo_wine ok(node_count == 3, "Unexpected node count %u.\n", node_count);
for (i = 0; i < node_count; ++i) diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index 825b9d538f3..e33dbc2efc7 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -2364,6 +2364,119 @@ static HRESULT topology_loader_resolve_nodes(struct topoloader_context *context, return hr; }
+static BOOL topology_loader_is_node_d3d_aware(IMFTopologyNode *node) +{ + IMFAttributes *attributes; + unsigned int d3d_aware = 0; + IUnknown *object = NULL; + + if (FAILED(IMFTopologyNode_GetObject(node, &object))) + return FALSE; + + if (SUCCEEDED(IUnknown_QueryInterface(object, &IID_IMFAttributes, (void **)&attributes))) + { + IMFAttributes_GetUINT32(attributes, &MF_SA_D3D_AWARE, &d3d_aware); + IMFAttributes_Release(attributes); + } + + if (!d3d_aware) + d3d_aware = mf_is_sample_copier_transform(object); + + IUnknown_Release(object); + + return !!d3d_aware; +} + +static HRESULT topology_loader_create_copier(IMFTopologyNode *upstream_node, unsigned int upstream_output, + IMFTopologyNode *downstream_node, unsigned int downstream_input, IMFTransform **copier) +{ + IMFMediaType *input_type = NULL, *output_type = NULL; + IMFTransform *transform; + HRESULT hr; + + if (FAILED(hr = MFCreateSampleCopierMFT(&transform))) + return hr; + + if (FAILED(hr = MFGetTopoNodeCurrentType(upstream_node, upstream_output, TRUE, &input_type))) + WARN("Failed to get upstream media type hr %#x.\n", hr); + + if (SUCCEEDED(hr) && FAILED(hr = MFGetTopoNodeCurrentType(downstream_node, downstream_input, FALSE, &output_type))) + WARN("Failed to get downstream media type hr %#x.\n", hr); + + if (SUCCEEDED(hr) && FAILED(hr = IMFTransform_SetInputType(transform, 0, input_type, 0))) + WARN("Input type wasn't accepted, hr %#x.\n", hr); + + if (SUCCEEDED(hr) && FAILED(hr = IMFTransform_SetOutputType(transform, 0, output_type, 0))) + WARN("Output type wasn't accepted, hr %#x.\n", hr); + + if (SUCCEEDED(hr)) + { + *copier = transform; + IMFTransform_AddRef(*copier); + } + + if (input_type) + IMFMediaType_Release(input_type); + if (output_type) + IMFMediaType_Release(output_type); + + IMFTransform_Release(transform); + + return hr; +} + +static HRESULT topology_loader_connect_copier(struct topoloader_context *context, IMFTopologyNode *upstream_node, + unsigned int upstream_output, IMFTopologyNode *downstream_node, unsigned int downstream_input, IMFTransform *copier) +{ + IMFTopologyNode *copier_node; + HRESULT hr; + + if (FAILED(hr = MFCreateTopologyNode(MF_TOPOLOGY_TRANSFORM_NODE, &copier_node))) + return hr; + + IMFTopologyNode_SetObject(copier_node, (IUnknown *)copier); + IMFTopology_AddNode(context->output_topology, copier_node); + IMFTopologyNode_ConnectOutput(upstream_node, upstream_output, copier_node, 0); + IMFTopologyNode_ConnectOutput(copier_node, 0, downstream_node, downstream_input); + + IMFTopologyNode_Release(copier_node); + + return S_OK; +} + +/* Right now this should be used for output nodes only. */ +static HRESULT topology_loader_connect_d3d_aware_input(struct topoloader_context *context, + IMFTopologyNode *node) +{ + IMFTopologyNode *upstream_node; + unsigned int upstream_output; + IMFStreamSink *stream_sink; + IMFTransform *copier = NULL; + HRESULT hr = S_OK; + + IMFTopologyNode_GetObject(node, (IUnknown **)&stream_sink); + + if (topology_loader_is_node_d3d_aware(node)) + { + if (SUCCEEDED(IMFTopologyNode_GetInput(node, 0, &upstream_node, &upstream_output))) + { + if (!topology_loader_is_node_d3d_aware(upstream_node)) + { + if (SUCCEEDED(hr = topology_loader_create_copier(upstream_node, upstream_output, node, 0, &copier))) + { + hr = topology_loader_connect_copier(context, upstream_node, upstream_output, node, 0, copier); + IMFTransform_Release(copier); + } + } + IMFTopologyNode_Release(upstream_node); + } + } + + IMFStreamSink_Release(stream_sink); + + return hr; +} + static void topology_loader_resolve_complete(struct topoloader_context *context) { MF_TOPOLOGY_TYPE node_type; @@ -2383,6 +2496,8 @@ static void topology_loader_resolve_complete(struct topoloader_context *context) /* Set MF_TOPONODE_STREAMID for all outputs. */ if (FAILED(IMFTopologyNode_GetItem(node, &MF_TOPONODE_STREAMID, NULL))) IMFTopologyNode_SetUINT32(node, &MF_TOPONODE_STREAMID, 0); + + topology_loader_connect_d3d_aware_input(context, node); } else if (node_type == MF_TOPOLOGY_SOURCESTREAM_NODE) {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=82861
Your paranoid android.
=== wvistau64 (64 bit report) ===
mf: mf: Timeout