diff options
author | wm4 <wm4@nowhere> | 2019-07-28 03:18:59 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-09-19 20:37:05 +0200 |
commit | 0cd8ba72fe47d11b196adc2ad1f64b1243312d2e (patch) | |
tree | dcd62f9c84e31ec68f812a97afc9660ad892c451 /sub | |
parent | 4c5df406a8807f7ec6735b48f701f3e9db8765aa (diff) | |
download | mpv-0cd8ba72fe47d11b196adc2ad1f64b1243312d2e.tar.bz2 mpv-0cd8ba72fe47d11b196adc2ad1f64b1243312d2e.tar.xz |
sd_lavc: support scaling for bitmap subtitles
Diffstat (limited to 'sub')
-rw-r--r-- | sub/sd_lavc.c | 16 |
1 files changed, 16 insertions, 0 deletions
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) |