[vlc-commits] [Git][videolan/vlc][3.0.x] codec: webvtt: fix line: 0% alignment

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Wed Dec 3 07:38:54 UTC 2025



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
911d9677 by Steve Lhomme at 2025-12-03T08:08:40+01:00
codec: webvtt: fix line: 0% alignment

A line: 0% positioning should set the box on top of the video viewport [^1]
(when alignment is top-left which is the default).

Fixes #29230

[^1]: https://www.w3.org/TR/webvtt1/#webvtt-line-cue-setting

(cherry picked from commit 0f215cb3cc6b3e4f94571c54a5e69c2d17dacb58)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

- - - - -


1 changed file:

- modules/codec/webvtt/subsvtt.c


Changes:

=====================================
modules/codec/webvtt/subsvtt.c
=====================================
@@ -264,7 +264,7 @@ static void webvtt_get_cueboxrect( const webvtt_cue_settings_t *p_settings,
     /* we need 100% or size for inner_align to work on writing direction */
     if( p_settings->vertical == WEBVTT_ALIGN_AUTO ) /* Horizontal text */
     {
-        p_rect->y = line_offset > 0 ? line_offset : 1.0 + line_offset;
+        p_rect->y = line_offset >= 0 ? line_offset : 1.0 + line_offset;
         p_rect->w = (extent) ? extent : 1.0;
         if( indent_anchor_position > 0 &&
             (alignment_on_indent_anchor == WEBVTT_ALIGN_LEFT ||
@@ -277,9 +277,9 @@ static void webvtt_get_cueboxrect( const webvtt_cue_settings_t *p_settings,
     else /* Vertical text */
     {
         if( p_settings->vertical == WEBVTT_ALIGN_LEFT )
-            p_rect->x = line_offset > 0 ? 1.0 - line_offset : -line_offset;
+            p_rect->x = line_offset >= 0 ? 1.0 - line_offset : -line_offset;
         else
-            p_rect->x = line_offset > 0 ? line_offset : 1.0 + line_offset;
+            p_rect->x = line_offset >= 0 ? line_offset : 1.0 + line_offset;
         p_rect->y = (extent) ? extent : 1.0;
 
         if( indent_anchor_position > 0 &&



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/911d96778808be91bc76cd3590ae950906a78e5b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/911d96778808be91bc76cd3590ae950906a78e5b
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list