Signed-off-by: Sergio Gómez Del Real sdelreal@codeweavers.com --- dlls/mf/topology.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index 83e3b0a7c5..20f351bfb3 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -1943,6 +1943,28 @@ struct topoloader_context unsigned int marker; };
+static int topology_loader_get_branch_depth(IMFTopologyNode *node, int level) +{ + IMFTopologyNode *current_node; + MF_TOPOLOGY_TYPE node_type; + static int max_level = 0; + + if (level > max_level) + max_level = level; + + IMFTopologyNode_GetNodeType(node, &node_type); + if (node_type == MF_TOPOLOGY_SOURCESTREAM_NODE || node_type == MF_TOPOLOGY_TRANSFORM_NODE) + { + int stream = 0; + DWORD input_stream; + + while (SUCCEEDED(IMFTopologyNode_GetOutput(node, stream++, ¤t_node, &input_stream))) + topology_loader_get_branch_depth(current_node, level + 1); + } + + return max_level; +} + static HRESULT topology_loader_clone_node(struct topoloader_context *context, IMFTopologyNode *node, IMFTopologyNode **ret, unsigned int marker) { @@ -1978,13 +2000,13 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in IMFTopology **output_topology, IMFTopology *current_topology) { struct topoloader_context context = { 0 }; + unsigned short i, max_branch_depth = 0; MF_TOPOLOGY_TYPE node_type; IMFTopologyNode *node; IMFStreamSink *sink; IUnknown *object; WORD count; HRESULT hr; - size_t i;
FIXME("%p, %p, %p, %p.\n", iface, input_topology, output_topology, current_topology);
@@ -2010,11 +2032,16 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in /* Clone and mark source nodes. */ if (node_type == MF_TOPOLOGY_SOURCESTREAM_NODE) { + unsigned int branch_depth; + if (FAILED(hr = topology_loader_clone_node(&context, node, NULL, 0))) { WARN("Failed to clone source node, hr %#x.\n", hr); continue; } + branch_depth = topology_loader_get_branch_depth(node, 0); + if (branch_depth > max_branch_depth) + max_branch_depth = branch_depth; } else if (node_type == MF_TOPOLOGY_OUTPUT_NODE) {