Skip to content

Commit

Permalink
build: make libass non-optional
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
wm4 committed Mar 18, 2020
1 parent cb82cbb commit 0b9ed9c
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 71 deletions.
9 changes: 1 addition & 8 deletions player/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <pthread.h>
#include <sys/types.h>

#include <ass/ass.h>
#include <libavutil/avstring.h>
#include <libavutil/common.h>

Expand Down Expand Up @@ -75,10 +76,6 @@
#include <windows.h>
#endif

#if HAVE_LIBASS
#include <ass/ass.h>
#endif

struct command_ctx {
// All properties, terminated with a {0} item.
struct m_property *properties;
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions player/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions sub/dec_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
39 changes: 0 additions & 39 deletions sub/osd_dummy.c

This file was deleted.

15 changes: 2 additions & 13 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
7 changes: 3 additions & 4 deletions wscript_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,17 +386,16 @@ def swift(task):
( "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" ),
( "sub/filter_sdh.c" ),
( "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
Expand Down

0 comments on commit 0b9ed9c

Please sign in to comment.