Commit 42c96b9c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winegstreamer: Fix reading MF_MT_USER_DATA into HEAACWAVEFORMAT.

Fixes 681d2014. The winegstreamer private declaration of HEAACWAVEINFO previously didn't include the WAVEFORMATEX member as it should.
parent 54217dab
...@@ -634,12 +634,14 @@ static void mf_media_type_to_wg_format_audio(IMFMediaType *type, const GUID *sub ...@@ -634,12 +634,14 @@ static void mf_media_type_to_wg_format_audio(IMFMediaType *type, const GUID *sub
static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, const GUID *subtype, struct wg_format *format) static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, const GUID *subtype, struct wg_format *format)
{ {
BYTE buffer[64]; BYTE buffer[sizeof(HEAACWAVEFORMAT) + 64];
HEAACWAVEFORMAT *user_data = (HEAACWAVEFORMAT *)buffer; HEAACWAVEFORMAT *wfx = (HEAACWAVEFORMAT *)buffer;
UINT32 codec_data_size; UINT32 codec_data_size;
BOOL raw_aac; BOOL raw_aac;
if (FAILED(IMFMediaType_GetBlob(type, &MF_MT_USER_DATA, buffer, sizeof(buffer), &codec_data_size))) wfx->wfInfo.wfx.cbSize = sizeof(buffer) - sizeof(wfx->wfInfo.wfx);
if (FAILED(IMFMediaType_GetBlob(type, &MF_MT_USER_DATA, (BYTE *)(&wfx->wfInfo.wfx + 1),
wfx->wfInfo.wfx.cbSize, &codec_data_size)))
{ {
FIXME("Codec data is not set.\n"); FIXME("Codec data is not set.\n");
return; return;
...@@ -647,16 +649,16 @@ static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, const GUI ...@@ -647,16 +649,16 @@ static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, const GUI
raw_aac = IsEqualGUID(subtype, &MFAudioFormat_RAW_AAC); raw_aac = IsEqualGUID(subtype, &MFAudioFormat_RAW_AAC);
if (!raw_aac) if (!raw_aac)
codec_data_size -= min(codec_data_size, offsetof(HEAACWAVEFORMAT, pbAudioSpecificConfig)); codec_data_size -= min(codec_data_size, sizeof(HEAACWAVEINFO) - sizeof(WAVEFORMATEX));
if (codec_data_size > sizeof(format->u.audio_mpeg4.codec_data)) if (codec_data_size > sizeof(format->u.audio_mpeg4.codec_data))
{ {
FIXME("Codec data needs %u bytes.\n", codec_data_size); FIXME("Codec data needs %u bytes.\n", codec_data_size);
return; return;
} }
if (raw_aac) if (raw_aac)
memcpy(format->u.audio_mpeg4.codec_data, buffer, codec_data_size); memcpy(format->u.audio_mpeg4.codec_data, (BYTE *)(&wfx->wfInfo.wfx + 1), codec_data_size);
else else
memcpy(format->u.audio_mpeg4.codec_data, user_data->pbAudioSpecificConfig, codec_data_size); memcpy(format->u.audio_mpeg4.codec_data, wfx->pbAudioSpecificConfig, codec_data_size);
format->major_type = WG_MAJOR_TYPE_AUDIO_MPEG4; format->major_type = WG_MAJOR_TYPE_AUDIO_MPEG4;
......
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