From fd28be400cbee01ea37aec07ea23480aae90e06b Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 3 Dec 2019 22:33:45 +0100 Subject: [PATCH] sd_lavc: add a hack ontop of another hack to fix completely fucked file Do what we do best in multimedia: add conflicting hacks on top of other hacks, that fix a single sample, and may break other ones. In this case, it only happens if the file is most likely already broken (subtitle bounding boxes go outside of the subtitle "canvas"), so it's OK. The file still looks broken (and, in fact, the file is completely fucking broken), but you can see the subtitles. But in summary, this is not actually something I should have bothered about. I noticed that MPlayer shows the subtitles "correctly", but this is only because they have a hack that extends subtitles with small resolution to a larger hardcoded resolution. This hack was removed from mpv, because it broke some completely legitimate files. As another really funny fact, MPlayer's default video output (vdpau) appears to display this file correctly, but only because it handles narrow aspect ratios (that extend the height instead of the width) incorrectly. It extends the height, but leaves the video with 1:1 aspect ratio at the top. It seems to repeat the last video line. (-vo xv and -vo gl show it correctly, i.e. stretched like mpv, by the way.) For some reason, the sample file at hand is extended with black, so the subtitles are rendered into a black area below the video, which is almost reasonable. So, MPlayer may display this file "correctly", but in fact it only happens to do so because of 1 hack that breaks legitimate files, and 1 bug. What the fuck. Fixes: #7218 (sort of) --- sub/sd_lavc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index d2e21fbd2b..3febe023d6 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -451,8 +451,8 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res d, int format, h = priv->video_params.h; } if (current->src_w > w || current->src_h > h) { - w = priv->video_params.w; - h = priv->video_params.h; + w = MPMAX(priv->video_params.w, current->src_w); + h = MPMAX(priv->video_params.h, current->src_h); } if (opts->sub_pos != 100 && opts->ass_style_override) {