From 177c232936dbc17cf212aed389f312d543d0c432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 2 Feb 2022 13:28:19 +0100 Subject: [PATCH] winegstreamer: Implement WMA decoder GetOutputStreamInfo. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391 Signed-off-by: RĂ©mi Bernon Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/mf/tests/mf.c | 10 ---------- dlls/winegstreamer/wma_decoder.c | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 96d8b972de7..72910769633 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -5751,7 +5751,6 @@ static void test_wma_decoder(void) todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetInputStreamInfo returned %#x\n", hr); hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info); - todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetOutputStreamInfo returned %#x\n", hr); hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type); ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetOutputAvailableType returned %#x\n", hr); @@ -5808,7 +5807,6 @@ static void test_wma_decoder(void) todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetInputStreamInfo returned %#x\n", hr); hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info); - todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetOutputStreamInfo returned %#x\n", hr); /* check new output media types */ @@ -5864,13 +5862,10 @@ static void test_wma_decoder(void) memset(&output_info, 0xcd, sizeof(output_info)); hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info); - todo_wine ok(hr == S_OK, "GetOutputStreamInfo returned %#x\n", hr); - todo_wine ok(output_info.dwFlags == 0, "got dwFlags %#x\n", output_info.dwFlags); todo_wine ok(output_info.cbSize == 0, "got cbSize %#x\n", output_info.cbSize); - todo_wine ok(output_info.cbAlignment == 1, "got cbAlignment %#x\n", output_info.cbAlignment); /* MF_MT_AUDIO_AVG_BYTES_PER_SECOND isn't required by SetInputType, but is needed for the transform to work */ @@ -5884,7 +5879,6 @@ static void test_wma_decoder(void) ok(hr == S_OK, "SetInputType returned %#x.\n", hr); hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info); - todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetOutputStreamInfo returned %#x\n", hr); init_media_type(media_type, output_type_desc, -1); @@ -5895,13 +5889,9 @@ static void test_wma_decoder(void) memset(&output_info, 0xcd, sizeof(output_info)); hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info); - todo_wine ok(hr == S_OK, "GetOutputStreamInfo returned %#x\n", hr); - todo_wine ok(output_info.dwFlags == 0, "got dwFlags %#x\n", output_info.dwFlags); - todo_wine ok(output_info.cbSize == sizeof(wma_decoded_data), "got cbSize %#x\n", output_info.cbSize); - todo_wine ok(output_info.cbAlignment == 1, "got cbAlignment %#x\n", output_info.cbAlignment); ret = IMFTransform_Release(transform); diff --git a/dlls/winegstreamer/wma_decoder.c b/dlls/winegstreamer/wma_decoder.c index 4fae787679d..dbccd659ac0 100644 --- a/dlls/winegstreamer/wma_decoder.c +++ b/dlls/winegstreamer/wma_decoder.c @@ -174,8 +174,25 @@ static HRESULT WINAPI transform_GetInputStreamInfo(IMFTransform *iface, DWORD id static HRESULT WINAPI transform_GetOutputStreamInfo(IMFTransform *iface, DWORD id, MFT_OUTPUT_STREAM_INFO *info) { - FIXME("iface %p, id %u, info %p stub!\n", iface, id, info); - return E_NOTIMPL; + struct wma_decoder *decoder = impl_from_IMFTransform(iface); + UINT32 channel_count, block_alignment; + HRESULT hr; + + TRACE("iface %p, id %u, info %p.\n", iface, id, info); + + if (!decoder->input_type || !decoder->output_type) + return MF_E_TRANSFORM_TYPE_NOT_SET; + + if (FAILED(hr = IMFMediaType_GetUINT32(decoder->output_type, &MF_MT_AUDIO_NUM_CHANNELS, &channel_count))) + return hr; + if (FAILED(hr = IMFMediaType_GetUINT32(decoder->output_type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, &block_alignment))) + return hr; + + info->dwFlags = 0; + info->cbSize = 1024 * block_alignment * channel_count; + info->cbAlignment = 1; + + return S_OK; } static HRESULT WINAPI transform_GetAttributes(IMFTransform *iface, IMFAttributes **attributes)