[PATCH v5 0/5] MR9575: winegstreamer: Reject SetOutputType with a different number of channels.
-- v5: winegstreamer: Reject SetOutput with a different number of channels. winegstreamer: Reject setting WMA DMO with an output type with a wrong formattype. mf/tests: Test if WMV decoder DMO accepts output type with a different size. mf/tests: Test SetOutputType with a wrong formattype on WMA decoder. mf/tests: Test if WMA decoder DMO accept output type with a different num of channels. https://gitlab.winehq.org/wine/wine/-/merge_requests/9575
From: Yuxuan Shui <yshui@codeweavers.com> --- dlls/mf/tests/transform.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index c680781cd91..872e8f5c270 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -4079,6 +4079,24 @@ static void test_wma_decoder_dmo_output_type(void) MoFreeMediaType(input_type); MoFreeMediaType(&type); + /* Test setting output type to a type with less channels. */ + init_dmo_media_type_audio(bad_output_type, &MEDIASUBTYPE_PCM, 1, rate, bits_per_sample); + hr = IMediaObject_SetOutputType(dmo, 0, bad_output_type, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); + + /* Test setting output type to a type with more channels. */ + init_dmo_media_type_audio(input_type, input_subtype, 1, rate, 16); + ((WAVEFORMATEX *)(input_type + 1))->nBlockAlign = 640; + ((WAVEFORMATEX *)(input_type + 1))->nAvgBytesPerSec = 2000; + init_dmo_media_type_audio(good_output_type, &MEDIASUBTYPE_PCM, 1, rate, bits_per_sample); + hr = IMediaObject_SetInputType(dmo, 0, input_type, 0); + ok(hr == S_OK, "SetInputType returned %#lx.\n", hr); + hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, 0); + ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); + init_dmo_media_type_audio(bad_output_type, &MEDIASUBTYPE_PCM, 2, rate, bits_per_sample); + hr = IMediaObject_SetOutputType(dmo, 0, bad_output_type, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); + init_dmo_media_type_audio(input_type, input_subtype, channel_count, rate * 2, 32); hr = IMediaObject_SetInputType(dmo, 0, input_type, 0); ok(hr == S_OK, "SetInputType returned %#lx.\n", hr); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9575
From: Yuxuan Shui <yshui@codeweavers.com> --- dlls/mf/tests/transform.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 872e8f5c270..5e72312d07a 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -4021,6 +4021,10 @@ static void test_wma_decoder_dmo_output_type(void) ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); hr = IMediaObject_SetOutputType(dmo, 0, bad_output_type, 0x4); ok(hr == E_INVALIDARG, "SetOutputType returned %#lx.\n", hr); + init_dmo_media_type_audio(bad_output_type, &MEDIASUBTYPE_PCM, channel_count, rate, bits_per_sample); + bad_output_type->formattype = FORMAT_VideoInfo; /* What if formattype is wrong? */ + hr = IMediaObject_SetOutputType(dmo, 0, bad_output_type, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, 0); ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9575
From: Yuxuan Shui <yshui@codeweavers.com> --- dlls/mf/tests/transform.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 5e72312d07a..e865cbc2412 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -8018,6 +8018,7 @@ static void test_wmv_decoder_dmo_output_type(void) const GUID* input_subtype = &MEDIASUBTYPE_WMV1; REFERENCE_TIME time_per_frame = 10000000; LONG width = 16, height = 16; + VIDEOINFOHEADER *vih; DWORD count, i, ret; IMediaObject *dmo; HRESULT hr; @@ -8200,6 +8201,17 @@ static void test_wmv_decoder_dmo_output_type(void) hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, 0x4); ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); + /* Does DMO accept a format with a different size? */ + vih = (VIDEOINFOHEADER *)good_output_type->pbFormat; + vih->bmiHeader.biHeight += 10; + vih->bmiHeader.biWidth += 10; + vih->rcSource.bottom += 10; + vih->rcSource.right += 10; + vih->rcTarget.bottom += 10; + vih->rcTarget.right += 10; + hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, 0); + ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); + /* Release. */ ret = IMediaObject_Release(dmo); ok(ret == 0, "Release returned %lu\n", ret); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9575
From: Yuxuan Shui <yshui@codeweavers.com> --- dlls/mf/tests/transform.c | 2 +- dlls/winegstreamer/wma_decoder.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index e865cbc2412..9338121fb30 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -4024,7 +4024,7 @@ static void test_wma_decoder_dmo_output_type(void) init_dmo_media_type_audio(bad_output_type, &MEDIASUBTYPE_PCM, channel_count, rate, bits_per_sample); bad_output_type->formattype = FORMAT_VideoInfo; /* What if formattype is wrong? */ hr = IMediaObject_SetOutputType(dmo, 0, bad_output_type, 0); - todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); + ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, 0); ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); diff --git a/dlls/winegstreamer/wma_decoder.c b/dlls/winegstreamer/wma_decoder.c index 4aa90b85c6b..ba9547e9a34 100644 --- a/dlls/winegstreamer/wma_decoder.c +++ b/dlls/winegstreamer/wma_decoder.c @@ -798,6 +798,9 @@ static HRESULT WINAPI media_object_SetOutputType(IMediaObject *iface, DWORD inde if (IsEqualGUID(&decoder->input_type.majortype, &GUID_NULL)) return DMO_E_TYPE_NOT_SET; + if (!IsEqualGUID(&type->formattype, &FORMAT_WaveFormatEx)) + return DMO_E_TYPE_NOT_ACCEPTED; + if (FAILED(hr = wg_transform_create_quartz(&decoder->input_type, type, &attrs, &new_transform))) return hr; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9575
From: Yuxuan Shui <yshui@codeweavers.com> --- dlls/mf/tests/transform.c | 4 ++-- dlls/winegstreamer/wma_decoder.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 9338121fb30..4dd9ff7a93e 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -4086,7 +4086,7 @@ static void test_wma_decoder_dmo_output_type(void) /* Test setting output type to a type with less channels. */ init_dmo_media_type_audio(bad_output_type, &MEDIASUBTYPE_PCM, 1, rate, bits_per_sample); hr = IMediaObject_SetOutputType(dmo, 0, bad_output_type, 0); - todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); + ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); /* Test setting output type to a type with more channels. */ init_dmo_media_type_audio(input_type, input_subtype, 1, rate, 16); @@ -4099,7 +4099,7 @@ static void test_wma_decoder_dmo_output_type(void) ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); init_dmo_media_type_audio(bad_output_type, &MEDIASUBTYPE_PCM, 2, rate, bits_per_sample); hr = IMediaObject_SetOutputType(dmo, 0, bad_output_type, 0); - todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); + ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); init_dmo_media_type_audio(input_type, input_subtype, channel_count, rate * 2, 32); hr = IMediaObject_SetInputType(dmo, 0, input_type, 0); diff --git a/dlls/winegstreamer/wma_decoder.c b/dlls/winegstreamer/wma_decoder.c index ba9547e9a34..76308a8e63e 100644 --- a/dlls/winegstreamer/wma_decoder.c +++ b/dlls/winegstreamer/wma_decoder.c @@ -801,6 +801,10 @@ static HRESULT WINAPI media_object_SetOutputType(IMediaObject *iface, DWORD inde if (!IsEqualGUID(&type->formattype, &FORMAT_WaveFormatEx)) return DMO_E_TYPE_NOT_ACCEPTED; + if (((WAVEFORMATEX *)decoder->input_type.pbFormat)->nChannels != + ((WAVEFORMATEX *)type->pbFormat)->nChannels) + return DMO_E_TYPE_NOT_ACCEPTED; + if (FAILED(hr = wg_transform_create_quartz(&decoder->input_type, type, &attrs, &new_transform))) return hr; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9575
This merge request was approved by Elizabeth Figura. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9575
participants (3)
-
Elizabeth Figura (@zfigura) -
Yuxuan Shui -
Yuxuan Shui (@yshui)