[PATCH v2 0/4] MR9935: winegstreamer: Fix some small issues with the resampler.
These fixes will be needed for the topology loader patches. -- v2: mf/tests: Test resampler output type after setting the input type. https://gitlab.winehq.org/wine/wine/-/merge_requests/9935
From: Conor McCarthy <cmccarthy@codeweavers.com> The audio resampler does not implement this behaviour. --- dlls/winegstreamer/resampler.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dlls/winegstreamer/resampler.c b/dlls/winegstreamer/resampler.c index 910d109c2c6..2b79a613baa 100644 --- a/dlls/winegstreamer/resampler.c +++ b/dlls/winegstreamer/resampler.c @@ -374,12 +374,6 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM if (!impl->input_type && FAILED(hr = MFCreateMediaType(&impl->input_type))) return hr; - if (impl->output_type) - { - IMFMediaType_Release(impl->output_type); - impl->output_type = NULL; - } - if (SUCCEEDED(hr = IMFMediaType_CopyAllItems(type, (IMFAttributes *)impl->input_type))) impl->input_info.cbSize = block_alignment; else -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9935
From: Conor McCarthy <cmccarthy@codeweavers.com> --- dlls/winegstreamer/resampler.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/resampler.c b/dlls/winegstreamer/resampler.c index 2b79a613baa..e861c86f737 100644 --- a/dlls/winegstreamer/resampler.c +++ b/dlls/winegstreamer/resampler.c @@ -327,6 +327,9 @@ static HRESULT check_media_type(IMFMediaType *type) HRESULT hr; ULONG i; + if (!type) + return S_OK; + if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major)) || FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_SUBTYPE, &subtype))) return MF_E_ATTRIBUTENOTFOUND; @@ -366,11 +369,21 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM if (FAILED(hr = check_media_type(type))) return hr; - if (FAILED(hr = IMFMediaType_GetUINT32(type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, &block_alignment))) + if (type && FAILED(hr = IMFMediaType_GetUINT32(type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, &block_alignment))) return MF_E_INVALIDMEDIATYPE; if (flags & MFT_SET_TYPE_TEST_ONLY) return S_OK; + if (!type) + { + if (impl->input_type) + { + IMFMediaType_Release(impl->input_type); + impl->input_type = NULL; + } + return S_OK; + } + if (!impl->input_type && FAILED(hr = MFCreateMediaType(&impl->input_type))) return hr; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9935
From: Conor McCarthy <cmccarthy@codeweavers.com> --- dlls/winegstreamer/resampler.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/resampler.c b/dlls/winegstreamer/resampler.c index e861c86f737..fcaadac17e0 100644 --- a/dlls/winegstreamer/resampler.c +++ b/dlls/winegstreamer/resampler.c @@ -412,11 +412,21 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF if (FAILED(hr = check_media_type(type))) return hr; - if (FAILED(hr = IMFMediaType_GetUINT32(type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, &block_alignment))) + if (type && FAILED(hr = IMFMediaType_GetUINT32(type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, &block_alignment))) return MF_E_INVALIDMEDIATYPE; if (flags & MFT_SET_TYPE_TEST_ONLY) return S_OK; + if (!type) + { + if (impl->output_type) + { + IMFMediaType_Release(impl->output_type); + impl->output_type = NULL; + } + return S_OK; + } + if (!impl->output_type && FAILED(hr = MFCreateMediaType(&impl->output_type))) return hr; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9935
From: Conor McCarthy <cmccarthy@codeweavers.com> --- dlls/mf/tests/transform.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 4dd9ff7a93e..e8602bb73b0 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -6171,6 +6171,10 @@ static void test_audio_convert(void) check_mft_set_output_type(transform, output_type_desc, S_OK); check_mft_get_output_current_type_(__LINE__, transform, expect_output_type_desc, FALSE, TRUE); + check_mft_set_input_type(transform, input_type_desc, S_OK); + /* setting the input type does not set the output type to null */ + check_mft_get_output_current_type_(__LINE__, transform, expect_output_type_desc, FALSE, TRUE); + check_mft_get_input_stream_info(transform, S_OK, &input_info); check_mft_get_output_stream_info(transform, S_OK, &output_info); @@ -6228,6 +6232,15 @@ static void test_audio_convert(void) ret = IMFSample_Release(output_sample); ok(ret == 0, "Release returned %lu\n", ret); + /* setting the input type to null does not set the output type to null */ + hr = IMFTransform_SetInputType(transform, 0, NULL, 0); + ok(hr == S_OK, "SetInputType returned %#lx\n", hr); + hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); + ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetInputCurrentType returned hr %#lx.\n", hr); + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "GetOutputCurrentType returned hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + ret = IMFTransform_Release(transform); ok(ret == 0, "Release returned %lu\n", ret); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9935
On Thu Jan 22 19:32:12 2026 +0000, Nikolay Sivov wrote:
Does this make GetInputCurrentType() return NULL as well? Or maybe it simply ignores NULL input. Added a test for this. It returns MF_E_TRANSFORM_TYPE_NOT_SET.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9935#note_127742
This merge request was closed by Conor McCarthy. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9935
participants (2)
-
Conor McCarthy -
Conor McCarthy (@cmccarthy)