Merge commit '6d8629aac13692447b54eac795bf74007ebf8987'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 28 Jun 2013 08:00:51 +0000 (10:00 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 28 Jun 2013 08:00:51 +0000 (10:00 +0200)
* commit '6d8629aac13692447b54eac795bf74007ebf8987':
  aac: K&R formatting cosmetics

Conflicts:
libavcodec/aacdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/aacdec.c

@@@ -458,9 -470,8 +481,9 @@@ static int output_configure(AACContext 
      }
  
      memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
 -    avctx->channel_layout = ac->oc[1].channel_layout = layout;
 +    if (layout) avctx->channel_layout = layout;
-     ac->oc[1].channel_layout = layout;
-     avctx->channels = ac->oc[1].channels = channels;
++                            ac->oc[1].channel_layout = layout;
+     avctx->channels       = ac->oc[1].channels       = channels;
      ac->oc[1].status = oc_type;
  
      if (get_new_frame) {
@@@ -521,10 -519,8 +548,10 @@@ static ChannelElement *get_che(AACConte
          int layout_map_tags;
          push_output_configuration(ac);
  
-         if (set_default_channel_config(ac->avctx, layout_map, &layout_map_tags,
-                                        2) < 0)
 +        av_log(ac->avctx, AV_LOG_DEBUG, "mono with CPE\n");
 +
+         if (set_default_channel_config(ac->avctx, layout_map,
+                                        &layout_map_tags, 2) < 0)
              return NULL;
          if (output_configure(ac, layout_map, layout_map_tags,
                               OC_TRIAL_FRAME, 1) < 0)
          int layout_map_tags;
          push_output_configuration(ac);
  
-         if (set_default_channel_config(ac->avctx, layout_map, &layout_map_tags,
-                                        1) < 0)
 +        av_log(ac->avctx, AV_LOG_DEBUG, "stereo with SCE\n");
 +
+         if (set_default_channel_config(ac->avctx, layout_map,
+                                        &layout_map_tags, 1) < 0)
              return NULL;
          if (output_configure(ac, layout_map, layout_map_tags,
                               OC_TRIAL_FRAME, 1) < 0)
@@@ -782,20 -783,21 +822,23 @@@ static int decode_audio_specific_config
  {
      GetBitContext gb;
      int i;
 +    int ret;
  
 -    av_dlog(avctx, "extradata size %d\n", avctx->extradata_size);
 -    for (i = 0; i < avctx->extradata_size; i++)
 -        av_dlog(avctx, "%02x ", avctx->extradata[i]);
 +    av_dlog(avctx, "audio specific config size %d\n", bit_size >> 3);
 +    for (i = 0; i < bit_size >> 3; i++)
-          av_dlog(avctx, "%02x ", data[i]);
++        av_dlog(avctx, "%02x ", data[i]);
      av_dlog(avctx, "\n");
  
 -    init_get_bits(&gb, data, bit_size);
 +    if ((ret = init_get_bits(&gb, data, bit_size)) < 0)
 +        return ret;
  
-     if ((i = avpriv_mpeg4audio_get_config(m4ac, data, bit_size, sync_extension)) < 0)
+     if ((i = avpriv_mpeg4audio_get_config(m4ac, data, bit_size,
+                                           sync_extension)) < 0)
          return -1;
      if (m4ac->sampling_index > 12) {
-         av_log(avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", m4ac->sampling_index);
+         av_log(avctx, AV_LOG_ERROR,
+                "invalid sampling rate index %d\n",
+                m4ac->sampling_index);
          return -1;
      }
  
@@@ -874,14 -880,14 +921,16 @@@ static void reset_predictor_group(Predi
          reset_predict_state(&ps[i]);
  }
  
- #define AAC_INIT_VLC_STATIC(num, size) \
-     INIT_VLC_STATIC(&vlc_spectral[num], 8, ff_aac_spectral_sizes[num], \
-          ff_aac_spectral_bits[num], sizeof( ff_aac_spectral_bits[num][0]), sizeof( ff_aac_spectral_bits[num][0]), \
-         ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), sizeof(ff_aac_spectral_codes[num][0]), \
+ #define AAC_INIT_VLC_STATIC(num, size)                                     \
+     INIT_VLC_STATIC(&vlc_spectral[num], 8, ff_aac_spectral_sizes[num],     \
+          ff_aac_spectral_bits[num], sizeof(ff_aac_spectral_bits[num][0]),  \
+                                     sizeof(ff_aac_spectral_bits[num][0]),  \
+         ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), \
+                                     sizeof(ff_aac_spectral_codes[num][0]), \
          size);
  
 +static void aacdec_init(AACContext *ac);
 +
  static av_cold int aac_decode_init(AVCodecContext *avctx)
  {
      AACContext *ac = avctx->priv_data;
@@@ -1067,11 -1073,12 +1123,12 @@@ static int decode_ics_info(AACContext *
          if (ics->predictor_present) {
              if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN) {
                  if (decode_prediction(ac, ics, gb)) {
 -                    return AVERROR_INVALIDDATA;
 +                    goto fail;
                  }
              } else if (ac->oc[1].m4ac.object_type == AOT_AAC_LC) {
-                 av_log(ac->avctx, AV_LOG_ERROR, "Prediction is not allowed in AAC-LC.\n");
+                 av_log(ac->avctx, AV_LOG_ERROR,
+                        "Prediction is not allowed in AAC-LC.\n");
 -                return AVERROR_INVALIDDATA;
 +                goto fail;
              } else {
                  if ((ics->ltp.present = get_bits(gb, 1)))
                      decode_ltp(&ics->ltp, gb, ics->max_sfb);
  
      if (ics->max_sfb > ics->num_swb) {
          av_log(ac->avctx, AV_LOG_ERROR,
-                "Number of scalefactor bands in group (%d) exceeds limit (%d).\n",
+                "Number of scalefactor bands in group (%d) "
+                "exceeds limit (%d).\n",
                 ics->max_sfb, ics->num_swb);
 -        return AVERROR_INVALIDDATA;
 +        goto fail;
      }
  
      return 0;
@@@ -1285,10 -1292,12 +1345,12 @@@ static void decode_mid_side_stereo(Chan
  {
      int idx;
      if (ms_present == 1) {
-         for (idx = 0; idx < cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb; idx++)
+         for (idx = 0;
+              idx < cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb;
+              idx++)
              cpe->ms_mask[idx] = get_bits1(gb);
      } else if (ms_present == 2) {
 -        memset(cpe->ms_mask, 1, cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb * sizeof(cpe->ms_mask[0]));
 +        memset(cpe->ms_mask, 1,  sizeof(cpe->ms_mask[0]) * cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb);
      }
  }
  
@@@ -2721,13 -2667,13 +2799,13 @@@ static av_cold int aac_decode_close(AVC
  #define LOAS_SYNC_WORD   0x2b7       ///< 11 bits LOAS sync word
  
  struct LATMContext {
-     AACContext      aac_ctx;             ///< containing AACContext
-     int             initialized;         ///< initialized after a valid extradata was seen
+     AACContext aac_ctx;     ///< containing AACContext
 -    int initialized;        ///< initilized after a valid extradata was seen
++    int initialized;        ///< initialized after a valid extradata was seen
  
      // parser data
-     int             audio_mux_version_A; ///< LATM syntax version
-     int             frame_length_type;   ///< 0/1 variable/fixed frame length
-     int             frame_length;        ///< frame length for fixed frame length
+     int audio_mux_version_A; ///< LATM syntax version
+     int frame_length_type;   ///< 0/1 variable/fixed frame length
+     int frame_length;        ///< frame length for fixed frame length
  };
  
  static inline uint32_t latm_get_value(GetBitContext *b)