From 0b9ed9c2744ada1eefc1f254c5f3ade6c626ed72 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 18 Mar 2020 22:45:59 +0100 Subject: [PATCH] build: make libass non-optional Using mpv without libass isn't really supported, since it's not only used to display ASS subtitles, but all text subtitles, and even OSD. At least 1 user complained that the player printed a warning if built without libass. Avoid trying to create the impression that using this software without libass is in any way supported or desirable, and make it fully mandatory. (As far as making dependencies optional goes, I'd rather make ffmpeg optional, which is an oversized and bloated library, rather than something tiny like libass.) --- player/command.c | 9 +-------- player/main.c | 5 ----- sub/dec_sub.c | 2 -- sub/osd_dummy.c | 39 --------------------------------------- wscript | 15 ++------------- wscript_build.py | 7 +++---- 6 files changed, 6 insertions(+), 71 deletions(-) delete mode 100644 sub/osd_dummy.c diff --git a/player/command.c b/player/command.c index d894f28f89..73c6d86712 100644 --- a/player/command.c +++ b/player/command.c @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -75,10 +76,6 @@ #include #endif -#if HAVE_LIBASS -#include -#endif - struct command_ctx { // All properties, terminated with a {0} item. struct m_property *properties; @@ -3012,11 +3009,7 @@ static int mp_property_ffmpeg(void *ctx, struct m_property *prop, static int mp_property_libass_version(void *ctx, struct m_property *prop, int action, void *arg) { -#if HAVE_LIBASS return m_property_int64_ro(action, arg, ass_library_version()); -#else - return M_PROPERTY_UNAVAILABLE; -#endif } static int mp_property_alias(void *ctx, struct m_property *prop, diff --git a/player/main.c b/player/main.c index 3d38be4f43..f42d181806 100644 --- a/player/main.c +++ b/player/main.c @@ -402,11 +402,6 @@ int mp_initialize(struct MPContext *mpctx, char **options) mp_input_enable_section(mpctx->input, "encode", MP_INPUT_EXCLUSIVE); } -#if !HAVE_LIBASS - MP_WARN(mpctx, "Compiled without libass.\n"); - MP_WARN(mpctx, "There will be no OSD and no text subtitles.\n"); -#endif - mp_load_scripts(mpctx); if (opts->force_vo == 2 && handle_force_window(mpctx, false) < 0) diff --git a/sub/dec_sub.c b/sub/dec_sub.c index 430f8aefbe..3842235c46 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -39,9 +39,7 @@ extern const struct sd_functions sd_lavc; static const struct sd_functions *const sd_list[] = { &sd_lavc, -#if HAVE_LIBASS &sd_ass, -#endif NULL }; diff --git a/sub/osd_dummy.c b/sub/osd_dummy.c deleted file mode 100644 index db032ec5b1..0000000000 --- a/sub/osd_dummy.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include - -#include "config.h" -#include "mpv_talloc.h" -#include "osd_state.h" - -void osd_init_backend(struct osd_state *osd) -{ -} - -void osd_destroy_backend(struct osd_state *osd) -{ -} - -void osd_get_function_sym(char *buffer, size_t buffer_size, int osd_function) -{ -} - -void osd_object_get_bitmaps(struct osd_state *osd, struct osd_object *obj, - int format, struct sub_bitmaps *out_imgs) -{ - *out_imgs = (struct sub_bitmaps) {0}; -} - -void osd_set_external(struct osd_state *osd, struct osd_external_ass *ov) -{ -} - -void osd_set_external_remove_owner(struct osd_state *osd, void *owner) -{ -} - -void osd_get_text_size(struct osd_state *osd, int *out_screen_h, int *out_font_h) -{ - *out_screen_h = 0; - *out_font_h = 0; -} diff --git a/wscript b/wscript index 1dda323f67..55f97d29b1 100644 --- a/wscript +++ b/wscript @@ -336,24 +336,13 @@ iconv support use --disable-iconv.", 'desc' : 'Javascript (MuJS backend)', 'func': check_pkg_config('mujs', '>= 1.0.0'), }, { - 'name': '--libass', + 'name': 'libass', 'desc': 'SSA/ASS support', 'func': check_pkg_config('libass', '>= 0.12.1'), 'req': True, 'fmsg': "Unable to find development files for libass, or the version " + - "found is too old. Aborting. If you really mean to compile " + - "without libass support use --disable-libass." + "found is too old. Aborting." }, { - 'name': '--libass-osd', - 'desc': 'libass OSD support', - 'deps': 'libass', - 'func': check_true, - }, { - 'name': 'dummy-osd', - 'desc': 'dummy OSD support', - 'deps': '!libass-osd', - 'func': check_true, - } , { 'name': '--zlib', 'desc': 'zlib', 'func': check_libs(['z'], diff --git a/wscript_build.py b/wscript_build.py index a74e6d0f62..0951d79b48 100644 --- a/wscript_build.py +++ b/wscript_build.py @@ -386,7 +386,7 @@ def build(ctx): ( "stream/stream_null.c" ), ## Subtitles - ( "sub/ass_mp.c", "libass"), + ( "sub/ass_mp.c" ), ( "sub/dec_sub.c" ), ( "sub/draw_bmp.c" ), ( "sub/filter_regex.c", "posix" ), @@ -394,9 +394,8 @@ def build(ctx): ( "sub/img_convert.c" ), ( "sub/lavc_conv.c" ), ( "sub/osd.c" ), - ( "sub/osd_dummy.c", "dummy-osd" ), - ( "sub/osd_libass.c", "libass-osd" ), - ( "sub/sd_ass.c", "libass" ), + ( "sub/osd_libass.c" ), + ( "sub/sd_ass.c" ), ( "sub/sd_lavc.c" ), ## Tests