summaryrefslogtreecommitdiffstats
path: root/sub/spudec.c
diff options
context:
space:
mode:
authorRudolf Polzer <divVerent@xonotic.org>2013-11-01 16:02:47 +0100
committerRudolf Polzer <divverent@xonotic.org>2013-11-07 12:56:07 +0100
commit633fde4ae541ddfe57f8111fe9b5b1fba89e6fc6 (patch)
treec00e88cd5efb55528a9f34c279101d31cb4b05be /sub/spudec.c
parent49caa0a775be06539a7cd30875f1c80368a7ac55 (diff)
downloadmpv-633fde4ae541ddfe57f8111fe9b5b1fba89e6fc6.tar.bz2
mpv-633fde4ae541ddfe57f8111fe9b5b1fba89e6fc6.tar.xz
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.
Diffstat (limited to 'sub/spudec.c')
-rw-r--r--sub/spudec.c9
1 files changed, 5 insertions, 4 deletions
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;
}