Signed-off-by: Sergio Gómez Del Real sdelreal@codeweavers.com --- dlls/mf/topology.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index 3090ba9bce..70b9f4962c 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,13 +1961,16 @@ 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(output_topology)) + || FAILED(MFCreateTopology(&context.output_topology)) || count < 2) { hr = MF_E_TOPO_UNSUPPORTED; return hr; }
+ context.input_topology = input_topology; + memset(&context.key, 0xff, sizeof(context.key)); + i = 0; while (SUCCEEDED(IMFTopology_GetNode(input_topology, i++, &node))) { @@ -1971,7 +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(*output_topology); + IMFTopology_Release(context.output_topology); IMFTopologyNode_Release(node); IUnknown_Release(object); hr = MF_E_TOPO_SINK_ACTIVATES_UNSUPPORTED; @@ -1985,7 +1997,12 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in IMFTopologyNode_Release(node); }
- return IMFTopology_CloneFrom(*output_topology, input_topology); + if (FAILED(hr = IMFTopology_CloneFrom(context.output_topology, input_topology))) + IMFTopology_Release(context.output_topology); + else + *output_topology = context.output_topology; + + return hr; }
static const IMFTopoLoaderVtbl topologyloadervtbl =