]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/aacdec.c
merge read and and in add_paeth_prediction
[ffmpeg] / libavcodec / aacdec.c
index 028e855ddad849ce2e4a53bd5ae7a7b690682774..96b1323c191d61164e11481e2da01738246458b3 100644 (file)
@@ -463,6 +463,11 @@ static int decode_audio_specific_config(AACContext *ac,
     GetBitContext gb;
     int i;
 
+    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, "\n");
+
     init_get_bits(&gb, data, data_size * 8);
 
     if ((i = ff_mpeg4audio_get_config(m4ac, data, data_size)) < 0)
@@ -489,6 +494,10 @@ static int decode_audio_specific_config(AACContext *ac,
         return -1;
     }
 
+    av_dlog(avctx, "AOT %d chan config %d sampling index %d (%d) SBR %d PS %d\n",
+            m4ac->object_type, m4ac->chan_config, m4ac->sampling_index,
+            m4ac->sample_rate, m4ac->sbr, m4ac->ps);
+
     return get_bits_count(&gb);
 }
 
@@ -548,12 +557,8 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
             return -1;
     }
 
-    /* ffdshow custom code */
-#if CONFIG_AUDIO_FLOAT
-    avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
-#else
-    avctx->sample_fmt = AV_SAMPLE_FMT_S16;
-#endif
+    avctx->sample_fmt = avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
+                        AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
 
     AAC_INIT_VLC_STATIC( 0, 304);
     AAC_INIT_VLC_STATIC( 1, 270);
@@ -2170,12 +2175,8 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
         avctx->frame_size = samples;
     }
 
-    /* ffdshow custom code */
-#if CONFIG_AUDIO_FLOAT
-    data_size_tmp = samples * avctx->channels * sizeof(float);
-#else
-    data_size_tmp = samples * avctx->channels * sizeof(int16_t);
-#endif
+    data_size_tmp = samples * avctx->channels;
+    data_size_tmp *= avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(float) : sizeof(int16_t);
     if (*data_size < data_size_tmp) {
         av_log(avctx, AV_LOG_ERROR,
                "Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n",
@@ -2185,12 +2186,10 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
     *data_size = data_size_tmp;
 
     if (samples) {
-        /* ffdshow custom code */
-#if CONFIG_AUDIO_FLOAT
-        float_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
-#else
-        ac->fmt_conv.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
-#endif
+        if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
+            float_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
+        } else
+            ac->fmt_conv.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
     }
 
     if (ac->output_configured)
@@ -2509,11 +2508,7 @@ AVCodec ff_aac_decoder = {
     aac_decode_frame,
     .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
     .sample_fmts = (const enum AVSampleFormat[]) {
-#if CONFIG_AUDIO_FLOAT
-        AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
-#else
-        AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE
-#endif
+        AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
     },
     .channel_layouts = aac_channel_layout,
 };
@@ -2533,11 +2528,7 @@ AVCodec ff_aac_latm_decoder = {
     .decode = latm_decode_frame,
     .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM syntax)"),
     .sample_fmts = (const enum AVSampleFormat[]) {
-#if CONFIG_AUDIO_FLOAT
-        AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
-#else
-        AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE
-#endif
+        AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
     },
     .channel_layouts = aac_channel_layout,
 };