1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavu/frame: put frame QP elements under a new version guard

These fields are still used, removal postponed until a replacement functionality is available.
This commit is contained in:
Hendrik Leppkes 2015-09-05 17:35:31 +02:00
parent b9fd813351
commit a991526832
3 changed files with 19 additions and 0 deletions

View File

@ -46,29 +46,35 @@ MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range)
AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame) {return &frame->metadata;}; 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) int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int qp_type)
{ {
av_buffer_unref(&f->qp_table_buf); av_buffer_unref(&f->qp_table_buf);
f->qp_table_buf = buf; f->qp_table_buf = buf;
FF_DISABLE_DEPRECATION_WARNINGS
f->qscale_table = buf->data; f->qscale_table = buf->data;
f->qstride = stride; f->qstride = stride;
f->qscale_type = qp_type; f->qscale_type = qp_type;
FF_ENABLE_DEPRECATION_WARNINGS
return 0; return 0;
} }
int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type) int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type)
{ {
FF_DISABLE_DEPRECATION_WARNINGS
*stride = f->qstride; *stride = f->qstride;
*type = f->qscale_type; *type = f->qscale_type;
FF_ENABLE_DEPRECATION_WARNINGS
if (!f->qp_table_buf) if (!f->qp_table_buf)
return NULL; return NULL;
return f->qp_table_buf->data; return f->qp_table_buf->data;
} }
#endif
const char *av_get_colorspace_name(enum AVColorSpace val) 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); av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);
} }
#if FF_API_FRAME_QP
FF_DISABLE_DEPRECATION_WARNINGS
dst->qscale_table = NULL; dst->qscale_table = NULL;
dst->qstride = 0; dst->qstride = 0;
dst->qscale_type = 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; dst->qscale_type = src->qscale_type;
} }
} }
FF_ENABLE_DEPRECATION_WARNINGS
#endif
return 0; return 0;
} }
@ -471,7 +481,9 @@ void av_frame_unref(AVFrame *frame)
av_buffer_unref(&frame->extended_buf[i]); av_buffer_unref(&frame->extended_buf[i]);
av_freep(&frame->extended_buf); av_freep(&frame->extended_buf);
av_dict_free(&frame->metadata); av_dict_free(&frame->metadata);
#if FF_API_FRAME_QP
av_buffer_unref(&frame->qp_table_buf); av_buffer_unref(&frame->qp_table_buf);
#endif
get_frame_defaults(frame); get_frame_defaults(frame);
} }

View File

@ -477,6 +477,7 @@ typedef struct AVFrame {
*/ */
int pkt_size; int pkt_size;
#if FF_API_FRAME_QP
/** /**
* QP table * QP table
* Not to be accessed directly from outside libavutil * Not to be accessed directly from outside libavutil
@ -497,6 +498,7 @@ typedef struct AVFrame {
* Not to be accessed directly from outside libavutil * Not to be accessed directly from outside libavutil
*/ */
AVBufferRef *qp_table_buf; AVBufferRef *qp_table_buf;
#endif
} AVFrame; } 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); int av_frame_get_pkt_size(const AVFrame *frame);
void av_frame_set_pkt_size(AVFrame *frame, int val); void av_frame_set_pkt_size(AVFrame *frame, int val);
AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame); 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); 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); int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
#endif
enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
enum AVColorRange av_frame_get_color_range(const AVFrame *frame); enum AVColorRange av_frame_get_color_range(const AVFrame *frame);

View File

@ -117,6 +117,9 @@
#ifndef FF_API_VAAPI #ifndef FF_API_VAAPI
#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 56) #define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 56)
#endif #endif
#ifndef FF_API_FRAME_QP
#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 56)
#endif
#ifndef FF_CONST_AVUTIL55 #ifndef FF_CONST_AVUTIL55
#if LIBAVUTIL_VERSION_MAJOR >= 55 #if LIBAVUTIL_VERSION_MAJOR >= 55