Signed-off-by: Sergio Gómez Del Real sdelreal@codeweavers.com --- dlls/mf/topology.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index 70b9f4962c..83e3b0a7c5 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -1943,6 +1943,37 @@ struct topoloader_context unsigned int marker; };
+static HRESULT topology_loader_clone_node(struct topoloader_context *context, IMFTopologyNode *node, IMFTopologyNode **ret, + unsigned int marker) +{ + IMFTopologyNode *cloned_node; + MF_TOPOLOGY_TYPE node_type; + HRESULT hr; + + if (ret) *ret = NULL; + + IMFTopologyNode_GetNodeType(node, &node_type); + + if (FAILED(hr = MFCreateTopologyNode(node_type, &cloned_node))) + return hr; + + if (SUCCEEDED(hr = IMFTopologyNode_CloneFrom(cloned_node, node))) + hr = IMFTopologyNode_SetUINT32(cloned_node, &context->key, marker); + + if (SUCCEEDED(hr)) + hr = IMFTopology_AddNode(context->output_topology, cloned_node); + + if (SUCCEEDED(hr) && ret) + { + *ret = cloned_node; + IMFTopologyNode_AddRef(*ret); + } + + IMFTopologyNode_Release(cloned_node); + + return hr; +} + static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *input_topology, IMFTopology **output_topology, IMFTopology *current_topology) { @@ -1976,7 +2007,16 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in { IMFTopologyNode_GetNodeType(node, &node_type);
- if (node_type == MF_TOPOLOGY_OUTPUT_NODE) + /* Clone and mark source nodes. */ + if (node_type == MF_TOPOLOGY_SOURCESTREAM_NODE) + { + if (FAILED(hr = topology_loader_clone_node(&context, node, NULL, 0))) + { + WARN("Failed to clone source node, hr %#x.\n", hr); + continue; + } + } + else if (node_type == MF_TOPOLOGY_OUTPUT_NODE) { if (SUCCEEDED(hr = IMFTopologyNode_GetObject(node, &object))) {