Commit b37d3f23 authored by Santino Mazza's avatar Santino Mazza Committed by Alexandre Julliard

mf/topoloader: Preserve input topology id.

parent 4da091ed
...@@ -118,6 +118,7 @@ extern HRESULT urlmon_scheme_handler_construct(REFIID riid, void **obj); ...@@ -118,6 +118,7 @@ extern HRESULT urlmon_scheme_handler_construct(REFIID riid, void **obj);
extern BOOL mf_is_sample_copier_transform(IMFTransform *transform); extern BOOL mf_is_sample_copier_transform(IMFTransform *transform);
extern BOOL mf_is_sar_sink(IMFMediaSink *sink); extern BOOL mf_is_sar_sink(IMFMediaSink *sink);
extern HRESULT create_topology(TOPOID id, IMFTopology **topology);
extern HRESULT topology_node_get_object(IMFTopologyNode *node, REFIID riid, void **obj); extern HRESULT topology_node_get_object(IMFTopologyNode *node, REFIID riid, void **obj);
extern HRESULT topology_node_get_type_handler(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaTypeHandler **handler); extern HRESULT topology_node_get_type_handler(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaTypeHandler **handler);
extern HRESULT topology_node_init_media_type(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaType **type); extern HRESULT topology_node_init_media_type(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaType **type);
...@@ -4179,7 +4179,7 @@ static void test_topology_loader(void) ...@@ -4179,7 +4179,7 @@ static void test_topology_loader(void)
{ {
IMFTopology_GetTopologyID(topology, &oldtopoid); IMFTopology_GetTopologyID(topology, &oldtopoid);
IMFTopology_GetTopologyID(full_topology, &newtopoid); IMFTopology_GetTopologyID(full_topology, &newtopoid);
todo_wine ok(oldtopoid == newtopoid, "Expected the same topology id. %llu == %llu\n", oldtopoid, newtopoid); ok(oldtopoid == newtopoid, "Expected the same topology id. %llu == %llu\n", oldtopoid, newtopoid);
ok(topology != full_topology, "Expected a different object for the resolved topology.\n"); ok(topology != full_topology, "Expected a different object for the resolved topology.\n");
hr = IMFTopology_GetCount(full_topology, &count); hr = IMFTopology_GetCount(full_topology, &count);
...@@ -4331,7 +4331,7 @@ todo_wine { ...@@ -4331,7 +4331,7 @@ todo_wine {
ok(full_topology != topology2, "Unexpected instance.\n"); ok(full_topology != topology2, "Unexpected instance.\n");
IMFTopology_GetTopologyID(topology2, &oldtopoid); IMFTopology_GetTopologyID(topology2, &oldtopoid);
IMFTopology_GetTopologyID(full_topology, &newtopoid); IMFTopology_GetTopologyID(full_topology, &newtopoid);
todo_wine ok(oldtopoid == newtopoid, "Expected the same topology id. %llu == %llu\n", oldtopoid, newtopoid); ok(oldtopoid == newtopoid, "Expected the same topology id. %llu == %llu\n", oldtopoid, newtopoid);
hr = IMFTopology_GetUINT32(topology2, &IID_IMFTopology, &value); hr = IMFTopology_GetUINT32(topology2, &IID_IMFTopology, &value);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
......
...@@ -866,19 +866,11 @@ static TOPOID topology_generate_id(void) ...@@ -866,19 +866,11 @@ static TOPOID topology_generate_id(void)
return next_topology_id; return next_topology_id;
} }
/*********************************************************************** HRESULT create_topology(TOPOID id, IMFTopology **topology)
* MFCreateTopology (mf.@)
*/
HRESULT WINAPI MFCreateTopology(IMFTopology **topology)
{ {
struct topology *object; struct topology *object;
HRESULT hr; HRESULT hr;
TRACE("%p.\n", topology);
if (!topology)
return E_POINTER;
if (!(object = calloc(1, sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -892,13 +884,26 @@ HRESULT WINAPI MFCreateTopology(IMFTopology **topology) ...@@ -892,13 +884,26 @@ HRESULT WINAPI MFCreateTopology(IMFTopology **topology)
return hr; return hr;
} }
object->id = topology_generate_id(); object->id = id;
*topology = &object->IMFTopology_iface; *topology = &object->IMFTopology_iface;
return S_OK; return S_OK;
} }
/***********************************************************************
* MFCreateTopology (mf.@)
*/
HRESULT WINAPI MFCreateTopology(IMFTopology **topology)
{
TRACE("%p.\n", topology);
if (!topology)
return E_POINTER;
return create_topology(topology_generate_id(), topology);
}
static HRESULT WINAPI topology_node_QueryInterface(IMFTopologyNode *iface, REFIID riid, void **out) static HRESULT WINAPI topology_node_QueryInterface(IMFTopologyNode *iface, REFIID riid, void **out)
{ {
struct topology_node *node = impl_from_IMFTopologyNode(iface); struct topology_node *node = impl_from_IMFTopologyNode(iface);
......
...@@ -721,6 +721,7 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in ...@@ -721,6 +721,7 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in
unsigned short i = 0; unsigned short i = 0;
IMFStreamSink *sink; IMFStreamSink *sink;
IUnknown *object; IUnknown *object;
TOPOID topoid;
HRESULT hr = E_FAIL; HRESULT hr = E_FAIL;
FIXME("iface %p, input_topology %p, ret_topology %p, current_topology %p stub!\n", FIXME("iface %p, input_topology %p, ret_topology %p, current_topology %p stub!\n",
...@@ -763,7 +764,8 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in ...@@ -763,7 +764,8 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in
return hr; return hr;
} }
if (FAILED(hr = MFCreateTopology(&output_topology))) IMFTopology_GetTopologyID(input_topology, &topoid);
if (FAILED(hr = create_topology(topoid, &output_topology)))
return hr; return hr;
IMFTopology_CopyAllItems(input_topology, (IMFAttributes *)output_topology); IMFTopology_CopyAllItems(input_topology, (IMFAttributes *)output_topology);
......
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