summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-26 12:23:32 +0100
committerwm4 <wm4@nowhere>2020-03-26 12:23:32 +0100
commit537f011c6d07eb56116f44e6bd4f841b392d97f6 (patch)
tree8186cf0da6bd25ddcfb3fb4ede98f5b78aded5aa /video/out
parent30f6f279768c97f8ba22c6670ae08896892e2279 (diff)
downloadmpv-537f011c6d07eb56116f44e6bd4f841b392d97f6.tar.bz2
mpv-537f011c6d07eb56116f44e6bd4f841b392d97f6.tar.xz
video: report negative subtitle/OSD margins if necessary
Until now, it used only coordinates clipped to the screen for this, which meant no negative margins were ever reported to libass. This broke proper rendering of explicitly positioned ASS events (libass simply could not know the real video size in this case.) Fix this by reporting margins even if they're negative. This makes it apparently work correctly with vo_gpu at least. Note that I'm not really sure if anything in the rendering chain required non-negative margins. If so, and that code implicitly assumed it, I suppose crashes and such are possible.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/aspect.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/video/out/aspect.c b/video/out/aspect.c
index dc13d4e447..7307ed6b34 100644
--- a/video/out/aspect.c
+++ b/video/out/aspect.c
@@ -90,6 +90,10 @@ static void src_dst_split_scaling(int src_size, int dst_size,
*dst_start = (dst_size - scaled_src_size) * align + pan * scaled_src_size;
*dst_end = *dst_start + scaled_src_size;
+ // Distance of screen frame to video
+ *osd_margin_a = *dst_start;
+ *osd_margin_b = dst_size - *dst_end;
+
// Clip to screen
int s_src = *src_end - *src_start;
int s_dst = *dst_end - *dst_start;
@@ -107,10 +111,6 @@ static void src_dst_split_scaling(int src_size, int dst_size,
// For sanity: avoid bothering VOs with corner cases
clamp_size(src_size, src_start, src_end);
clamp_size(dst_size, dst_start, dst_end);
-
- // Distance of screen frame to video
- *osd_margin_a = *dst_start;
- *osd_margin_b = dst_size - *dst_end;
}
static void calc_margin(float opts[2], int out[2], int size)