From d15eb9a570aede392ef175d65f2baf128b35015b Mon Sep 17 00:00:00 2001
From: twinaphex <libretro@gmail.com>
Date: Thu, 3 Mar 2016 18:17:48 +0100
Subject: [PATCH] Add HAVE_SSA switch to qb

---
 Makefile.common                     | 4 ++++
 cores/libretro-ffmpeg/ffmpeg_core.c | 4 ++++
 qb/config.libs.sh                   | 4 ++++
 qb/config.params.sh                 | 1 +
 4 files changed, 13 insertions(+)

diff --git a/Makefile.common b/Makefile.common
index 070363f7a5..4357ad1a7d 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -231,6 +231,10 @@ OBJ += ui/drivers/ui_qt.o
 LIBS += -lQt5Quick -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lglu32 -lopengl32 -L./ui/drivers/qt/wrapper/build/release -lwrapper
 endif
 
+ifeq ($(HAVE_SSA),1)
+LIBS += -lass
+endif
+
 # LibretroDB
 
 ifeq ($(HAVE_LIBRETRODB), 1)
diff --git a/cores/libretro-ffmpeg/ffmpeg_core.c b/cores/libretro-ffmpeg/ffmpeg_core.c
index 376e2390d6..de3266d681 100644
--- a/cores/libretro-ffmpeg/ffmpeg_core.c
+++ b/cores/libretro-ffmpeg/ffmpeg_core.c
@@ -5,6 +5,10 @@
 #include <assert.h>
 #include <stdarg.h>
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/qb/config.libs.sh b/qb/config.libs.sh
index f6cba4352f..163463b921 100644
--- a/qb/config.libs.sh
+++ b/qb/config.libs.sh
@@ -105,6 +105,10 @@ if [ "$HAVE_EGL" != "no" ]; then
    fi
 fi
 
+if [ "HAVE_SSA" != "no" ]; then
+   check_lib SSA -lass ass_library_init
+fi
+
 if [ "$HAVE_EXYNOS" != "no" ]; then
    check_pkgconf EXYNOS libdrm_exynos
    check_pkgconf DRM libdrm
diff --git a/qb/config.params.sh b/qb/config.params.sh
index ae6e07bb27..d65eb48d5a 100644
--- a/qb/config.params.sh
+++ b/qb/config.params.sh
@@ -18,6 +18,7 @@ HAVE_GLES_CFLAGS=          # C-flags for custom GLES library
 HAVE_THREADS=auto          # Threading support
 HAVE_FFMPEG=auto           # Enable FFmpeg recording support
 C89_FFMPEG=no
+HAVE_SSA=auto              # Enable SSA/ASS for FFmpeg subtitle support
 HAVE_DYLIB=auto            # Enable dynamic loading support
 HAVE_NETWORKING=auto       # Enable networking features (recommended)
 HAVE_NETPLAY=auto          # Enable netplay support (requires networking)