]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
a52: Fix usage of obsoleted avcodec_*_frame() functions
authorDaniel Kirchner <daniel@ekpyron.org>
Wed, 9 Mar 2016 08:17:09 +0000 (09:17 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 9 Mar 2016 08:19:03 +0000 (09:19 +0100)
pcm_a52.c uses avcodec_alloc_frame and avcodec_free_frame that have
been replaced by av_frame_alloc and av_frame_free in recent versions
of libavcodec.  The following patch should fix this while remaining
backwards compatible.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
a52/pcm_a52.c

index 6fad77dcf3e9180e9b4225670741060acaacd390..564dd73c898e53e95827c5a894591e60d0ccdcaf 100644 (file)
 #define AV_CODEC_ID_AC3 CODEC_ID_AC3
 #endif
 
+#if LIBAVCODEC_VERSION_INT < 0x371c01
+#define av_frame_alloc avcodec_alloc_frame
+#define av_frame_free avcodec_free_frame
+#endif
+
 struct a52_ctx {
        snd_pcm_ioplug_t io;
        snd_pcm_t *slave;
@@ -513,7 +518,7 @@ static void a52_free(struct a52_ctx *rec)
                rec->inbuf = NULL;
        }
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 28, 0)
-       avcodec_free_frame(&rec->frame);
+       av_frame_free(&rec->frame);
 #else
        av_freep(&rec->frame);
 #endif
@@ -557,7 +562,7 @@ static int alloc_input_buffer(snd_pcm_ioplug_t *io)
 {
        struct a52_ctx *rec = io->private_data;
 #ifdef USE_AVCODEC_FRAME
-       rec->frame = avcodec_alloc_frame();
+       rec->frame = av_frame_alloc();
        if (!rec->frame)
                return -ENOMEM;
        if (av_samples_alloc(rec->frame->data, rec->frame->linesize,