Skip to content

Commit

Permalink
fdkaac: set channel configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
funman committed May 3, 2014
1 parent f53e858 commit c56a568
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions modules/codec/fdkaac.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,20 +221,30 @@ static int OpenEncoder( vlc_object_t *p_this )
i_profile = PROFILE_AAC_HE_v2;
}

uint16_t channel_config;
switch (p_enc->fmt_in.audio.i_channels) {
case 1: mode = MODE_1; sce = 1; cpe = 0; break;
case 2: mode = MODE_2; sce = 0; cpe = 1; break;
case 3: mode = MODE_1_2; sce = 1; cpe = 1; break;
case 4: mode = MODE_1_2_1; sce = 2; cpe = 1; break;
case 5: mode = MODE_1_2_2; sce = 1; cpe = 2; break;
case 6: mode = MODE_1_2_2_1; sce = 2; cpe = 2; break;
case 8: mode = MODE_1_2_2_2_1; sce = 2; cpe = 3; break;
case 1: mode = MODE_1; sce = 1; cpe = 0;
channel_config = AOUT_CHAN_CENTER; break;
case 2: mode = MODE_2; sce = 0; cpe = 1;
channel_config = AOUT_CHANS_STEREO; break;
case 3: mode = MODE_1_2; sce = 1; cpe = 1;
channel_config = AOUT_CHANS_3_0; break;
case 4: mode = MODE_1_2_1; sce = 2; cpe = 1;
channel_config = AOUT_CHANS_4_CENTER_REAR; break;
case 5: mode = MODE_1_2_2; sce = 1; cpe = 2;
channel_config = AOUT_CHANS_5_0; break;
case 6: mode = MODE_1_2_2_1; sce = 2; cpe = 2;
channel_config = AOUT_CHANS_5_1; break;
case 8: mode = MODE_1_2_2_2_1; sce = 2; cpe = 3;
channel_config = AOUT_CHANS_7_1; break;
default:
msg_Err( p_enc, "we do not support > 8 input channels, this input has %i",
p_enc->fmt_in.audio.i_channels );
return VLC_EGENERIC;
}

p_enc->fmt_in.audio.i_physical_channels = channel_config;

msg_Info(p_enc, "Initializing AAC Encoder, %i channels", p_enc->fmt_in.audio.i_channels);

/* Allocate the memory needed to store the encoder's structure */
Expand Down

0 comments on commit c56a568

Please sign in to comment.