mirror of https://github.com/mpv-player/mpv
build: replace some FFmpeg API checks with version checks
The FFmpeg versions we support all have the APIs we were checking for. Only Libav missed them. Simplify this by explicitly checking for FFmpeg in the code, instead of trying to detect the presence of the API.
This commit is contained in:
parent
6be58df8d1
commit
b14fac9afa
|
@ -115,7 +115,7 @@ static int init(struct dec_audio *da, const char *decoder)
|
|||
av_opt_set_double(lavc_context, "drc_scale", opts->ac3drc,
|
||||
AV_OPT_SEARCH_CHILDREN);
|
||||
|
||||
#if HAVE_AVFRAME_SKIP_SAMPLES
|
||||
#if LIBAVCODEC_VERSION_MICRO >= 100
|
||||
// Let decoder add AV_FRAME_DATA_SKIP_SAMPLES.
|
||||
av_opt_set(lavc_context, "flags2", "+skip_manual", AV_OPT_SEARCH_CHILDREN);
|
||||
#endif
|
||||
|
@ -251,7 +251,7 @@ static bool receive_frame(struct dec_audio *da, struct mp_audio **out)
|
|||
if (mpframe->pts != MP_NOPTS_VALUE)
|
||||
priv->next_pts = mpframe->pts + mpframe->samples / (double)mpframe->rate;
|
||||
|
||||
#if HAVE_AVFRAME_SKIP_SAMPLES
|
||||
#if LIBAVCODEC_VERSION_MICRO >= 100
|
||||
AVFrameSideData *sd =
|
||||
av_frame_get_side_data(priv->avframe, AV_FRAME_DATA_SKIP_SAMPLES);
|
||||
if (sd && sd->size >= 10) {
|
||||
|
|
|
@ -246,7 +246,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||
|
||||
static void get_metadata_from_av_frame(struct af_instance *af, AVFrame *frame)
|
||||
{
|
||||
#if HAVE_AVFRAME_METADATA
|
||||
#if LIBAVUTIL_VERSION_MICRO >= 100
|
||||
struct priv *p = af->priv;
|
||||
if (!p->metadata)
|
||||
p->metadata = talloc_zero(p, struct mp_tags);
|
||||
|
|
|
@ -132,7 +132,7 @@ struct demux_packet *demux_copy_packet(struct demux_packet *dp)
|
|||
|
||||
int demux_packet_set_padding(struct demux_packet *dp, int start, int end)
|
||||
{
|
||||
#if HAVE_AVFRAME_SKIP_SAMPLES
|
||||
#if LIBAVCODEC_VERSION_MICRO >= 100
|
||||
if (!start && !end)
|
||||
return 0;
|
||||
if (!dp->avpacket)
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "video/csputils.h"
|
||||
#include "video/sws_utils.h"
|
||||
|
||||
#if HAVE_AVUTIL_MASTERING_METADATA
|
||||
#if LIBAVCODEC_VERSION_MICRO >= 100
|
||||
#include <libavutil/mastering_display_metadata.h>
|
||||
#endif
|
||||
|
||||
|
@ -624,7 +624,7 @@ static void update_image_params(struct dec_video *vd, AVFrame *frame,
|
|||
{
|
||||
vd_ffmpeg_ctx *ctx = vd->priv;
|
||||
|
||||
#if HAVE_AVUTIL_MASTERING_METADATA
|
||||
#if LIBAVCODEC_VERSION_MICRO >= 100
|
||||
// Get the reference peak (for HDR) if available. This is cached into ctx
|
||||
// when it's found, since it's not available on every frame (and seems to
|
||||
// be only available for keyframes)
|
||||
|
|
|
@ -287,7 +287,7 @@ static struct mp_image *av_to_mp(struct vf_instance *vf, AVFrame *av_frame)
|
|||
|
||||
static void get_metadata_from_av_frame(struct vf_instance *vf, AVFrame *frame)
|
||||
{
|
||||
#if HAVE_AVFRAME_METADATA
|
||||
#if LIBAVUTIL_VERSION_MICRO >= 100
|
||||
struct vf_priv_s *p = vf->priv;
|
||||
if (!p->metadata)
|
||||
p->metadata = talloc_zero(p, struct mp_tags);
|
||||
|
|
|
@ -217,7 +217,7 @@ int mp_sws_reinit(struct mp_sws_context *ctx)
|
|||
av_opt_set_double(ctx->sws, "param0", ctx->params[0], 0);
|
||||
av_opt_set_double(ctx->sws, "param1", ctx->params[1], 0);
|
||||
|
||||
#if HAVE_AVCODEC_CHROMA_POS_API
|
||||
#if LIBAVCODEC_VERSION_MICRO >= 100
|
||||
int cr_src = mp_chroma_location_to_av(src->chroma_location);
|
||||
int cr_dst = mp_chroma_location_to_av(dst->chroma_location);
|
||||
int cr_xpos, cr_ypos;
|
||||
|
|
24
wscript
24
wscript
|
@ -451,30 +451,6 @@ FFmpeg/Libav libraries. You need at least {0}. Aborting.".format(libav_versions_
|
|||
'name': '--libavdevice',
|
||||
'desc': 'libavdevice',
|
||||
'func': check_pkg_config('libavdevice', '>= 57.0.0'),
|
||||
}, {
|
||||
'name': 'avcodec-chroma-pos-api',
|
||||
'desc': 'libavcodec avcodec_enum_to_chroma_pos API',
|
||||
'func': check_statement('libavcodec/avcodec.h', """int x, y;
|
||||
avcodec_enum_to_chroma_pos(&x, &y, AVCHROMA_LOC_UNSPECIFIED)""",
|
||||
use='libav')
|
||||
}, {
|
||||
'name': 'avframe-metadata',
|
||||
'desc': 'libavutil AVFrame metadata',
|
||||
'func': check_statement('libavutil/frame.h',
|
||||
'av_frame_get_metadata(NULL)',
|
||||
use='libav')
|
||||
}, {
|
||||
'name': 'avframe-skip-samples',
|
||||
'desc': 'libavutil AVFrame skip samples metadata',
|
||||
'func': check_statement('libavutil/frame.h',
|
||||
'enum AVFrameSideDataType type = AV_FRAME_DATA_SKIP_SAMPLES',
|
||||
use='libav')
|
||||
}, {
|
||||
'name': 'avutil-mastering-metadata',
|
||||
'desc': 'libavutil mastering display metadata struct',
|
||||
'func': check_statement('libavutil/frame.h',
|
||||
'AV_FRAME_DATA_MASTERING_DISPLAY_METADATA',
|
||||
use='libav'),
|
||||
}, {
|
||||
'name': 'avutil-imgcpy-uc',
|
||||
'desc': 'libavutil GPU memcpy for hardware decoding',
|
||||
|
|
Loading…
Reference in New Issue