diff options
author | wm4 <wm4@nowhere> | 2015-10-21 20:49:12 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-10-21 21:33:02 +0200 |
commit | 1a1ac76d2a4273a55f41d1f4e0da01980e811d9a (patch) | |
tree | 2e8a2b900d060ca17ea94001e1fd7dae8d594ebf /sub | |
parent | d93a9be656ed4e3e5b953b0de3e40584e8ec8eba (diff) |
sd_lavc: extend subtitle resolution if images go outside
Helps with broken vobsubs, which have an incorrect resolution header
set.
So we just extend the subtitle resolution to the video size, if the
video size is larger. This helps somewhat with readability, or makes
them visible at all. It should be a pretty safe change, because normally
no sub pictures are supposed to go outside of the area. It should make a
difference with broken files only.
The sample in question had a video resolution of 1888x1072, and a
subtitle resolution of 720x480. Note that always using video resolution
as subtitle resolution would break other files.
Diffstat (limited to 'sub')
-rw-r--r-- | sub/sd_lavc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index 2deac14a45..d038bfbfdf 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -276,6 +276,15 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res d, double pts, d.ml = d.mr = d.mt = d.mb = 0; int insize[2]; get_resolution(sd, insize); + for (int n = 0; n < res->num_parts; n++) { + struct sub_bitmap *p = &res->parts[n]; + if ((p->x + p->w > insize[0] || p->y + p->h > insize[1]) && + priv->video_params.w > insize[0] && priv->video_params.h > insize[1]) + { + insize[0] = priv->video_params.w; + insize[1] = priv->video_params.h; + } + } osd_rescale_bitmaps(res, insize[0], insize[1], d, video_par); } |