Module: wine Branch: master Commit: 42c96b9c8fb0c4bcc912e365733b564f3faf5f7c URL: https://gitlab.winehq.org/wine/wine/-/commit/42c96b9c8fb0c4bcc912e365733b564...
Author: Rémi Bernon rbernon@codeweavers.com Date: Tue Jan 23 08:52:36 2024 +0100
winegstreamer: Fix reading MF_MT_USER_DATA into HEAACWAVEFORMAT.
Fixes 681d20146226132c2ed18ae7ecb53003e6ffcf44. The winegstreamer private declaration of HEAACWAVEINFO previously didn't include the WAVEFORMATEX member as it should.
---
dlls/winegstreamer/mfplat.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 82fb19126bb..e6d9fb9fd2c 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -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) { - BYTE buffer[64]; - HEAACWAVEFORMAT *user_data = (HEAACWAVEFORMAT *)buffer; + BYTE buffer[sizeof(HEAACWAVEFORMAT) + 64]; + HEAACWAVEFORMAT *wfx = (HEAACWAVEFORMAT *)buffer; UINT32 codec_data_size; 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"); return; @@ -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); 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)) { FIXME("Codec data needs %u bytes.\n", codec_data_size); return; } 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 - 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;