From 633fde4ae541ddfe57f8111fe9b5b1fba89e6fc6 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Fri, 1 Nov 2013 16:02:47 +0100 Subject: sd_lavc, sd_spu: make dvdsub stretching conditional on --stretch-dvd-subs. We found that the stretching - although it usually improves the looks of the fonts - is incorrect. On DVD, subtitles can cover the full area of the picture, and they have the same pixel aspect as the movie itself. Too bad many commercially released DVDs use bitmap fonts made with the wrong pixel aspect (i.e. assuming 1:1) - --stretch-dvd-subs will make these more pretty then. --- sub/spudec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sub/spudec.c') diff --git a/sub/spudec.c b/sub/spudec.c index 56d7ca1eae..5d58b3664c 100644 --- a/sub/spudec.c +++ b/sub/spudec.c @@ -644,6 +644,7 @@ void spudec_set_forced_subs_only(void * const this, const unsigned int flag) } void spudec_get_indexed(void *this, struct mp_osd_res *dim, + double xstretch, double ystretch, struct sub_bitmaps *res) { spudec_handle_t *spu = this; @@ -656,10 +657,10 @@ void spudec_get_indexed(void *this, struct mp_osd_res *dim, if (spudec_visible(spu) && !empty) { double xscale = (double) (dim->w - dim->ml - dim->mr) / spu->orig_frame_width; double yscale = (double) (dim->h - dim->mt - dim->mb) / spu->orig_frame_height; - part->x = part->x * xscale + dim->ml; - part->y = part->y * yscale + dim->mt; - part->dw = part->w * xscale; - part->dh = part->h * yscale; + part->x = part->x * xscale * xstretch + dim->ml + dim->w * (0.5 - 0.5 * xstretch); + part->y = part->y * yscale * ystretch + dim->mt + dim->h * (0.5 - 0.5 * ystretch); + part->dw = part->w * xscale * xstretch; + part->dh = part->h * yscale * ystretch; res->num_parts = 1; res->scaled = true; } -- cgit v1.2.3