aac: convert to new channel layout API

Signed-off-by: Vittorio Giovara <[email protected]>
Signed-off-by: Anton Khirnov <[email protected]>
Signed-off-by: James Almer <[email protected]>
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 7bbd4d5..f460479 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -397,7 +397,7 @@
                                        const float lambda)
 {
     int start = 0, i, w, w2, g;
-    int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
+    int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->ch_layout.nb_channels * (lambda / 120.f);
     float dists[128] = { 0 }, uplims[128] = { 0 };
     float maxvals[128];
     int fflag, minscaler;
@@ -556,7 +556,7 @@
     const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f);
 
     int refbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
-        / ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
+        / ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->ch_layout.nb_channels)
         * (lambda / 120.f);
 
     /** Keep this in sync with twoloop's cutoff selection */
@@ -564,7 +564,7 @@
     int prev = -1000, prev_sf = -1;
     int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
         ? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
-        : (avctx->bit_rate / avctx->channels);
+        : (avctx->bit_rate / avctx->ch_layout.nb_channels);
 
     frame_bit_rate *= 1.15f;
 
@@ -693,14 +693,14 @@
     const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f);
 
     int refbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
-        / ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
+        / ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->ch_layout.nb_channels)
         * (lambda / 120.f);
 
     /** Keep this in sync with twoloop's cutoff selection */
     float rate_bandwidth_multiplier = 1.5f;
     int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
         ? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
-        : (avctx->bit_rate / avctx->channels);
+        : (avctx->bit_rate / avctx->ch_layout.nb_channels);
 
     frame_bit_rate *= 1.15f;