From 113ec0aba1997d35d221892d2afb12599680da1d Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 16 Mar 2014 13:03:54 +0100 Subject: [PATCH] af_lavcac3enc: use new AVFrame API --- audio/filter/af_lavcac3enc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/audio/filter/af_lavcac3enc.c b/audio/filter/af_lavcac3enc.c index 34de6adb74..02211a2a61 100644 --- a/audio/filter/af_lavcac3enc.c +++ b/audio/filter/af_lavcac3enc.c @@ -185,7 +185,7 @@ static int filter(struct af_instance* af, struct mp_audio* audio, int flags) } in_frame.samples = s->in_samples; - AVFrame *frame = avcodec_alloc_frame(); + AVFrame *frame = av_frame_alloc(); if (!frame) { MP_FATAL(af, "Could not allocate memory \n"); return -1; @@ -194,19 +194,19 @@ static int filter(struct af_instance* af, struct mp_audio* audio, int flags) frame->format = s->lavc_actx->sample_fmt; frame->channel_layout = s->lavc_actx->channel_layout; assert(in_frame.num_planes <= AV_NUM_DATA_POINTERS); + frame->extended_data = frame->data; for (int n = 0; n < in_frame.num_planes; n++) frame->data[n] = in_frame.planes[n]; frame->linesize[0] = s->in_samples * audio->sstride; int ok; ret = avcodec_encode_audio2(s->lavc_actx, &s->pkt, frame, &ok); + av_frame_free(&frame); if (ret < 0 || !ok) { MP_FATAL(af, "Encode failed.\n"); return -1; } - avcodec_free_frame(&frame); - mp_audio_buffer_skip(s->pending, consumed_pending); MP_DBG(af, "avcodec_encode_audio got %d, pending %d.\n",