Module: wine Branch: master Commit: 6bed7314ca10918d1454bf4602a648a997cd28d7 URL: https://gitlab.winehq.org/wine/wine/-/commit/6bed7314ca10918d1454bf4602a648a...
Author: Rémi Bernon rbernon@codeweavers.com Date: Mon May 6 18:09:36 2024 +0200
winegstreamer: Allow to clear video decoder input/output types.
---
dlls/mf/tests/transform.c | 10 ++++++++-- dlls/winegstreamer/video_decoder.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 0291fe16e18..1ca6652598d 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -5886,6 +5886,7 @@ static void test_wmv_decoder(void) const struct sample_desc *output_sample_desc; const WCHAR *result_bitmap; ULONG delta; + BOOL todo; } transform_tests[] = { @@ -5908,7 +5909,7 @@ static void test_wmv_decoder(void) .expect_output_info = &expect_output_info, .output_sample_desc = &output_sample_desc_nv12_todo_time, .result_bitmap = L"nv12frame.bmp", - .delta = 0, + .delta = 0, .todo = TRUE, },
{ @@ -5941,7 +5942,7 @@ static void test_wmv_decoder(void) .expect_output_info = &expect_output_info_rgb, .output_sample_desc = &output_sample_desc_rgb, .result_bitmap = L"rgb32frame-flip.bmp", - .delta = 5, + .delta = 5, .todo = TRUE, },
}; @@ -6114,8 +6115,13 @@ static void test_wmv_decoder(void)
ret = check_mf_sample_collection(output_samples, transform_tests[j].output_sample_desc, transform_tests[j].result_bitmap); + todo_wine_if(transform_tests[j].todo) ok(ret <= transform_tests[j].delta, "got %lu%% diff\n", ret); IMFCollection_Release(output_samples); + + hr = IMFTransform_SetOutputType(transform, 0, NULL, 0); + ok(hr == S_OK, "SetOutputType returned %#lx\n", hr); + winetest_pop_context(); }
diff --git a/dlls/winegstreamer/video_decoder.c b/dlls/winegstreamer/video_decoder.c index 6525cbff513..948fc6ab0ec 100644 --- a/dlls/winegstreamer/video_decoder.c +++ b/dlls/winegstreamer/video_decoder.c @@ -546,6 +546,27 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM
TRACE("iface %p, id %#lx, type %p, flags %#lx.\n", iface, id, type, flags);
+ if (!type) + { + if (decoder->input_type) + { + IMFMediaType_Release(decoder->input_type); + decoder->input_type = NULL; + } + if (decoder->output_type) + { + IMFMediaType_Release(decoder->output_type); + decoder->output_type = NULL; + } + if (decoder->wg_transform) + { + wg_transform_destroy(decoder->wg_transform); + decoder->wg_transform = 0; + } + + return S_OK; + } + if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major)) || FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_SUBTYPE, &subtype))) return E_INVALIDARG; @@ -597,6 +618,22 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF
TRACE("iface %p, id %#lx, type %p, flags %#lx.\n", iface, id, type, flags);
+ if (!type) + { + if (decoder->output_type) + { + IMFMediaType_Release(decoder->output_type); + decoder->output_type = NULL; + } + if (decoder->wg_transform) + { + wg_transform_destroy(decoder->wg_transform); + decoder->wg_transform = 0; + } + + return S_OK; + } + if (!decoder->input_type) return MF_E_TRANSFORM_TYPE_NOT_SET;