From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/mf/tests/topology.c | 6 +----- dlls/mf/topology_loader.c | 30 +++++++++++++++++------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/dlls/mf/tests/topology.c b/dlls/mf/tests/topology.c index 6df7da89635..eeb9169c668 100644 --- a/dlls/mf/tests/topology.c +++ b/dlls/mf/tests/topology.c @@ -2512,7 +2512,6 @@ static void test_topology_loader(void) unsigned int expected_output_index; unsigned int optional_mft_count; BOOL expect_optional_mft_rejected[2]; - BOOL expect_optional_mft_accepted_todo; unsigned int flags; GUID decoder_class; GUID converter_class; @@ -2980,7 +2979,7 @@ static void test_topology_loader(void) .input_types = {&video_h264_1280}, .output_types = {&video_nv12_1280}, .sink_method = MF_CONNECT_DIRECT, .source_method = -1, .mft_input_types = {&video_nv12_1280}, .mft_output_types = {&video_nv12_1280, &video_yuy2_1280}, .optional_mft_input_types = {&video_yuy2_1280}, - .optional_mft_count = 1, .expect_optional_mft_accepted_todo = TRUE, + .optional_mft_count = 1, .expected_result = S_OK, .decoder_class = CLSID_CMSH264DecoderMFT, .flags = LOADER_ADD_TEST_MFT | LOADER_NO_CURRENT_OUTPUT | LOADER_ADD_OPTIONAL_TEST_MFT_DOWNSTREAM | LOADER_EXPECT_MFT_INPUT_ENUMERATED | LOADER_EXPECT_MFT_OUTPUT_ENUMERATED_TODO, }, @@ -3431,7 +3430,6 @@ static void test_topology_loader(void) for (j = 0; j < test->optional_mft_count; ++j) { hr = IMFTopology_GetNodeByID(full_topology, optional_mft_node_id[j], &mft_node); - todo_wine_if(test->expect_optional_mft_accepted_todo) ok(hr == (test->expect_optional_mft_rejected[j] ? MF_E_NOT_FOUND : S_OK), "Unexpected hr %#lx.\n", hr); expect_optional_rejected |= test->expect_optional_mft_rejected[j]; @@ -3467,7 +3465,6 @@ todo_wine { hr = IMFTopology_GetNodeCount(full_topology, &node_count); ok(hr == S_OK, "Failed to get node count, hr %#lx.\n", hr); - todo_wine_if(test->expect_optional_mft_accepted_todo) ok(node_count == count, "Unexpected node count %u.\n", node_count); hr = IMFTopologyNode_GetTopoNodeID(src_node, &node_id); @@ -3670,7 +3667,6 @@ todo_wine { ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFTopology_GetNodeCount(topology2, &node_count); ok(hr == S_OK, "Failed to get node count, hr %#lx.\n", hr); - todo_wine_if(test->expect_optional_mft_accepted_todo) ok(node_count == count, "Unexpected node count %u.\n", node_count); ref = IMFTopology_Release(topology2); diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index a44289c5f86..0d3e2a88669 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -475,7 +475,7 @@ static HRESULT topology_branch_connect_with_type(IMFTopology *topology, struct t } static HRESULT topology_branch_connect(IMFTopology *topology, enum connect_method method_mask, - struct topology_branch *branch, IMFMediaType *upstream); + struct topology_branch *branch, IMFMediaType *upstream, BOOL force_enumerate); static HRESULT topology_branch_connect_indirect(IMFTopology *topology, BOOL decoder, struct topology_branch *branch, IMFMediaType *upstream) { @@ -541,7 +541,7 @@ static HRESULT topology_branch_connect_indirect(IMFTopology *topology, BOOL deco if (SUCCEEDED(hr = topology_branch_connect_with_type(topology, up_branch, upstream))) { if (FAILED(hr = topology_branch_find_best_type(down_branch, upstream, &media_type))) - hr = topology_branch_connect(topology, method_mask, down_branch, upstream); + hr = topology_branch_connect(topology, method_mask, down_branch, upstream, FALSE); else { hr = topology_branch_connect_with_type(topology, down_branch, media_type); @@ -688,7 +688,7 @@ static HRESULT topology_branch_connect_down(IMFTopology *topology, enum connect_ } static HRESULT topology_branch_foreach_up_types(IMFTopology *topology, enum connect_method method_mask, - struct topology_branch *branch, IMFMediaType *upstream) + struct topology_branch *branch, IMFMediaType *upstream, BOOL force_enumerate) { HRESULT hr = MF_E_INVALIDMEDIATYPE; UINT32 enumerate = TRUE; @@ -712,7 +712,7 @@ static HRESULT topology_branch_foreach_up_types(IMFTopology *topology, enum conn break; } - if (enumerate) + if (enumerate || force_enumerate) { for (UINT i = 0; SUCCEEDED(hr = media_type_handler_get_type(branch->up.handler, i, &up_type)); i++) { @@ -741,7 +741,7 @@ static HRESULT topology_branch_foreach_up_types(IMFTopology *topology, enum conn } static HRESULT topology_branch_connect(IMFTopology *topology, enum connect_method method_mask, - struct topology_branch *branch, IMFMediaType *upstream) + struct topology_branch *branch, IMFMediaType *upstream, BOOL force_enumerate) { HRESULT hr = MF_E_INVALIDMEDIATYPE; UINT32 up_method, down_method; @@ -758,15 +758,15 @@ static HRESULT topology_branch_connect(IMFTopology *topology, enum connect_metho up_method = MF_CONNECT_DIRECT; if (up_method & MF_CONNECT_RESOLVE_INDEPENDENT_OUTPUTTYPES) - hr = topology_branch_foreach_up_types(topology, down_method, branch, upstream); + hr = topology_branch_foreach_up_types(topology, down_method, branch, upstream, force_enumerate); else { if (FAILED(hr) && (down_method & CONNECT_DIRECT)) - hr = topology_branch_foreach_up_types(topology, CONNECT_DIRECT, branch, upstream); + hr = topology_branch_foreach_up_types(topology, CONNECT_DIRECT, branch, upstream, force_enumerate); if (FAILED(hr) && (down_method & CONNECT_CONVERTER)) - hr = topology_branch_foreach_up_types(topology, CONNECT_CONVERTER, branch, upstream); + hr = topology_branch_foreach_up_types(topology, CONNECT_CONVERTER, branch, upstream, force_enumerate); if (FAILED(hr) && (down_method & CONNECT_DECODER)) - hr = topology_branch_foreach_up_types(topology, CONNECT_DECODER, branch, upstream); + hr = topology_branch_foreach_up_types(topology, CONNECT_DECODER, branch, upstream, force_enumerate); } TRACE("returning %#lx\n", hr); @@ -789,6 +789,10 @@ static HRESULT topology_branch_connect_optional_chain(IMFTopology *topology, str while (SUCCEEDED(hr) && node != branch->down.node) { IMFTopologyNode *tmp = node; + UINT32 method; + + if (FAILED(IMFTopologyNode_GetUINT32(node, &MF_TOPONODE_CONNECT_METHOD, &method))) + method = MF_CONNECT_DIRECT; /* The loader may have inserted one or more transforms upstream. Only try inserting the optional node * downstream of them. Support for upstream insertion is untested in native, but seems unlikely to work. */ @@ -796,10 +800,10 @@ static HRESULT topology_branch_connect_optional_chain(IMFTopology *topology, str break; if (SUCCEEDED(hr = topology_branch_create_optional(topology, current, node, stream, &up_branch, &down_branch))) { - if (FAILED(hr = topology_branch_connect(topology, CONNECT_DIRECT, up_branch, NULL)) - || FAILED(hr = topology_branch_connect(topology, CONNECT_DIRECT, down_branch, NULL))) + if (FAILED(hr = topology_branch_connect(topology, CONNECT_DIRECT, up_branch, NULL, !!method)) + || FAILED(hr = topology_branch_connect(topology, CONNECT_DIRECT, down_branch, NULL, FALSE))) { - if (FAILED(hr = topology_branch_connect(topology, CONNECT_DIRECT, current, NULL))) + if (FAILED(hr = topology_branch_connect(topology, CONNECT_DIRECT, current, NULL, FALSE))) WARN("Failed to restore previous branch %s\n", debugstr_topology_branch(current)); IMFTopology_RemoveNode(topology, down_branch->up.node); } @@ -841,7 +845,7 @@ static HRESULT topology_loader_resolve_node(IMFTopology *topology, IMFTopologyNo if (SUCCEEDED(hr = topology_branch_create_cloned(topology, branch->up.node, branch->up.stream, branch->down.node, branch->down.stream, &cloned))) { - if (SUCCEEDED(hr = topology_branch_connect(topology, method_mask, cloned, NULL))) + if (SUCCEEDED(hr = topology_branch_connect(topology, method_mask, cloned, NULL, FALSE))) topology_branch_connect_optional_chain(topology, branch, cloned->down.node, cloned->down.stream); topology_branch_destroy(cloned); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10791