mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 14:36:24 +00:00
faad: set channel positions using the appropriate API
https://bugzilla.gnome.org/show_bug.cgi?id=731038
This commit is contained in:
parent
411795560f
commit
cf9c73367d
1 changed files with 10 additions and 11 deletions
|
@ -470,6 +470,7 @@ gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info)
|
||||||
gboolean fmt_change = FALSE;
|
gboolean fmt_change = FALSE;
|
||||||
GstAudioInfo ainfo;
|
GstAudioInfo ainfo;
|
||||||
gint i;
|
gint i;
|
||||||
|
GstAudioChannelPosition position[6];
|
||||||
|
|
||||||
/* see if we need to renegotiate */
|
/* see if we need to renegotiate */
|
||||||
if (info->samplerate != faad->samplerate ||
|
if (info->samplerate != faad->samplerate ||
|
||||||
|
@ -495,10 +496,6 @@ gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info)
|
||||||
g_free (faad->channel_positions);
|
g_free (faad->channel_positions);
|
||||||
faad->channel_positions = g_memdup (info->channel_position, faad->channels);
|
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;
|
faad->bps = 16 / 8;
|
||||||
|
|
||||||
if (!gst_faad_chanpos_to_gst (faad, faad->channel_positions,
|
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");
|
GST_DEBUG_OBJECT (faad, "Could not map channel positions");
|
||||||
return FALSE;
|
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));
|
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 */
|
/* get the remap table */
|
||||||
memset (faad->reorder_map, 0, sizeof (faad->reorder_map));
|
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);
|
ret = gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (faad), &ainfo);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue