faad: set channel positions using the appropriate API

https://bugzilla.gnome.org/show_bug.cgi?id=731038
This commit is contained in:
Vincent Penquerc'h 2014-06-06 13:57:30 +01:00
parent 411795560f
commit cf9c73367d

View file

@ -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;