diff --git a/image_writer.c b/image_writer.c index dc7ff96199..877c89e700 100644 --- a/image_writer.c +++ b/image_writer.c @@ -138,7 +138,7 @@ error_exit: if (avctx) avcodec_close(avctx); av_free(avctx); - av_free(pic); + avcodec_free_frame(&pic); free(outbuffer); return success; } diff --git a/libao2/ao_lavc.c b/libao2/ao_lavc.c index 6aab53e291..ef76db2717 100644 --- a/libao2/ao_lavc.c +++ b/libao2/ao_lavc.c @@ -391,7 +391,7 @@ static int encode(struct ao *ao, double apts, void *data) ac->savepts = frame->pts; } - av_free(frame); + avcodec_free_frame(&frame); } else { diff --git a/libav_compat.h b/libav_compat.h index d057f5ea2b..ec6570f0f0 100644 --- a/libav_compat.h +++ b/libav_compat.h @@ -20,9 +20,11 @@ #define MPV_LIBAV_COMPAT_H #include +#include #include +#include -#ifdef AV_CPU_FLAG_MMXEXT +#ifndef AV_CPU_FLAG_MMX2 #define AV_CPU_FLAG_MMX2 AV_CPU_FLAG_MMXEXT #endif @@ -30,4 +32,8 @@ #define AV_CODEC_ID_SUBRIP CODEC_ID_TEXT #endif +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 28, 0) +#define avcodec_free_frame av_freep +#endif + #endif /* MPV_LIBAV_COMPAT_H */ diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c index 1d6683672b..2eacfadb8f 100644 --- a/libmpcodecs/ad_ffmpeg.c +++ b/libmpcodecs/ad_ffmpeg.c @@ -248,7 +248,7 @@ static void uninit(sh_audio_t *sh) av_freep(&lavc_context->extradata); av_freep(&lavc_context); } - av_free(ctx->avframe); + avcodec_free_frame(&ctx->avframe); talloc_free(ctx); sh->context = NULL; } diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index a358dea014..21ecdfaa82 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -365,7 +365,7 @@ static void uninit(sh_video_t *sh) } av_freep(&avctx); - av_freep(&ctx->pic); + avcodec_free_frame(&ctx->pic); talloc_free(ctx); } diff --git a/libvo/vo_lavc.c b/libvo/vo_lavc.c index 96bf32521b..b86cd76509 100644 --- a/libvo/vo_lavc.c +++ b/libvo/vo_lavc.c @@ -436,7 +436,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi, double pts) ++vc->lastdisplaycount; } - av_free(frame); + avcodec_free_frame(&frame); } if (!mpi) {