From 0cd8ba72fe47d11b196adc2ad1f64b1243312d2e Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 28 Jul 2019 03:18:59 +0200 Subject: [PATCH] sd_lavc: support scaling for bitmap subtitles --- sub/sd_lavc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index ef46521f0b..4620c8bd9b 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -465,6 +465,22 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res d, int format, } osd_rescale_bitmaps(res, w, h, d, video_par); + + if (opts->sub_scale != 1.0 && opts->ass_style_override) { + for (int n = 0; n < res->num_parts; n++) { + struct sub_bitmap *sub = &res->parts[n]; + + float shit = (opts->sub_scale - 1.0f) / 2; + + // Fortunately VO isn't supposed to give a FUCKING FUCK about + // whether the sub might e.g. go outside of the screen. + sub->x -= sub->dw * shit; + sub->y -= sub->dh * shit; + sub->dw += sub->dw * shit * 2; + sub->dh += sub->dh * shit * 2; + } + } + } static bool accepts_packet(struct sd *sd, double min_pts)