diff options
-rw-r--r-- | DOCS/man/options.rst | 3 | ||||
-rw-r--r-- | sub/sd_lavc.c | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index e24267a4da..9cfc5b0624 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -1990,6 +1990,9 @@ Subtitles :strip: Radically strip all ASS tags and styles from the subtitle. This is equivalent to the old ``--no-ass`` / ``--no-sub-ass`` options. + This also controls some bitmap subtitle overrides, as well as HTML tags in + formats like SRT, despite the name of the option. + ``--sub-ass-force-margins`` Enables placing toptitles and subtitles in black borders when they are available, if the subtitles are in the ASS format. diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index 11f7711b7e..ef46521f0b 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -447,6 +447,23 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res d, int format, w = priv->video_params.w; h = priv->video_params.h; } + + if (opts->sub_pos != 100 && opts->ass_style_override) { + int offset = (100 - opts->sub_pos) / 100.0 * h; + + for (int n = 0; n < res->num_parts; n++) { + struct sub_bitmap *sub = &res->parts[n]; + + // Decide by heuristic whether this is a sub-title or something + // else (top-title, covering whole screen). + if (sub->y < h / 2) + continue; + + // Allow moving up the subtitle, but only until it clips. + sub->y = MPMAX(sub->y - offset, 0); + } + } + osd_rescale_bitmaps(res, w, h, d, video_par); } |