On Sun, 22 Oct 2017 07:57:42 +0200
Diego Biurrun <di...@biurrun.de> wrote:

> ---
>  libavcodec/decode.c      | 11 +++++++++++
>  libavcodec/version.h     |  3 +++
>  libavfilter/vsrc_movie.c |  5 +++++
>  3 files changed, 19 insertions(+)
> 
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index b74c163f92..040e1cc08e 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -36,6 +36,7 @@
>  #include "decode.h"
>  #include "internal.h"
>  #include "thread.h"
> +#include "version.h"
>  
>  static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
>  {
> @@ -576,11 +577,15 @@ static int compat_decode(AVCodecContext *avctx, AVFrame 
> *frame,
>          }
>  
>          if (frame != avci->compat_decode_frame) {
> +#if FF_API_REFCOUNTED_FRAMES
> +FF_DISABLE_DEPRECATION_WARNINGS
>              if (!avctx->refcounted_frames) {
>                  ret = unrefcount_frame(avci, frame);
>                  if (ret < 0)
>                      goto finish;
>              }
> +FF_ENABLE_DEPRECATION_WARNINGS
> +#endif
>  
>              *got_frame = 1;
>              frame = avci->compat_decode_frame;
> @@ -1277,8 +1282,14 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
>  
>      ff_decode_bsfs_uninit(avctx);
>  
> +#if FF_API_REFCOUNTED_FRAMES
> +FF_DISABLE_DEPRECATION_WARNINGS
>      if (!avctx->refcounted_frames)
>          av_frame_unref(avctx->internal->to_free);
> +FF_ENABLE_DEPRECATION_WARNINGS
> +#else
> +    av_frame_unref(avctx->internal->to_free);
> +#endif
>  }
>  
>  void ff_decode_bsfs_uninit(AVCodecContext *avctx)
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index aa6cdcd6bc..f0cba4cc6b 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -95,5 +95,8 @@
>  #ifndef FF_API_VAAPI_CONTEXT
>  #define FF_API_VAAPI_CONTEXT    (LIBAVCODEC_VERSION_MAJOR < 59)
>  #endif
> +#ifndef FF_API_REFCOUNTED_FRAMES
> +#define FF_API_REFCOUNTED_FRAMES (LIBAVCODEC_VERSION_MAJOR < 59)
> +#endif
>  
>  #endif /* AVCODEC_VERSION_H */
> diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c
> index aff6e620ff..0bacb672fd 100644
> --- a/libavfilter/vsrc_movie.c
> +++ b/libavfilter/vsrc_movie.c
> @@ -37,6 +37,7 @@
>  #include "libavutil/imgutils.h"
>  
>  #include "libavcodec/avcodec.h"
> +#include "libavcodec/version.h"
>  
>  #include "libavformat/avformat.h"
>  
> @@ -157,7 +158,11 @@ static av_cold int movie_init(AVFilterContext *ctx)
>      if (ret < 0)
>          return ret;
>  
> +#if FF_API_REFCOUNTED_FRAMES
> +FF_DISABLE_DEPRECATION_WARNINGS
>      movie->codec_ctx->refcounted_frames = 1;
> +FF_ENABLE_DEPRECATION_WARNINGS
> +#endif
>  
>      if ((ret = avcodec_open2(movie->codec_ctx, codec, NULL)) < 0) {
>          av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");

LGTM, but wondering what'll happen with the avctx field.
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to