---
libavcodec/avcodec.h | 2 ++
libavcodec/decode.c | 8 ++++++++
libavcodec/version.h | 3 +++
3 files changed, 13 insertions(+)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1c58fe2..0a8bf50 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1980,6 +1980,7 @@ typedef struct AVCodecContext {
*/
int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
+#if FF_API_OLD_DECODE
/**
* If non-zero, the decoded audio and video frames returned from
* avcodec_decode_video2() and avcodec_decode_audio4() are
reference-counted
@@ -1994,6 +1995,7 @@ typedef struct AVCodecContext {
* - decoding: set by the caller before avcodec_open2().
*/
attribute_deprecated int refcounted_frames;
+#endif
/* - encoding parameters */
float qcompress; ///< amount of qscale change between easy & hard scenes
(0.0-1.0)
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index e4f6a0d..47389a2 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -586,6 +586,7 @@ int attribute_align_arg
avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
return 0;
}
+#if FF_API_OLD_DECODE
static int compat_decode(AVCodecContext *avctx, AVFrame *frame,
int *got_frame, AVPacket *pkt)
{
@@ -627,7 +628,9 @@ static int compat_decode(AVCodecContext *avctx, AVFrame
*frame,
}
if (frame != avci->compat_decode_frame) {
+FF_DISABLE_DEPRECATION_WARNINGS
if (!avctx->refcounted_frames) {
+FF_ENABLE_DEPRECATION_WARNINGS
ret = unrefcount_frame(avci, frame);
if (ret < 0)
goto finish;
@@ -677,6 +680,7 @@ int attribute_align_arg
avcodec_decode_audio4(AVCodecContext *avctx,
{
return compat_decode(avctx, frame, got_frame_ptr, avpkt);
}
+#endif /* FF_API_OLD_DECODE */
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
int *got_sub_ptr,
@@ -1196,8 +1200,12 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
ff_decode_bsfs_uninit(avctx);
+#if FF_API_OLD_DECODE
+FF_DISABLE_DEPRECATION_WARNINGS
if (!avctx->refcounted_frames)
av_frame_unref(avctx->internal->to_free);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
void ff_decode_bsfs_uninit(AVCodecContext *avctx)
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 4fb0a97..04fec2a 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_OLD_DECODE
+#define FF_API_OLD_DECODE (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
#endif /* AVCODEC_VERSION_H */
--
2.1.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel