Commit 16d44b61 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf/topoloader: Clone source nodes as a first layer of resulting topology.

parent 8e343024
...@@ -1933,9 +1933,40 @@ static ULONG WINAPI topology_loader_Release(IMFTopoLoader *iface) ...@@ -1933,9 +1933,40 @@ static ULONG WINAPI topology_loader_Release(IMFTopoLoader *iface)
return refcount; return refcount;
} }
struct topoloader_context
{
IMFTopology *output_topology;
GUID key;
};
static HRESULT topology_loader_clone_node(struct topoloader_context *context, IMFTopologyNode *node,
unsigned int marker)
{
IMFTopologyNode *cloned_node;
MF_TOPOLOGY_TYPE node_type;
HRESULT hr;
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);
IMFTopologyNode_Release(cloned_node);
return hr;
}
static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *input_topology, static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *input_topology,
IMFTopology **output_topology, IMFTopology *current_topology) IMFTopology **ret_topology, IMFTopology *current_topology)
{ {
struct topoloader_context context = { 0 };
IMFTopology *output_topology;
MF_TOPOLOGY_TYPE node_type; MF_TOPOLOGY_TYPE node_type;
IMFTopologyNode *node; IMFTopologyNode *node;
unsigned short i = 0; unsigned short i = 0;
...@@ -1943,7 +1974,7 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in ...@@ -1943,7 +1974,7 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in
IUnknown *object; IUnknown *object;
HRESULT hr = E_FAIL; HRESULT hr = E_FAIL;
FIXME("%p, %p, %p, %p.\n", iface, input_topology, output_topology, current_topology); FIXME("%p, %p, %p, %p.\n", iface, input_topology, ret_topology, current_topology);
if (current_topology) if (current_topology)
FIXME("Current topology instance is ignored.\n"); FIXME("Current topology instance is ignored.\n");
...@@ -1982,10 +2013,32 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in ...@@ -1982,10 +2013,32 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in
return hr; return hr;
} }
if (FAILED(hr = MFCreateTopology(output_topology))) if (FAILED(hr = MFCreateTopology(&output_topology)))
return hr; return hr;
return IMFTopology_CloneFrom(*output_topology, input_topology); context.output_topology = output_topology;
memset(&context.key, 0xff, sizeof(context.key));
/* Clone source nodes, use initial marker value. */
i = 0;
while (SUCCEEDED(IMFTopology_GetNode(input_topology, i++, &node)))
{
IMFTopologyNode_GetNodeType(node, &node_type);
if (node_type == MF_TOPOLOGY_SOURCESTREAM_NODE)
{
if (FAILED(hr = topology_loader_clone_node(&context, node, 0)))
WARN("Failed to clone source node, hr %#x.\n", hr);
}
IMFTopologyNode_Release(node);
}
/* For now return original topology. */
*ret_topology = output_topology;
return IMFTopology_CloneFrom(output_topology, input_topology);
} }
static const IMFTopoLoaderVtbl topologyloadervtbl = static const IMFTopoLoaderVtbl topologyloadervtbl =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment