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.
This commit is contained in:
Nils Hasenbanck 2019-12-05 19:39:56 +01:00
parent a01e99aa63
commit c88f2b31ee
2 changed files with 18 additions and 7 deletions

View File

@ -20,6 +20,7 @@ extern "C" {
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
#include <libavutil/error.h>
#include <libavutil/hwcontext.h>
#include <libavutil/imgutils.h>
#include <libavutil/time.h>
#include <libavutil/opt.h>
@ -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,

View File

@ -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