-- v2: winegstreamer: Reject SetOutput with a different number of channels.
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 e5c65ace228..d2fb18afdf1 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -4030,6 +4030,10 @@ static void test_wma_decoder_dmo_output_type(void) ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, 0x4); ok(hr == E_INVALIDARG, "SetOutputType returned %#lx.\n", hr); + ((WAVEFORMATEX *)good_output_type->pbFormat)->nChannels += 1; + hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); + ((WAVEFORMATEX *)good_output_type->pbFormat)->nChannels -= 1;
/* Test GetOutputCurrentType. */ hr = IMediaObject_SetOutputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR);
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 d2fb18afdf1..a97728261b1 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -7973,6 +7973,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; @@ -8132,6 +8133,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);
From: Yuxuan Shui yshui@codeweavers.com
--- dlls/mf/tests/transform.c | 2 +- dlls/winegstreamer/wma_decoder.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index a97728261b1..d904ecf7e02 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -4032,7 +4032,7 @@ static void test_wma_decoder_dmo_output_type(void) ok(hr == E_INVALIDARG, "SetOutputType returned %#lx.\n", hr); ((WAVEFORMATEX *)good_output_type->pbFormat)->nChannels += 1; hr = IMediaObject_SetOutputType(dmo, 0, good_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); ((WAVEFORMATEX *)good_output_type->pbFormat)->nChannels -= 1;
/* Test GetOutputCurrentType. */ diff --git a/dlls/winegstreamer/wma_decoder.c b/dlls/winegstreamer/wma_decoder.c index ddb77724db5..86391200101 100644 --- a/dlls/winegstreamer/wma_decoder.c +++ b/dlls/winegstreamer/wma_decoder.c @@ -796,6 +796,16 @@ 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(&decoder->input_type.formattype, &FORMAT_WaveFormatEx) && + IsEqualGUID(&type->formattype, &FORMAT_WaveFormatEx)) + { + WORD current_nchannels = ((WAVEFORMATEX *)decoder->input_type.pbFormat)->nChannels; + WORD incomming_nchannels = ((WAVEFORMATEX *)type->pbFormat)->nChannels; + if (current_nchannels != incomming_nchannels) + return DMO_E_TYPE_NOT_ACCEPTED; + } + if (flags & DMO_SET_TYPEF_TEST_ONLY) return S_OK;
``` diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index e5c65ace228..d2fb18afdf1 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -4030,6 +4030,10 @@ static void test_wma_decoder_dmo_output_type(void) ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, 0x4); ok(hr == E_INVALIDARG, "SetOutputType returned %#lx.\n", hr); + ((WAVEFORMATEX *)good_output_type->pbFormat)->nChannels += 1; + hr = IMediaObject_SetOutputType(dmo, 0, good_output_type, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetOutputType returned %#lx.\n", hr); + ((WAVEFORMATEX *)good_output_type->pbFormat)->nChannels -= 1;
/* Test GetOutputCurrentType. */ hr = IMediaObject_SetOutputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); ```
I don't think that's a valid media type as written, though, which kind of weakens the test. It's 3 channels, which I think you need EXTENSIBLE for, and the bit rate and block align are wrong.
``` + if (IsEqualGUID(&decoder->input_type.formattype, &FORMAT_WaveFormatEx) && + IsEqualGUID(&type->formattype, &FORMAT_WaveFormatEx)) + { + WORD current_nchannels = ((WAVEFORMATEX *)decoder->input_type.pbFormat)->nChannels; + WORD incomming_nchannels = ((WAVEFORMATEX *)type->pbFormat)->nChannels; + if (current_nchannels != incomming_nchannels) + return DMO_E_TYPE_NOT_ACCEPTED; + } ```
That's a bit of an odd test, because as written it implies that using a different formattype is legal, which I would be surprised to find that it is.