diff options
author | wm4 <wm4@nowhere> | 2015-11-17 01:54:02 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-11-17 01:56:23 +0100 |
commit | 5a89150a4652d987f24d7d386d5cdc6d9109e66d (patch) | |
tree | fc6085143661672f537a604b6645f79e0dced3ad /sub/osd_libass.c | |
parent | 85450d06a1b1a08fce277f7f14d5ee33b12f8eab (diff) | |
download | mpv-5a89150a4652d987f24d7d386d5cdc6d9109e66d.tar.bz2 mpv-5a89150a4652d987f24d7d386d5cdc6d9109e66d.tar.xz |
player: remove OSD subtitle render path
This was used with --no-sub-ass (aka --no-ass). This option (which is
not yet removed) strips all styling from the subtitles, and renders them
as plaintext only. For some reason, it originally seemed convenient to
reuse all the OSD text rendering code (osd_libass.c). While this was
indeed simple, it had a bad influence on the rest of the code. For
example, it had to decide whether to go through the OSD code path, or
the proper subtitle renderer in sd_ass.c.
Kill the OSD subtitle renderer. Reimplement --no-sub-ass and also
"secondary" subtitles in sd_ass.c. fill_plaintext() contains some rather
minor code duplication with osd_libass.c for setting up a dummy
ASS_Event and escaping the stripped text. Since sd_ass.c already has to
handle "normal" text subtitles, and has code for stripping ASS tags,
this remains all relatively simple.
Remove all the unnecessary crap from the rest of the code.
Diffstat (limited to 'sub/osd_libass.c')
-rw-r--r-- | sub/osd_libass.c | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/sub/osd_libass.c b/sub/osd_libass.c index e9225a891a..e8c64250c2 100644 --- a/sub/osd_libass.c +++ b/sub/osd_libass.c @@ -423,42 +423,12 @@ static void update_external(struct osd_state *osd, struct osd_object *obj) } } -static void update_sub(struct osd_state *osd, struct osd_object *obj) -{ - struct MPOpts *opts = osd->opts; - - clear_obj(obj); - - if (!obj->text || !obj->text[0] || obj->sub_state.render_bitmap_subs) - return; - - create_ass_renderer(osd, obj); - if (!obj->osd_track) - obj->osd_track = mp_ass_default_track(obj->osd_ass_library, osd->opts); - - struct osd_style_opts font = *opts->sub_text_style; - font.font_size *= opts->sub_scale; - - ASS_Style *style = obj->osd_track->styles + obj->osd_track->default_style; - mp_ass_set_style(style, obj->osd_track->PlayResY, &font); - if (obj->type == OSDTYPE_SUB2) - style->Alignment = 6; - - ass_set_line_position(obj->osd_render, 100 - opts->sub_pos); - - add_osd_ass_event_escaped(obj->osd_track, obj->text); -} - static void update_object(struct osd_state *osd, struct osd_object *obj) { switch (obj->type) { case OSDTYPE_OSD: update_osd(osd, obj); break; - case OSDTYPE_SUB: - case OSDTYPE_SUB2: - update_sub(osd, obj); - break; case OSDTYPE_PROGBAR: update_progbar(osd, obj); break; |