From a9915268327b097bba84a07f68968d8c07f4b549 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 5 Sep 2015 17:35:31 +0200 Subject: [PATCH] lavu/frame: put frame QP elements under a new version guard These fields are still used, removal postponed until a replacement functionality is available. --- libavutil/frame.c | 12 ++++++++++++ libavutil/frame.h | 4 ++++ libavutil/version.h | 3 +++ 3 files changed, 19 insertions(+) diff --git a/libavutil/frame.c b/libavutil/frame.c index f403fd75ddf..7b4177bc953 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -46,29 +46,35 @@ MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range) AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame) {return &frame->metadata;}; +#if FF_API_FRAME_QP int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int qp_type) { av_buffer_unref(&f->qp_table_buf); f->qp_table_buf = buf; +FF_DISABLE_DEPRECATION_WARNINGS f->qscale_table = buf->data; f->qstride = stride; f->qscale_type = qp_type; +FF_ENABLE_DEPRECATION_WARNINGS return 0; } int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type) { +FF_DISABLE_DEPRECATION_WARNINGS *stride = f->qstride; *type = f->qscale_type; +FF_ENABLE_DEPRECATION_WARNINGS if (!f->qp_table_buf) return NULL; return f->qp_table_buf->data; } +#endif const char *av_get_colorspace_name(enum AVColorSpace val) { @@ -342,6 +348,8 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy) av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0); } +#if FF_API_FRAME_QP +FF_DISABLE_DEPRECATION_WARNINGS dst->qscale_table = NULL; dst->qstride = 0; dst->qscale_type = 0; @@ -353,6 +361,8 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy) dst->qscale_type = src->qscale_type; } } +FF_ENABLE_DEPRECATION_WARNINGS +#endif return 0; } @@ -471,7 +481,9 @@ void av_frame_unref(AVFrame *frame) av_buffer_unref(&frame->extended_buf[i]); av_freep(&frame->extended_buf); av_dict_free(&frame->metadata); +#if FF_API_FRAME_QP av_buffer_unref(&frame->qp_table_buf); +#endif get_frame_defaults(frame); } diff --git a/libavutil/frame.h b/libavutil/frame.h index f5e89376bad..5270798c55f 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -477,6 +477,7 @@ typedef struct AVFrame { */ int pkt_size; +#if FF_API_FRAME_QP /** * QP table * Not to be accessed directly from outside libavutil @@ -497,6 +498,7 @@ typedef struct AVFrame { * Not to be accessed directly from outside libavutil */ AVBufferRef *qp_table_buf; +#endif } AVFrame; /** @@ -523,8 +525,10 @@ void av_frame_set_decode_error_flags (AVFrame *frame, int val); int av_frame_get_pkt_size(const AVFrame *frame); void av_frame_set_pkt_size(AVFrame *frame, int val); AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame); +#if FF_API_FRAME_QP int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type); +#endif enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); enum AVColorRange av_frame_get_color_range(const AVFrame *frame); diff --git a/libavutil/version.h b/libavutil/version.h index 9fbdc7227c9..31d952197f8 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -117,6 +117,9 @@ #ifndef FF_API_VAAPI #define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 56) #endif +#ifndef FF_API_FRAME_QP +#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 56) +#endif #ifndef FF_CONST_AVUTIL55 #if LIBAVUTIL_VERSION_MAJOR >= 55 -- 2.39.2