From 537f011c6d07eb56116f44e6bd4f841b392d97f6 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 26 Mar 2020 12:23:32 +0100 Subject: 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. --- video/out/aspect.c | 8 ++++---- 1 file 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) -- cgit v1.2.3