From: Conor McCarthy <cmccarthy@codeweavers.com> --- dlls/mf/topology_loader.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index 857e395cc05..32e06cfbcff 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -513,7 +513,7 @@ static HRESULT topology_branch_connect_indirect(IMFTopology *topology, { hr = topology_branch_connect(topology, MF_CONNECT_ALLOW_CONVERTER, &down_branch, FALSE); /* Failure to connect a converter must result in MF_E_TOPO_CODEC_NOT_FOUND */ - if (hr == MF_E_INVALIDMEDIATYPE) + if (hr == MF_E_INVALIDMEDIATYPE || hr == MF_E_NO_MORE_TYPES) hr = MF_E_TOPO_CODEC_NOT_FOUND; } if (SUCCEEDED(hr)) @@ -605,6 +605,8 @@ static HRESULT topology_branch_connect_up_types(struct topology_branch *branch, IMFMediaType *up_type; HRESULT hr; + TRACE("branch %s.\n", debugstr_topology_branch(branch)); + /* The downstream current media type is not used here. Setting it in advance has no effect on the type used. * TODO: unless MF_TOPONODE_LOCKED is set? * Up and down transform media types are always set, even if they already match. @@ -820,6 +822,19 @@ static HRESULT topology_branch_connect_independent_outtypes(IMFTopology *topolog return hr; } +static HRESULT topology_branch_connect_indirect_audio(IMFTopology *topology, + struct topology_branch *branch, struct connection_context *context) +{ + IMFMediaType *down_type; + + TRACE("topology %p, branch %s.\n", topology, debugstr_topology_branch(branch)); + + connection_context_init_down_type_enumeration(context); + down_type = context->down_types.current ? context->down_types.current : context->down_types.index0; + + return topology_branch_connect_indirect(topology, branch, context->up_types.enumerate, context->up_types.index0, down_type); +} + static HRESULT topology_branch_connect_indirect_video(IMFTopology *topology, struct topology_branch *branch, struct connection_context *context) { @@ -887,11 +902,8 @@ done: static HRESULT topology_branch_connect_down(IMFTopology *topology, MF_CONNECT_METHOD method, struct topology_branch *branch, struct connection_context *context) { - IMFMediaType *up_type; HRESULT hr; - TRACE("topology %p, branch %s.\n", topology, debugstr_topology_branch(branch)); - if (SUCCEEDED(hr = topology_branch_connect_up_types(branch, context))) return hr; @@ -906,17 +918,8 @@ static HRESULT topology_branch_connect_down(IMFTopology *topology, MF_CONNECT_ME if (context->is_video) return topology_branch_connect_indirect_video(topology, branch, context); - - type_enumerator_reset(&context->up_types); - while (SUCCEEDED(hr = type_enumerator_get_next_media_type(&context->up_types, &up_type))) - { - hr = topology_branch_connect_indirect(topology, branch, context->up_types.enumerate, up_type, NULL); - IMFMediaType_Release(up_type); - if (SUCCEEDED(hr)) - return hr; - } - - return MF_E_TOPO_CODEC_NOT_FOUND; + else + return topology_branch_connect_indirect_audio(topology, branch, context); } static HRESULT topology_branch_connect(IMFTopology *topology, MF_CONNECT_METHOD method_mask, @@ -1212,7 +1215,7 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in TOPOID topoid; HRESULT hr = E_FAIL; - FIXME("iface %p, input_topology %p, ret_topology %p, current_topology %p stub!\n", + TRACE("iface %p, input_topology %p, ret_topology %p, current_topology %p.\n", iface, input_topology, ret_topology, current_topology); if (current_topology) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10009