mirror of https://github.com/mpv-player/mpv
video: use new method to get QP table
This only matters for those who want to use vf_pp. The old API is marked as deprecated, and doesn't work on Libav. It was broken on FFmpeg, but has recently started working again - the fields in question were not un- deprecated though. Instead you're supposed to use a new API, which does exactly the same thing (what...?). Also don't pass the QP table with mp_image_copy_attributes() - it probably does more harm than it's useful. By the way, with -vf=dlopen=TOOLS/vf_dlopen/showqscale.so, it appears the table as output by recent FFmpeg is offset by 1 macroblock in X direction and 2 macroblocks in Y direction, which most likely will interfere with normal vf_pp operation. However, this is not my problem. The only real reason for this commit is that we can finally get rid of all libav* related deprecation warnings. (Though they are constantly deprecating APIs, so this will not last long.)
This commit is contained in:
parent
e837d8ddac
commit
a9c9999973
|
@ -2711,6 +2711,17 @@ if test "$_resampler" = no ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echocheck "libavutil QP API"
|
||||||
|
_avutil_has_qp_api=no
|
||||||
|
statement_check libavutil/frame.h 'av_frame_get_qp_table(NULL, NULL, NULL)' && _avutil_has_qp_api=yes
|
||||||
|
if test "$_avutil_has_qp_api" = yes ; then
|
||||||
|
def_avutil_has_qp_api='#define HAVE_AVUTIL_QP_API 1'
|
||||||
|
else
|
||||||
|
def_avutil_has_qp_api='#define HAVE_AVUTIL_QP_API 0'
|
||||||
|
fi
|
||||||
|
echores "$_avutil_has_qp_api"
|
||||||
|
|
||||||
|
|
||||||
echocheck "libavutil ref-counting API"
|
echocheck "libavutil ref-counting API"
|
||||||
_avutil_has_refcounting=no
|
_avutil_has_refcounting=no
|
||||||
statement_check libavutil/frame.h 'av_frame_unref(NULL)' && _avutil_has_refcounting=yes
|
statement_check libavutil/frame.h 'av_frame_unref(NULL)' && _avutil_has_refcounting=yes
|
||||||
|
@ -3221,6 +3232,7 @@ $def_mpg123
|
||||||
$def_zlib
|
$def_zlib
|
||||||
|
|
||||||
$def_avutil_has_refcounting
|
$def_avutil_has_refcounting
|
||||||
|
$def_avutil_has_qp_api
|
||||||
$def_libpostproc
|
$def_libpostproc
|
||||||
$def_libavdevice
|
$def_libavdevice
|
||||||
$def_libavfilter
|
$def_libavfilter
|
||||||
|
|
|
@ -318,8 +318,6 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src)
|
||||||
dst->qscale_type = src->qscale_type;
|
dst->qscale_type = src->qscale_type;
|
||||||
dst->pts = src->pts;
|
dst->pts = src->pts;
|
||||||
if (dst->w == src->w && dst->h == src->h) {
|
if (dst->w == src->w && dst->h == src->h) {
|
||||||
dst->qstride = src->qstride;
|
|
||||||
dst->qscale = src->qscale;
|
|
||||||
dst->display_w = src->display_w;
|
dst->display_w = src->display_w;
|
||||||
dst->display_h = src->display_h;
|
dst->display_h = src->display_h;
|
||||||
}
|
}
|
||||||
|
@ -447,10 +445,8 @@ void mp_image_copy_fields_from_av_frame(struct mp_image *dst,
|
||||||
dst->stride[i] = src->linesize[i];
|
dst->stride[i] = src->linesize[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
dst->qscale = src->qscale_table;
|
|
||||||
dst->qstride = src->qstride;
|
|
||||||
dst->pict_type = src->pict_type;
|
dst->pict_type = src->pict_type;
|
||||||
dst->qscale_type = src->qscale_type;
|
|
||||||
dst->fields = MP_IMGFIELD_ORDERED;
|
dst->fields = MP_IMGFIELD_ORDERED;
|
||||||
if (src->interlaced_frame)
|
if (src->interlaced_frame)
|
||||||
dst->fields |= MP_IMGFIELD_INTERLACED;
|
dst->fields |= MP_IMGFIELD_INTERLACED;
|
||||||
|
@ -458,6 +454,14 @@ void mp_image_copy_fields_from_av_frame(struct mp_image *dst,
|
||||||
dst->fields |= MP_IMGFIELD_TOP_FIRST;
|
dst->fields |= MP_IMGFIELD_TOP_FIRST;
|
||||||
if (src->repeat_pict == 1)
|
if (src->repeat_pict == 1)
|
||||||
dst->fields |= MP_IMGFIELD_REPEAT_FIRST;
|
dst->fields |= MP_IMGFIELD_REPEAT_FIRST;
|
||||||
|
|
||||||
|
#if HAVE_AVUTIL_QP_API
|
||||||
|
dst->qscale = av_frame_get_qp_table(src, &dst->qstride, &dst->qscale_type);
|
||||||
|
#else
|
||||||
|
dst->qscale = src->qscale_table;
|
||||||
|
dst->qstride = src->qstride;
|
||||||
|
dst->qscale_type = src->qscale_type;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_AVUTIL_REFCOUNTING
|
#if HAVE_AVUTIL_REFCOUNTING
|
||||||
|
|
Loading…
Reference in New Issue