summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mp_core.h1
-rw-r--r--mplayer.c25
-rw-r--r--sub/ass_mp.c1
-rw-r--r--sub/ass_mp.h1
-rw-r--r--sub/sd_ass.c4
-rw-r--r--sub/sub.h1
6 files changed, 18 insertions, 15 deletions
diff --git a/mp_core.h b/mp_core.h
index 0e41b58de3..f1194d2454 100644
--- a/mp_core.h
+++ b/mp_core.h
@@ -200,6 +200,7 @@ typedef struct MPContext {
struct ass_track *set_of_ass_tracks[MAX_SUBTITLE_FILES];
sub_data* set_of_subtitles[MAX_SUBTITLE_FILES];
bool track_was_native_ass[MAX_SUBTITLE_FILES];
+ struct ass_library *ass_library;
int file_format;
diff --git a/mplayer.c b/mplayer.c
index 432801426c..af6f724188 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -741,8 +741,8 @@ void exit_player_with_rc(struct MPContext *mpctx, enum exit_reason how, int rc)
osd_free(mpctx->osd);
#ifdef CONFIG_ASS
- ass_library_done(ass_library);
- ass_library = NULL;
+ ass_library_done(mpctx->ass_library);
+ mpctx->ass_library = NULL;
#endif
current_module="exit_player";
@@ -1093,15 +1093,15 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr
#ifdef CONFIG_ASS
if (opts->ass_enabled) {
#ifdef CONFIG_ICONV
- asst = mp_ass_read_stream(ass_library, filename, sub_cp);
+ asst = mp_ass_read_stream(mpctx->ass_library, filename, sub_cp);
#else
- asst = mp_ass_read_stream(ass_library, filename, 0);
+ asst = mp_ass_read_stream(mpctx->ass_library, filename, 0);
#endif
is_native_ass = asst;
if (!asst) {
subd = sub_read_file(filename, fps, &mpctx->opts);
if (subd) {
- asst = mp_ass_read_subdata(ass_library, subd, fps);
+ asst = mp_ass_read_subdata(mpctx->ass_library, subd, fps);
sub_free(subd);
subd = NULL;
}
@@ -2680,7 +2680,8 @@ int reinit_video_chain(struct MPContext *mpctx)
#ifdef CONFIG_ASS
if (opts->ass_enabled)
- sh_video->vfilter->control(sh_video->vfilter, VFCTRL_INIT_EOSD, ass_library);
+ sh_video->vfilter->control(sh_video->vfilter, VFCTRL_INIT_EOSD,
+ mpctx->ass_library);
#endif
current_module="init_video_codec";
@@ -4036,7 +4037,8 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
#endif
#ifdef CONFIG_ASS
- ass_library = mp_ass_init();
+ mpctx->ass_library = mp_ass_init();
+ mpctx->osd->ass_library = mpctx->ass_library;
#endif
#ifdef HAVE_RTC
@@ -4508,13 +4510,14 @@ if (mpctx->demuxer && mpctx->demuxer->type==DEMUXER_TYPE_PLAYLIST)
mpctx->initialized_flags|=INITIALIZED_DEMUXER;
#ifdef CONFIG_ASS
-if (opts->ass_enabled && ass_library) {
+if (opts->ass_enabled && mpctx->ass_library) {
for (int j = 0; j < mpctx->num_sources; j++) {
struct demuxer *d = mpctx->sources[j].demuxer;
for (int i = 0; i < d->num_attachments; i++) {
struct demux_attachment *att = d->attachments + i;
if (use_embedded_fonts && attachment_is_font(att))
- ass_add_font(ass_library, att->name, att->data, att->data_size);
+ ass_add_font(mpctx->ass_library, att->name, att->data,
+ att->data_size);
}
}
}
@@ -4890,8 +4893,8 @@ mpctx->vo_sub_last = vo_sub=NULL;
mpctx->subdata=NULL;
#ifdef CONFIG_ASS
mpctx->osd->ass_track = NULL;
-if(ass_library)
- ass_clear_fonts(ass_library);
+if (mpctx->ass_library)
+ ass_clear_fonts(mpctx->ass_library);
#endif
if (!mpctx->stop_play) // In case some goto jumped here...
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index e1b0b07853..d39781ef9d 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -41,7 +41,6 @@
#endif
// libass-related command line options
-ASS_Library *ass_library;
float ass_font_scale = 1.;
float ass_line_spacing = 0.;
int ass_top_margin = 0;
diff --git a/sub/ass_mp.h b/sub/ass_mp.h
index 965b063403..33ee90c18f 100644
--- a/sub/ass_mp.h
+++ b/sub/ass_mp.h
@@ -31,7 +31,6 @@
#include <ass/ass.h>
#include <ass/ass_types.h>
-extern ASS_Library *ass_library;
extern float ass_font_scale;
extern float ass_line_spacing;
extern int ass_top_margin;
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index ba5710611e..d7556ca203 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -52,12 +52,12 @@ static void init(struct sh_sub *sh, struct osd_state *osd)
ctx = talloc_zero(NULL, struct sd_ass_priv);
sh->context = ctx;
if (sh->type == 'a') {
- ctx->ass_track = ass_new_track(ass_library);
+ ctx->ass_track = ass_new_track(osd->ass_library);
if (sh->extradata)
ass_process_codec_private(ctx->ass_track, sh->extradata,
sh->extradata_len);
} else
- ctx->ass_track = mp_ass_default_track(ass_library);
+ ctx->ass_track = mp_ass_default_track(osd->ass_library);
}
assert(osd->ass_track == NULL);
diff --git a/sub/sub.h b/sub/sub.h
index 8309613ea6..90a742f8e7 100644
--- a/sub/sub.h
+++ b/sub/sub.h
@@ -69,6 +69,7 @@ typedef struct mp_osd_obj_s {
} mp_osd_obj_t;
struct osd_state {
+ struct ass_library *ass_library;
unsigned char osd_text[128];
struct font_desc *sub_font;
struct ass_track *ass_track;