Commit 256e9afc authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

winegstreamer: Merge audio_mpeg4 into audio field.

parent 29dfcb99
......@@ -650,22 +650,22 @@ 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, sizeof(HEAACWAVEINFO) - sizeof(WAVEFORMATEX));
if (codec_data_size > sizeof(format->u.audio_mpeg4.codec_data))
if (codec_data_size > sizeof(format->u.audio.codec_data))
{
FIXME("Codec data needs %u bytes.\n", codec_data_size);
return;
}
if (raw_aac)
memcpy(format->u.audio_mpeg4.codec_data, (BYTE *)(&wfx->wfInfo.wfx + 1), codec_data_size);
memcpy(format->u.audio.codec_data, (BYTE *)(&wfx->wfInfo.wfx + 1), codec_data_size);
else
memcpy(format->u.audio_mpeg4.codec_data, wfx->pbAudioSpecificConfig, codec_data_size);
memcpy(format->u.audio.codec_data, wfx->pbAudioSpecificConfig, codec_data_size);
format->major_type = WG_MAJOR_TYPE_AUDIO_MPEG4;
if (FAILED(IMFMediaType_GetUINT32(type, &MF_MT_AAC_PAYLOAD_TYPE, &format->u.audio_mpeg4.payload_type)))
format->u.audio_mpeg4.payload_type = 0;
if (FAILED(IMFMediaType_GetUINT32(type, &MF_MT_AAC_PAYLOAD_TYPE, &format->u.audio.payload_type)))
format->u.audio.payload_type = 0;
format->u.audio_mpeg4.codec_data_len = codec_data_size;
format->u.audio.codec_data_len = codec_data_size;
}
static enum wg_video_format mf_video_format_to_wg(const GUID *subtype)
......
......@@ -98,7 +98,8 @@ struct wg_format
/* Valid members for different audio formats:
*
* Uncompressed(PCM): channels, channel_mask, rate.
* MPEG1: channels, rate, layer. */
* MPEG1: channels, rate, layer.
* MPEG4: payload_type, codec_data_len, codec_data. */
struct
{
wg_audio_format format;
......@@ -107,13 +108,10 @@ struct wg_format
uint32_t channel_mask; /* In WinMM format. */
uint32_t rate;
uint32_t layer;
} audio;
struct
{
uint32_t payload_type;
uint32_t codec_data_len;
unsigned char codec_data[64];
} audio_mpeg4;
} audio;
struct
{
uint32_t version;
......
......@@ -524,7 +524,7 @@ static GstCaps *wg_format_to_caps_audio_mpeg4(const struct wg_format *format)
gst_caps_set_simple(caps, "mpegversion", G_TYPE_INT, 4, NULL);
switch (format->u.audio_mpeg4.payload_type)
switch (format->u.audio.payload_type)
{
case 0: gst_caps_set_simple(caps, "stream-format", G_TYPE_STRING, "raw", NULL); break;
case 1: gst_caps_set_simple(caps, "stream-format", G_TYPE_STRING, "adts", NULL); break;
......@@ -534,10 +534,10 @@ static GstCaps *wg_format_to_caps_audio_mpeg4(const struct wg_format *format)
/* FIXME: Use gst_codec_utils_aac_caps_set_level_and_profile from GStreamer pbutils library */
if (format->u.audio_mpeg4.codec_data_len)
if (format->u.audio.codec_data_len)
{
buffer = gst_buffer_new_and_alloc(format->u.audio_mpeg4.codec_data_len);
gst_buffer_fill(buffer, 0, format->u.audio_mpeg4.codec_data, format->u.audio_mpeg4.codec_data_len);
buffer = gst_buffer_new_and_alloc(format->u.audio.codec_data_len);
gst_buffer_fill(buffer, 0, format->u.audio.codec_data, format->u.audio.codec_data_len);
gst_caps_set_simple(caps, "codec_data", GST_TYPE_BUFFER, buffer, NULL);
gst_buffer_unref(buffer);
}
......
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