Add some more default channel layouts, these should be good for AAC at least

This commit is contained in:
Sebastian Dröge 2012-10-05 15:09:17 +02:00
parent 6ed3ea7cad
commit 7341ed62fa

View file

@ -2515,15 +2515,45 @@ gst_amc_audio_channel_mask_to_positions (guint32 channel_mask, gint channels)
GstAudioChannelPosition *pos = g_new0 (GstAudioChannelPosition, channels); GstAudioChannelPosition *pos = g_new0 (GstAudioChannelPosition, channels);
gint i, j; gint i, j;
if (channel_mask == 0 && channels == 1) { if (channel_mask == 0) {
pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_MONO; if (channels == 1) {
return pos; pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_MONO;
} return pos;
}
if (channels == 2) {
pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
pos[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
return pos;
}
if (channel_mask == 0 && channels == 2) { /* Now let the guesswork begin, these are the
pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT; * AAC default channel assignments for these numbers
pos[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT; * of channels */
return pos; if (channels == 3) {
channel_mask =
CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT |
CHANNEL_OUT_FRONT_CENTER;
} else if (channels == 4) {
channel_mask =
CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT |
CHANNEL_OUT_FRONT_CENTER | CHANNEL_OUT_BACK_CENTER;
} else if (channels == 5) {
channel_mask =
CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT |
CHANNEL_OUT_FRONT_CENTER | CHANNEL_OUT_BACK_LEFT |
CHANNEL_OUT_BACK_RIGHT;
} else if (channels == 6) {
channel_mask =
CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT |
CHANNEL_OUT_FRONT_CENTER | CHANNEL_OUT_BACK_LEFT |
CHANNEL_OUT_BACK_RIGHT | CHANNEL_OUT_LOW_FREQUENCY;
} else if (channels == 8) {
channel_mask =
CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT |
CHANNEL_OUT_FRONT_CENTER | CHANNEL_OUT_BACK_LEFT |
CHANNEL_OUT_BACK_RIGHT | CHANNEL_OUT_LOW_FREQUENCY |
CHANNEL_OUT_FRONT_LEFT_OF_CENTER | CHANNEL_OUT_FRONT_RIGHT_OF_CENTER;
}
} }
for (i = 0, j = 0; i < G_N_ELEMENTS (channel_mapping_table); i++) { for (i = 0, j = 0; i < G_N_ELEMENTS (channel_mapping_table); i++) {