1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 00:02:13 +00:00

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.)
This commit is contained in:
wm4 2020-03-18 22:45:59 +01:00
parent cb82cbbbae
commit 0b9ed9c274
6 changed files with 6 additions and 71 deletions

View File

@ -27,6 +27,7 @@
#include <pthread.h> #include <pthread.h>
#include <sys/types.h> #include <sys/types.h>
#include <ass/ass.h>
#include <libavutil/avstring.h> #include <libavutil/avstring.h>
#include <libavutil/common.h> #include <libavutil/common.h>
@ -75,10 +76,6 @@
#include <windows.h> #include <windows.h>
#endif #endif
#if HAVE_LIBASS
#include <ass/ass.h>
#endif
struct command_ctx { struct command_ctx {
// All properties, terminated with a {0} item. // All properties, terminated with a {0} item.
struct m_property *properties; 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, static int mp_property_libass_version(void *ctx, struct m_property *prop,
int action, void *arg) int action, void *arg)
{ {
#if HAVE_LIBASS
return m_property_int64_ro(action, arg, ass_library_version()); 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, static int mp_property_alias(void *ctx, struct m_property *prop,

View File

@ -402,11 +402,6 @@ int mp_initialize(struct MPContext *mpctx, char **options)
mp_input_enable_section(mpctx->input, "encode", MP_INPUT_EXCLUSIVE); 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); mp_load_scripts(mpctx);
if (opts->force_vo == 2 && handle_force_window(mpctx, false) < 0) if (opts->force_vo == 2 && handle_force_window(mpctx, false) < 0)

View File

@ -39,9 +39,7 @@ extern const struct sd_functions sd_lavc;
static const struct sd_functions *const sd_list[] = { static const struct sd_functions *const sd_list[] = {
&sd_lavc, &sd_lavc,
#if HAVE_LIBASS
&sd_ass, &sd_ass,
#endif
NULL NULL
}; };

View File

@ -1,39 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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;
}

15
wscript
View File

@ -336,24 +336,13 @@ iconv support use --disable-iconv.",
'desc' : 'Javascript (MuJS backend)', 'desc' : 'Javascript (MuJS backend)',
'func': check_pkg_config('mujs', '>= 1.0.0'), 'func': check_pkg_config('mujs', '>= 1.0.0'),
}, { }, {
'name': '--libass', 'name': 'libass',
'desc': 'SSA/ASS support', 'desc': 'SSA/ASS support',
'func': check_pkg_config('libass', '>= 0.12.1'), 'func': check_pkg_config('libass', '>= 0.12.1'),
'req': True, 'req': True,
'fmsg': "Unable to find development files for libass, or the version " + 'fmsg': "Unable to find development files for libass, or the version " +
"found is too old. Aborting. If you really mean to compile " + "found is too old. Aborting."
"without libass support use --disable-libass."
}, { }, {
'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', 'name': '--zlib',
'desc': 'zlib', 'desc': 'zlib',
'func': check_libs(['z'], 'func': check_libs(['z'],

View File

@ -386,7 +386,7 @@ def build(ctx):
( "stream/stream_null.c" ), ( "stream/stream_null.c" ),
## Subtitles ## Subtitles
( "sub/ass_mp.c", "libass"), ( "sub/ass_mp.c" ),
( "sub/dec_sub.c" ), ( "sub/dec_sub.c" ),
( "sub/draw_bmp.c" ), ( "sub/draw_bmp.c" ),
( "sub/filter_regex.c", "posix" ), ( "sub/filter_regex.c", "posix" ),
@ -394,9 +394,8 @@ def build(ctx):
( "sub/img_convert.c" ), ( "sub/img_convert.c" ),
( "sub/lavc_conv.c" ), ( "sub/lavc_conv.c" ),
( "sub/osd.c" ), ( "sub/osd.c" ),
( "sub/osd_dummy.c", "dummy-osd" ), ( "sub/osd_libass.c" ),
( "sub/osd_libass.c", "libass-osd" ), ( "sub/sd_ass.c" ),
( "sub/sd_ass.c", "libass" ),
( "sub/sd_lavc.c" ), ( "sub/sd_lavc.c" ),
## Tests ## Tests