summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure12
-rw-r--r--sub/sd_lavc_conv.c18
2 files changed, 29 insertions, 1 deletions
diff --git a/configure b/configure
index e6b77f4595..0b0913bf8c 100755
--- a/configure
+++ b/configure
@@ -2684,6 +2684,17 @@ else
fi
+echocheck "libavcodec AV_CODEC_PROP_TEXT_SUB API"
+_avcodec_has_text_flag_api=no
+statement_check libavcodec/avcodec.h 'int x = AV_CODEC_PROP_TEXT_SUB' && _avcodec_has_text_flag_api=yes
+if test "$_avcodec_has_text_flag_api" = yes ; then
+ def_avcodec_has_text_flag_api='#define HAVE_AV_CODEC_PROP_TEXT_SUB 1'
+else
+ def_avcodec_has_text_flag_api='#define HAVE_AV_CODEC_PROP_TEXT_SUB 0'
+fi
+echores "$_avcodec_has_text_flag_api"
+
+
echocheck "libavutil QP API"
_avutil_has_qp_api=no
statement_check libavutil/frame.h 'av_frame_get_qp_table(NULL, NULL, NULL)' && _avutil_has_qp_api=yes
@@ -3268,6 +3279,7 @@ $def_zlib
$def_avutil_has_refcounting
$def_avutil_has_qp_api
+$def_avcodec_has_text_flag_api
$def_libpostproc
$def_libavdevice
$def_libavfilter
diff --git a/sub/sd_lavc_conv.c b/sub/sd_lavc_conv.c
index e45e743499..744aa83440 100644
--- a/sub/sd_lavc_conv.c
+++ b/sub/sd_lavc_conv.c
@@ -22,6 +22,8 @@
#include <libavutil/intreadwrite.h>
#include <libavutil/common.h>
+#include "config.h"
+
#include "talloc.h"
#include "core/mp_msg.h"
#include "core/av_common.h"
@@ -35,8 +37,22 @@ static bool supports_format(const char *format)
{
enum AVCodecID cid = mp_codec_to_av_codec_id(format);
const AVCodecDescriptor *desc = avcodec_descriptor_get(cid);
+ if (!desc)
+ return false;
+#if HAVE_AV_CODEC_PROP_TEXT_SUB
// These are documented to support AVSubtitleRect->ass.
- return desc && (desc->props & AV_CODEC_PROP_TEXT_SUB);
+ return desc->props & AV_CODEC_PROP_TEXT_SUB;
+#else
+ const char *whitelist[] =
+ {"text", "ass", "ssa", "mov_text", "srt", "subrip", "microdvd", "mpl2",
+ "jacosub", "pjs", "sami", "realtext", "subviewer", "subviewer1",
+ "vplayer", "webvtt", 0};
+ for (int n = 0; whitelist[n]; n++) {
+ if (strcmp(format, whitelist[n]) == 0)
+ return true;
+ }
+ return false;
+#endif
}
static int init(struct sd *sd)