From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winegstreamer/resampler.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/dlls/winegstreamer/resampler.c b/dlls/winegstreamer/resampler.c index ea000e3b96f..5965a337f20 100644 --- a/dlls/winegstreamer/resampler.c +++ b/dlls/winegstreamer/resampler.c @@ -435,7 +435,6 @@ failed: static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) { struct resampler *impl = impl_from_IMFTransform(iface); - IMFMediaType *ret; HRESULT hr;
TRACE("iface %p, id %#lx, type %p.\n", iface, id, type); @@ -446,16 +445,15 @@ static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD i if (!impl->input_type) return MF_E_TRANSFORM_TYPE_NOT_SET;
- if (FAILED(hr = MFCreateMediaType(&ret))) + if (FAILED(hr = MFCreateMediaType(type))) return hr;
- return IMFMediaType_CopyAllItems(impl->input_type, (IMFAttributes *)ret); + return IMFMediaType_CopyAllItems(impl->input_type, (IMFAttributes *)*type); }
static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) { struct resampler *impl = impl_from_IMFTransform(iface); - IMFMediaType *ret; HRESULT hr;
TRACE("iface %p, id %#lx, type %p.\n", iface, id, type); @@ -466,10 +464,10 @@ static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD if (!impl->output_type) return MF_E_TRANSFORM_TYPE_NOT_SET;
- if (FAILED(hr = MFCreateMediaType(&ret))) + if (FAILED(hr = MFCreateMediaType(type))) return hr;
- return IMFMediaType_CopyAllItems(impl->output_type, (IMFAttributes *)ret); + return IMFMediaType_CopyAllItems(impl->output_type, (IMFAttributes *)*type); }
static HRESULT WINAPI transform_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags)
From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winegstreamer/color_convert.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/dlls/winegstreamer/color_convert.c b/dlls/winegstreamer/color_convert.c index 66a86aa4602..b84cad37dd3 100644 --- a/dlls/winegstreamer/color_convert.c +++ b/dlls/winegstreamer/color_convert.c @@ -466,7 +466,6 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) { struct color_convert *impl = impl_from_IMFTransform(iface); - IMFMediaType *ret; HRESULT hr;
TRACE("iface %p, id %#lx, type %p.\n", iface, id, type); @@ -477,16 +476,15 @@ static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD i if (!impl->input_type) return MF_E_TRANSFORM_TYPE_NOT_SET;
- if (FAILED(hr = MFCreateMediaType(&ret))) + if (FAILED(hr = MFCreateMediaType(type))) return hr;
- return IMFMediaType_CopyAllItems(impl->input_type, (IMFAttributes *)ret); + return IMFMediaType_CopyAllItems(impl->input_type, (IMFAttributes *)*type); }
static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) { struct color_convert *impl = impl_from_IMFTransform(iface); - IMFMediaType *ret; HRESULT hr;
TRACE("iface %p, id %#lx, type %p.\n", iface, id, type); @@ -497,10 +495,10 @@ static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD if (!impl->output_type) return MF_E_TRANSFORM_TYPE_NOT_SET;
- if (FAILED(hr = MFCreateMediaType(&ret))) + if (FAILED(hr = MFCreateMediaType(type))) return hr;
- return IMFMediaType_CopyAllItems(impl->output_type, (IMFAttributes *)ret); + return IMFMediaType_CopyAllItems(impl->output_type, (IMFAttributes *)*type); }
static HRESULT WINAPI transform_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags)
From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 229 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 198 insertions(+), 31 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 8d725a65515..eaac991566b 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -5858,8 +5858,19 @@ static void test_sample_copier_output_processing(void)
static void test_MFGetTopoNodeCurrentType(void) { - IMFMediaType *media_type, *media_type2; + static const struct attribute_desc media_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1080), + {0}, + }; + IMFMediaType *media_type, *input_types[2], *output_types[2]; + IMFStreamDescriptor *input_descriptor, *output_descriptor; + IMFMediaTypeHandler *input_handler, *output_handler; + IMFTransform *transform; IMFTopologyNode *node; + DWORD flags; HRESULT hr; LONG ref;
@@ -5869,80 +5880,236 @@ static void test_MFGetTopoNodeCurrentType(void) return; }
+ hr = CoInitialize(NULL); + ok(hr == S_OK, "Failed to initialize, hr %#lx.\n", hr); + + hr = MFCreateMediaType(&input_types[0]); + ok(hr == S_OK, "Failed to create media type, hr %#lx.\n", hr); + init_media_type(input_types[0], media_type_desc, -1); + hr = MFCreateMediaType(&input_types[1]); + ok(hr == S_OK, "Failed to create media type, hr %#lx.\n", hr); + init_media_type(input_types[1], media_type_desc, -1); + hr = MFCreateMediaType(&output_types[0]); + ok(hr == S_OK, "Failed to create media type, hr %#lx.\n", hr); + init_media_type(output_types[0], media_type_desc, -1); + hr = MFCreateMediaType(&output_types[1]); + ok(hr == S_OK, "Failed to create media type, hr %#lx.\n", hr); + init_media_type(output_types[1], media_type_desc, -1); + + hr = MFCreateStreamDescriptor(0, 2, input_types, &input_descriptor); + ok(hr == S_OK, "Failed to create IMFStreamDescriptor hr %#lx.\n", hr); + hr = IMFStreamDescriptor_GetMediaTypeHandler(input_descriptor, &input_handler); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = MFCreateStreamDescriptor(0, 2, output_types, &output_descriptor); + ok(hr == S_OK, "Failed to create IMFStreamDescriptor hr %#lx.\n", hr); + hr = IMFStreamDescriptor_GetMediaTypeHandler(output_descriptor, &output_handler); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = CoCreateInstance(&CLSID_CColorConvertDMO, NULL, CLSCTX_INPROC_SERVER, &IID_IMFTransform, (void **)&transform); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + /* Tee node. */ hr = MFCreateTopologyNode(MF_TOPOLOGY_TEE_NODE, &node); ok(hr == S_OK, "Failed to create a node, hr %#lx.\n", hr); - hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); - hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
- hr = MFCreateMediaType(&media_type2); - ok(hr == S_OK, "Failed to create media type, hr %#lx.\n", hr); + /* Set second output. */ + hr = IMFTopologyNode_SetOutputPrefType(node, 1, output_types[1]); + ok(hr == S_OK, "Failed to set media type, hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 1, TRUE, &media_type); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 1, FALSE, &media_type); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + + /* Set first output. */ + hr = IMFTopologyNode_SetOutputPrefType(node, 0, output_types[0]); + ok(hr == S_OK, "Failed to set media type, hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(media_type == output_types[0], "Unexpected pointer.\n"); + IMFMediaType_Release(media_type); + hr = pMFGetTopoNodeCurrentType(node, 1, TRUE, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(media_type == output_types[0], "Unexpected pointer.\n"); + IMFMediaType_Release(media_type); + hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(media_type == output_types[0], "Unexpected pointer.\n"); + IMFMediaType_Release(media_type);
- hr = IMFMediaType_SetGUID(media_type2, &MF_MT_MAJOR_TYPE, &MFMediaType_Video); + /* Set primary output. */ + hr = IMFTopologyNode_SetOutputPrefType(node, 1, output_types[1]); + ok(hr == S_OK, "Failed to set media type, hr %#lx.\n", hr); + hr = IMFTopologyNode_SetUINT32(node, &MF_TOPONODE_PRIMARYOUTPUT, 1); ok(hr == S_OK, "Failed to set attribute, hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(media_type == output_types[1], "Unexpected pointer.\n"); + IMFMediaType_Release(media_type); + hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(media_type == output_types[1], "Unexpected pointer.\n"); + IMFMediaType_Release(media_type); + hr = pMFGetTopoNodeCurrentType(node, 1, FALSE, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(media_type == output_types[1], "Unexpected pointer.\n"); + IMFMediaType_Release(media_type);
/* Input type returned, if set. */ - hr = IMFTopologyNode_SetInputPrefType(node, 0, media_type2); + hr = IMFTopologyNode_SetInputPrefType(node, 0, input_types[0]); ok(hr == S_OK, "Failed to set media type, hr %#lx.\n", hr); - hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(media_type == media_type2, "Unexpected pointer.\n"); + ok(media_type == input_types[0], "Unexpected pointer.\n"); + IMFMediaType_Release(media_type); + hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(media_type == input_types[0], "Unexpected pointer.\n"); IMFMediaType_Release(media_type);
hr = IMFTopologyNode_SetInputPrefType(node, 0, NULL); ok(hr == S_OK, "Failed to set media type, hr %#lx.\n", hr); + hr = IMFTopologyNode_SetOutputPrefType(node, 0, NULL); + ok(hr == S_OK, "Failed to set media type, hr %#lx.\n", hr); + hr = IMFTopologyNode_SetOutputPrefType(node, 1, NULL); + ok(hr == S_OK, "Failed to set media type, hr %#lx.\n", hr); + ref = IMFTopologyNode_Release(node); + ok(ref == 0, "Release returned %ld\n", ref); +
+ /* Source node. */ + hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &node); + ok(hr == S_OK, "Failed to create a node, hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 1, TRUE, &media_type); + todo_wine + ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); - ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr); + + hr = IMFTopologyNode_SetUnknown(node, &MF_TOPONODE_STREAM_DESCRIPTOR, (IUnknown *)input_descriptor); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); + ok(hr == MF_E_NOT_INITIALIZED, "Unexpected hr %#lx.\n", hr); + + hr = IMFMediaTypeHandler_SetCurrentMediaType(input_handler, output_types[0]); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(media_type == output_types[0], "Unexpected pointer.\n"); + IMFMediaType_Release(media_type); + + ref = IMFTopologyNode_Release(node); + ok(ref == 0, "Release returned %ld\n", ref);
- /* Set second output. */ - hr = IMFTopologyNode_SetOutputPrefType(node, 1, media_type2); - ok(hr == S_OK, "Failed to set media type, hr %#lx.\n", hr);
+ /* Output node. */ + hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &node); + ok(hr == S_OK, "Failed to create a node, hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); + todo_wine ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 1, FALSE, &media_type); + todo_wine + ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); + todo_wine + ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr);
- hr = IMFTopologyNode_SetOutputPrefType(node, 1, NULL); - ok(hr == S_OK, "Failed to set media type, hr %#lx.\n", hr); - - /* Set first output. */ - hr = IMFTopologyNode_SetOutputPrefType(node, 0, media_type2); - ok(hr == S_OK, "Failed to set media type, hr %#lx.\n", hr); + hr = IMFTopologyNode_SetObject(node, (IUnknown *)output_handler); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); + todo_wine + ok(hr == MF_E_NOT_INITIALIZED, "Unexpected hr %#lx.\n", hr);
+ media_type = NULL; + hr = IMFMediaTypeHandler_SetCurrentMediaType(output_handler, input_types[0]); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(media_type == media_type2, "Unexpected pointer.\n"); - IMFMediaType_Release(media_type); + todo_wine + ok(media_type == input_types[0], "Unexpected pointer.\n"); + if (media_type) IMFMediaType_Release(media_type);
- hr = IMFTopologyNode_SetOutputPrefType(node, 0, NULL); - ok(hr == S_OK, "Failed to set media type, hr %#lx.\n", hr); + ref = IMFTopologyNode_Release(node); + ok(ref == 0, "Release returned %ld\n", ref);
- /* Set primary output. */ - hr = IMFTopologyNode_SetOutputPrefType(node, 1, media_type2); - ok(hr == S_OK, "Failed to set media type, hr %#lx.\n", hr);
- hr = IMFTopologyNode_SetUINT32(node, &MF_TOPONODE_PRIMARYOUTPUT, 1); - ok(hr == S_OK, "Failed to set attribute, hr %#lx.\n", hr); + /* Transform node. */ + hr = MFCreateTopologyNode(MF_TOPOLOGY_TRANSFORM_NODE, &node); + ok(hr == S_OK, "Failed to create a node, hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 1, TRUE, &media_type); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 1, FALSE, &media_type); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
+ hr = IMFTopologyNode_SetObject(node, (IUnknown *)transform); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); + ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 1, TRUE, &media_type); + ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); + ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 1, FALSE, &media_type); + ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr); + + hr = IMFTransform_SetInputType(transform, 0, input_types[0], 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); + ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#lx.\n", hr); + hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_IsEqual(media_type, input_types[0], &flags); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(media_type == media_type2, "Unexpected pointer.\n"); IMFMediaType_Release(media_type);
+ hr = IMFTransform_SetOutputType(transform, 0, output_types[0], 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(media_type == media_type2, "Unexpected pointer.\n"); + hr = IMFMediaType_IsEqual(media_type, output_types[0], &flags); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); IMFMediaType_Release(media_type);
ref = IMFTopologyNode_Release(node); ok(ref == 0, "Release returned %ld\n", ref); - ref = IMFMediaType_Release(media_type2); + + + ref = IMFTransform_Release(transform); ok(ref == 0, "Release returned %ld\n", ref); + + IMFMediaTypeHandler_Release(input_handler); + IMFMediaTypeHandler_Release(output_handler); + ref = IMFStreamDescriptor_Release(input_descriptor); + ok(ref == 0, "Release returned %ld\n", ref); + ref = IMFStreamDescriptor_Release(output_descriptor); + ok(ref == 0, "Release returned %ld\n", ref); + + ref = IMFMediaType_Release(input_types[0]); + ok(ref == 0, "Release returned %ld\n", ref); + ref = IMFMediaType_Release(input_types[1]); + ok(ref == 0, "Release returned %ld\n", ref); + ref = IMFMediaType_Release(output_types[0]); + ok(ref == 0, "Release returned %ld\n", ref); + ref = IMFMediaType_Release(output_types[1]); + ok(ref == 0, "Release returned %ld\n", ref); + + CoUninitialize(); }
static void init_functions(void)
From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 6 +----- dlls/mf/topology.c | 13 +++---------- 2 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index eaac991566b..615767296b1 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -6017,7 +6017,6 @@ static void test_MFGetTopoNodeCurrentType(void) hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &node); ok(hr == S_OK, "Failed to create a node, hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); - todo_wine ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 1, FALSE, &media_type); todo_wine @@ -6029,17 +6028,14 @@ static void test_MFGetTopoNodeCurrentType(void) hr = IMFTopologyNode_SetObject(node, (IUnknown *)output_handler); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); - todo_wine ok(hr == MF_E_NOT_INITIALIZED, "Unexpected hr %#lx.\n", hr);
- media_type = NULL; hr = IMFMediaTypeHandler_SetCurrentMediaType(output_handler, input_types[0]); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(media_type == input_types[0], "Unexpected pointer.\n"); - if (media_type) IMFMediaType_Release(media_type); + IMFMediaType_Release(media_type);
ref = IMFTopologyNode_Release(node); ok(ref == 0, "Release returned %ld\n", ref); diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index 8d64c10b5c7..f4c28e747db 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -1827,7 +1827,6 @@ HRESULT WINAPI MFGetTopoNodeCurrentType(IMFTopologyNode *node, DWORD stream, BOO { IMFMediaTypeHandler *type_handler; MF_TOPOLOGY_TYPE node_type; - IMFStreamSink *stream_sink; IMFStreamDescriptor *sd; IMFTransform *transform; UINT32 primary_output; @@ -1841,16 +1840,10 @@ HRESULT WINAPI MFGetTopoNodeCurrentType(IMFTopologyNode *node, DWORD stream, BOO switch (node_type) { case MF_TOPOLOGY_OUTPUT_NODE: - if (SUCCEEDED(topology_node_get_object(node, &IID_IMFStreamSink, (void **)&stream_sink))) + if (SUCCEEDED(hr = topology_node_get_object(node, &IID_IMFMediaTypeHandler, (void **)&type_handler))) { - hr = IMFStreamSink_GetMediaTypeHandler(stream_sink, &type_handler); - IMFStreamSink_Release(stream_sink); - - if (SUCCEEDED(hr)) - { - hr = IMFMediaTypeHandler_GetCurrentMediaType(type_handler, type); - IMFMediaTypeHandler_Release(type_handler); - } + hr = IMFMediaTypeHandler_GetCurrentMediaType(type_handler, type); + IMFMediaTypeHandler_Release(type_handler); } break; case MF_TOPOLOGY_SOURCESTREAM_NODE:
From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 4 ---- dlls/mf/topology.c | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 615767296b1..f6b1860e3cb 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -5991,10 +5991,8 @@ static void test_MFGetTopoNodeCurrentType(void) hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 1, TRUE, &media_type); - todo_wine ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); - todo_wine ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr);
hr = IMFTopologyNode_SetUnknown(node, &MF_TOPONODE_STREAM_DESCRIPTOR, (IUnknown *)input_descriptor); @@ -6019,10 +6017,8 @@ static void test_MFGetTopoNodeCurrentType(void) hr = pMFGetTopoNodeCurrentType(node, 0, FALSE, &media_type); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 1, FALSE, &media_type); - todo_wine ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr); hr = pMFGetTopoNodeCurrentType(node, 0, TRUE, &media_type); - todo_wine ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr);
hr = IMFTopologyNode_SetObject(node, (IUnknown *)output_handler); diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index f4c28e747db..bb74307dd07 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -1840,6 +1840,9 @@ HRESULT WINAPI MFGetTopoNodeCurrentType(IMFTopologyNode *node, DWORD stream, BOO switch (node_type) { case MF_TOPOLOGY_OUTPUT_NODE: + if (output || stream) + return MF_E_INVALIDSTREAMNUMBER; + if (SUCCEEDED(hr = topology_node_get_object(node, &IID_IMFMediaTypeHandler, (void **)&type_handler))) { hr = IMFMediaTypeHandler_GetCurrentMediaType(type_handler, type); @@ -1847,6 +1850,9 @@ HRESULT WINAPI MFGetTopoNodeCurrentType(IMFTopologyNode *node, DWORD stream, BOO } break; case MF_TOPOLOGY_SOURCESTREAM_NODE: + if (!output || stream) + return MF_E_INVALIDSTREAMNUMBER; + if (FAILED(hr = IMFTopologyNode_GetUnknown(node, &MF_TOPONODE_STREAM_DESCRIPTOR, &IID_IMFStreamDescriptor, (void **)&sd))) {
Nikolay Sivov (@nsivov) commented about dlls/mf/topology.c:
switch (node_type) { case MF_TOPOLOGY_OUTPUT_NODE:
if (SUCCEEDED(topology_node_get_object(node, &IID_IMFStreamSink, (void **)&stream_sink)))
if (SUCCEEDED(hr = topology_node_get_object(node, &IID_IMFMediaTypeHandler, (void **)&type_handler))) {
hr = IMFStreamSink_GetMediaTypeHandler(stream_sink, &type_handler);
IMFStreamSink_Release(stream_sink);
if (SUCCEEDED(hr))
{
hr = IMFMediaTypeHandler_GetCurrentMediaType(type_handler, type);
IMFMediaTypeHandler_Release(type_handler);
}
hr = IMFMediaTypeHandler_GetCurrentMediaType(type_handler, type);
IMFMediaTypeHandler_Release(type_handler);
I there really a requirement to have IMFMediaTypeHandler exposed via QueryInterface() ?
On Mon Jul 4 17:33:04 2022 +0000, Nikolay Sivov wrote:
I there really a requirement to have IMFMediaTypeHandler exposed via QueryInterface() ?
Well it's what the tests suggest. I don't think native even tries to call `IMFStreamSink_GetMediaTypeHandler`, though I don't have the tests at hand to confirm that.
On Mon Jul 4 17:40:48 2022 +0000, Rémi Bernon wrote:
Well it's what the tests suggest. I don't think native even tries to call `IMFStreamSink_GetMediaTypeHandler`, though I don't have the tests at hand to confirm that.
Let me check that again.
On Mon Jul 4 17:54:08 2022 +0000, Rémi Bernon wrote:
Let me check that again.
Yeah sorry, it queries `IMFStreamSink` first indeed, though it also succeeds if the node's object only implements `IMFMediaTypeHandler`.
On Mon Jul 4 18:10:08 2022 +0000, Rémi Bernon wrote:
Yeah sorry, it queries `IMFStreamSink` first indeed, though it also succeeds if the node's object only implements `IMFMediaTypeHandler`.
I see, thanks for checking that. Could you make it work this way? It's probably having two paths to get the handler, maybe even with E_NOINTERFACE if none of the two interfaces are implemented. The reason I think it's better to follow it here is first because sink is not required to expose the handler this way, thus explicit method. And second because in topology context you don't normally set something that doesn't support IMFStreamSink as an output node object.
On Mon Jul 4 18:39:42 2022 +0000, Nikolay Sivov wrote:
I see, thanks for checking that. Could you make it work this way? It's probably having two paths to get the handler, maybe even with E_NOINTERFACE if none of the two interfaces are implemented. The reason I think it's better to follow it here is first because sink is not required to expose the handler this way, thus explicit method. And second because in topology context you don't normally set something that doesn't support IMFStreamSink as an output node object.
I don't think there's really any need to make it support that case after all, it was mostly to make the tests easier to write, and I thought it was correct, but I'll write the tests with a fake IMFStreamSink instead.