Commit 902133b0 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

winegstreamer: Correct output available types attrs in AAC decoder for channel count > 2.

parent 5b0172e1
......@@ -2622,7 +2622,7 @@ static void test_aac_decoder_channels(const struct attribute_desc *input_type_de
hr = IMFAttributes_GetUINT32(attrs, &MF_MT_AUDIO_PREFER_WAVEFORMATEX, &value);
if (many_channels && i < ARRAY_SIZE(expect_available_outputs))
{
todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "got %#lx.\n", hr);
ok(hr == MF_E_ATTRIBUTENOTFOUND, "got %#lx.\n", hr);
}
else
{
......@@ -2638,11 +2638,9 @@ static void test_aac_decoder_channels(const struct attribute_desc *input_type_de
}
else
{
todo_wine {
ok(hr == S_OK, "got %#lx.\n", hr);
ok(value == expected_mask[expected_chans], "got %#x, expected %#x.\n",
value, expected_mask[expected_chans]);
}
}
ret = IMFMediaType_Release(type);
......
......@@ -24,6 +24,8 @@
#include "mfobjects.h"
#include "mftransform.h"
#include "wmcodecdsp.h"
#include "ks.h"
#include "ksmedia.h"
#include "wine/debug.h"
......@@ -48,6 +50,17 @@ static const GUID *const aac_decoder_output_types[] =
&MFAudioFormat_Float,
};
static const UINT32 default_channel_mask[7] =
{
0,
0,
0,
SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_CENTER,
KSAUDIO_SPEAKER_QUAD,
KSAUDIO_SPEAKER_QUAD | SPEAKER_FRONT_CENTER,
KSAUDIO_SPEAKER_5POINT1,
};
struct aac_decoder
{
IMFTransform IMFTransform_iface;
......@@ -295,6 +308,9 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR
|| !channel_count)
channel_count = 2;
if (channel_count >= ARRAY_SIZE(default_channel_mask))
return MF_E_INVALIDMEDIATYPE;
if (index >= ARRAY_SIZE(aac_decoder_output_types))
return MF_E_NO_MORE_TYPES;
index = ARRAY_SIZE(aac_decoder_output_types) - index - 1;
......@@ -340,7 +356,10 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR
goto done;
if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_FIXED_SIZE_SAMPLES, 1)))
goto done;
if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_PREFER_WAVEFORMATEX, 1)))
if (channel_count < 3 && FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_PREFER_WAVEFORMATEX, 1)))
goto done;
if (channel_count >= 3 && FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_CHANNEL_MASK,
default_channel_mask[channel_count])))
goto done;
done:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment