From 89bc6bdc0398fdf2ac4bef682dd3b25a554fd991 Mon Sep 17 00:00:00 2001 From: pkviet Date: Sat, 2 Dec 2017 03:51:13 +0100 Subject: [PATCH] deps/media-playback: Fix compilation with older FFmpeg versions Fixes an issue where media-playback would not compile with older FFmpeg versions due to the fact that the AV_PIX_FMT_VIDEOTOOLBOX was unavailable until version 54.31.100 of libavutil (FFmpeg 2.8). Fixes mantis issue 1045. Closes jp9000/obs-studio#1089 --- deps/media-playback/media-playback/decode.c | 2 +- deps/media-playback/media-playback/decode.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/deps/media-playback/media-playback/decode.c b/deps/media-playback/media-playback/decode.c index db59fc9c8..4d2a3d27d 100644 --- a/deps/media-playback/media-playback/decode.c +++ b/deps/media-playback/media-playback/decode.c @@ -24,7 +24,7 @@ static AVCodec *find_hardware_decoder(enum AVCodecID id) while (hwa) { if (hwa->id == id) { - if (hwa->pix_fmt == AV_PIX_FMT_VIDEOTOOLBOX || + if (hwa->pix_fmt == AV_PIX_FMT_VDTOOL || hwa->pix_fmt == AV_PIX_FMT_DXVA2_VLD || hwa->pix_fmt == AV_PIX_FMT_VAAPI_VLD) { c = avcodec_find_decoder_by_name(hwa->name); diff --git a/deps/media-playback/media-playback/decode.h b/deps/media-playback/media-playback/decode.h index 4838dad8b..f59648538 100644 --- a/deps/media-playback/media-playback/decode.h +++ b/deps/media-playback/media-playback/decode.h @@ -44,6 +44,12 @@ extern "C" { #define CODEC_FLAG_TRUNC CODEC_FLAG_TRUNCATED #endif +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(54, 31, 100) +#define AV_PIX_FMT_VDTOOL AV_PIX_FMT_VIDEOTOOLBOX +#else +#define AV_PIX_FMT_VDTOOL AV_PIX_FMT_VDA_VLD +#endif + struct mp_media; struct mp_decode {