From cf9c73367d65887c573a803ec5817082758637f7 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 6 Jun 2014 13:57:30 +0100 Subject: [PATCH] faad: set channel positions using the appropriate API https://bugzilla.gnome.org/show_bug.cgi?id=731038 --- ext/faad/gstfaad.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c index 4aa704dd9e..918d636a85 100644 --- a/ext/faad/gstfaad.c +++ b/ext/faad/gstfaad.c @@ -470,6 +470,7 @@ gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info) gboolean fmt_change = FALSE; GstAudioInfo ainfo; gint i; + GstAudioChannelPosition position[6]; /* see if we need to renegotiate */ if (info->samplerate != faad->samplerate || @@ -495,10 +496,6 @@ gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info) g_free (faad->channel_positions); faad->channel_positions = g_memdup (info->channel_position, faad->channels); - /* FIXME: Use the GstAudioInfo of GstAudioDecoder for all of this */ - gst_audio_info_init (&ainfo); - gst_audio_info_set_format (&ainfo, GST_AUDIO_FORMAT_S16, faad->samplerate, - faad->channels, NULL); faad->bps = 16 / 8; if (!gst_faad_chanpos_to_gst (faad, faad->channel_positions, @@ -506,14 +503,11 @@ gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info) GST_DEBUG_OBJECT (faad, "Could not map channel positions"); return FALSE; } - memcpy (ainfo.position, faad->aac_positions, + + memcpy (position, faad->aac_positions, sizeof (position)); + gst_audio_channel_positions_to_valid_order (position, faad->channels); + memcpy (faad->gst_positions, position, faad->channels * sizeof (GstAudioChannelPosition)); - gst_audio_channel_positions_to_valid_order (ainfo.position, faad->channels); - memcpy (faad->gst_positions, ainfo.position, - faad->channels * sizeof (GstAudioChannelPosition)); - /* Unset UNPOSITIONED flag */ - if (ainfo.position[0] != GST_AUDIO_CHANNEL_POSITION_NONE) - ainfo.flags &= ~GST_AUDIO_FLAG_UNPOSITIONED; /* get the remap table */ memset (faad->reorder_map, 0, sizeof (faad->reorder_map)); @@ -528,6 +522,11 @@ gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info) } } + /* FIXME: Use the GstAudioInfo of GstAudioDecoder for all of this */ + gst_audio_info_init (&ainfo); + gst_audio_info_set_format (&ainfo, GST_AUDIO_FORMAT_S16, faad->samplerate, + faad->channels, position); + ret = gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (faad), &ainfo); return ret;