Signed-off-by: Sergio Gómez Del Real sdelreal@codeweavers.com --- dlls/mf/topology.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index a6342c0c4e..4d437e6961 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -1935,9 +1935,18 @@ static ULONG WINAPI topology_loader_Release(IMFTopoLoader *iface) return refcount; }
+struct topoloader_context +{ + IMFTopology *input_topology; + IMFTopology *output_topology; + GUID key; + unsigned int marker; +}; + static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *input_topology, IMFTopology **output_topology, IMFTopology *current_topology) { + struct topoloader_context context = { 0 }; MF_TOPOLOGY_TYPE node_type; IMFTopologyNode *node; IMFStreamSink *sink; @@ -1952,14 +1961,15 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in FIXME("Current topology instance is ignored.\n");
if (FAILED(IMFTopology_GetNodeCount(input_topology, &count)) + || FAILED(MFCreateTopology(&context.output_topology)) || count < 2) { hr = MF_E_TOPO_UNSUPPORTED; return hr; }
- if (FAILED(hr = MFCreateTopology(output_topology))) - return hr; + context.input_topology = input_topology; + memset(&context.key, 0xff, sizeof(context.key));
i = 0; while (SUCCEEDED(IMFTopology_GetNode(input_topology, i++, &node))) @@ -1973,6 +1983,7 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in /* Sinks must be bound beforehand. */ if (FAILED(IUnknown_QueryInterface(object, &IID_IMFStreamSink, (void **)&sink))) { + IMFTopology_Release(context.output_topology); IMFTopologyNode_Release(node); IUnknown_Release(object); hr = MF_E_TOPO_SINK_ACTIVATES_UNSUPPORTED; @@ -1986,7 +1997,10 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in IMFTopologyNode_Release(node); }
- return IMFTopology_CloneFrom(*output_topology, input_topology); + if (SUCCEEDED(hr = IMFTopology_CloneFrom(context.output_topology, input_topology))) + *output_topology = context.output_topology; + + return hr; }
static const IMFTopoLoaderVtbl topologyloadervtbl =