From c88f2b31ee22277355973f9340090168501c9b3e Mon Sep 17 00:00:00 2001 From: Nils Hasenbanck Date: Thu, 5 Dec 2019 19:39:56 +0100 Subject: [PATCH] Fix ffmpeg core build under linux. Libass is optional again. This build will also compile with ffmpeg 3.4 again, but HW acceleration is not guaranteed to work, since it hasn't been tested well enough. --- cores/libretro-ffmpeg/ffmpeg_core.c | 12 ++++++++++++ qb/config.libs.sh | 13 ++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/cores/libretro-ffmpeg/ffmpeg_core.c b/cores/libretro-ffmpeg/ffmpeg_core.c index 0ac8e0dee9..1f5c76f703 100644 --- a/cores/libretro-ffmpeg/ffmpeg_core.c +++ b/cores/libretro-ffmpeg/ffmpeg_core.c @@ -20,6 +20,7 @@ extern "C" { #include #include #include +#include #include #include #include @@ -426,9 +427,11 @@ static void check_variables(bool firststart) hw_decoder = AV_HWDEVICE_TYPE_DRM; else if (string_is_equal(hw_var.value, "dxva2")) hw_decoder = AV_HWDEVICE_TYPE_DXVA2; +#if LIBAVUTIL_VERSION_MAJOR > 55 else if (string_is_equal(hw_var.value, "mediacodec")) hw_decoder = AV_HWDEVICE_TYPE_MEDIACODEC; else if (string_is_equal(hw_var.value, "opencl")) +#endif hw_decoder = AV_HWDEVICE_TYPE_OPENCL; else if (string_is_equal(hw_var.value, "qsv")) hw_decoder = AV_HWDEVICE_TYPE_QSV; @@ -1230,7 +1233,12 @@ static void render_ass_img(AVFrame *conv_frame, ASS_Image *img) } #endif + +#ifdef HAVE_SSA static void decode_video(AVCodecContext *ctx, AVPacket *pkt, AVFrame *conv_frame, size_t frame_size, struct SwsContext **sws, ASS_Track *ass_track_active) +#else +static void decode_video(AVCodecContext *ctx, AVPacket *pkt, AVFrame *conv_frame, size_t frame_size, struct SwsContext **sws) +#endif { int ret; AVFrame *frame = NULL; @@ -1536,7 +1544,11 @@ static void decode_thread(void *data) slock_unlock(decode_thread_lock); if (pkt.stream_index == video_stream_index) + #ifdef HAVE_SSA decode_video(vctx, &pkt, conv_frame, frame_size, &sws, ass_track_active); + #else + decode_video(vctx, &pkt, conv_frame, frame_size, &sws); + #endif else if (pkt.stream_index == audio_stream && actx_active) { audio_buffer = decode_audio(actx_active, &pkt, aud_frame, diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 51b70ea12a..ccfb490fb9 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -387,13 +387,12 @@ check_lib '' DRMINGW -lexchndl check_enabled THREADS FFMPEG FFmpeg 'Threads are' false if [ "$HAVE_FFMPEG" != 'no' ]; then - check_val '' AVCODEC -lavcodec '' libavcodec 54 '' false - check_val '' AVFORMAT -lavformat '' libavformat 54 '' false - check_val '' AVDEVICE -lavdevice '' libavdevice '' '' false - check_val '' SWRESAMPLE -lswresample '' libswresample '' '' false - check_val '' AVRESAMPLE -lavresample '' libavresample '' '' false - check_val '' AVUTIL -lavutil '' libavutil 51 '' false - check_val '' SWSCALE -lswscale '' libswscale 2.1 '' false + check_val '' AVCODEC -lavcodec '' libavcodec 57 '' false + check_val '' AVFORMAT -lavformat '' libavformat 57 '' false + check_val '' AVDEVICE -lavdevice '' libavdevice 57 '' false + check_val '' SWRESAMPLE -lswresample '' libswresample 2 '' false + check_val '' AVUTIL -lavutil '' libavutil 55 '' false + check_val '' SWSCALE -lswscale '' libswscale 4 '' false check_header AV_CHANNEL_LAYOUT libavutil/channel_layout.h