[PATCH 05/10] mf: Get max depth of branches in input topology in _Load().
Sergio Gómez Del Real
sdelreal at codeweavers.com
Mon Jun 22 19:36:32 CDT 2020
On 22/06/20 6:44 a. m., Nikolay Sivov wrote:
> On 6/15/20 4:41 AM, Sergio Gómez Del Real wrote:
>> +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;
>> +}
> I don't understand the purpose of this. Could you elaborate? I see it's
> used in 6/10, but why can't we
> iterate until output node is reached?
At any point in the branch, a node could have multiple output streams,
issuing multiple sub-branches, leading to other nodes with potential for
further sub-branching. This gives some generality without complicating
matters too much. The idea is to get the deepest level present in the
branch(es) starting at a source, hence the use of max_level.
> P.S. regardless of the above, static variable should not be used for this.
Why?
More information about the wine-devel
mailing list