]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cngdec.c
audiodsp: x86: Remove pointless header file
[ffmpeg] / libavcodec / cngdec.c
index 4fe7839ae7de674204139357334c27c0a3d5694e..482ef94a3289d987060dc3fe364c7a55fb2d7143 100644 (file)
 #include "libavutil/common.h"
 #include "avcodec.h"
 #include "celp_filters.h"
+#include "internal.h"
 #include "libavutil/lfg.h"
 
 typedef struct CNGContext {
-    AVFrame avframe;
     float *refl_coef, *target_refl_coef;
     float *lpc_coef;
     int order;
@@ -57,8 +57,6 @@ static av_cold int cng_decode_init(AVCodecContext *avctx)
     avctx->channels    = 1;
     avctx->sample_rate = 8000;
 
-    avcodec_get_frame_defaults(&p->avframe);
-    avctx->coded_frame  = &p->avframe;
     p->order            = 12;
     avctx->frame_size   = 640;
     p->refl_coef        = av_mallocz(p->order * sizeof(*p->refl_coef));
@@ -102,9 +100,9 @@ static void cng_decode_flush(AVCodecContext *avctx)
 }
 
 static int cng_decode_frame(AVCodecContext *avctx, void *data,
-                              int *got_frame_ptr, AVPacket *avpkt)
+                            int *got_frame_ptr, AVPacket *avpkt)
 {
-
+    AVFrame *frame = data;
     CNGContext *p = avctx->priv_data;
     int buf_size  = avpkt->size;
     int ret, i;
@@ -143,25 +141,25 @@ static int cng_decode_frame(AVCodecContext *avctx, void *data,
     ff_celp_lp_synthesis_filterf(p->filter_out + p->order, p->lpc_coef,
                                  p->excitation, avctx->frame_size, p->order);
 
-    p->avframe.nb_samples = avctx->frame_size;
-    if ((ret = avctx->get_buffer(avctx, &p->avframe)) < 0) {
+    frame->nb_samples = avctx->frame_size;
+    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return ret;
     }
-    buf_out = (int16_t *)p->avframe.data[0];
+    buf_out = (int16_t *)frame->data[0];
     for (i = 0; i < avctx->frame_size; i++)
         buf_out[i] = p->filter_out[i + p->order];
     memcpy(p->filter_out, p->filter_out + avctx->frame_size,
            p->order * sizeof(*p->filter_out));
 
-    *got_frame_ptr   = 1;
-    *(AVFrame *)data = p->avframe;
+    *got_frame_ptr = 1;
 
     return buf_size;
 }
 
 AVCodec ff_comfortnoise_decoder = {
     .name           = "comfortnoise",
+    .long_name      = NULL_IF_CONFIG_SMALL("RFC 3389 comfort noise generator"),
     .type           = AVMEDIA_TYPE_AUDIO,
     .id             = AV_CODEC_ID_COMFORT_NOISE,
     .priv_data_size = sizeof(CNGContext),
@@ -169,8 +167,7 @@ AVCodec ff_comfortnoise_decoder = {
     .decode         = cng_decode_frame,
     .flush          = cng_decode_flush,
     .close          = cng_decode_close,
-    .long_name      = NULL_IF_CONFIG_SMALL("RFC 3389 comfort noise generator"),
     .sample_fmts    = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
                                                      AV_SAMPLE_FMT_NONE },
-    .capabilities   = CODEC_CAP_DELAY | CODEC_CAP_DR1,
+    .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1,
 };