mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 08:12:17 +00:00
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.
This commit is contained in:
parent
d93a9be656
commit
1a1ac76d2a
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user