[vlc-devel] [PATCH] Fix CC rendering area to be 80% of the window height, per FCC regulations

Devin Heitmueller dheitmueller at kernellabs.com
Mon Sep 21 16:37:44 CEST 2015


The FCC defines a "safe area" for caption rendering to be 80% of the
window height.  This patch changes it from 75% to 80%, and fixes a
bug in the original math due to integer arithmetic (the result of
(100/16 got truncated):

Original math:
100 / 16 * 8 / 10 = 4.8

Fixed math:
100 * 8 / 10 / 16 = 5
---
 modules/codec/cc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index 9e75688..e3cb87b 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -431,7 +431,8 @@ static subpicture_t *Subtitle( decoder_t *p_dec, text_segment_t *p_segments, mti
     if( p_dec->p_sys->b_opaque )
         p_spu_sys->p_default_style->i_style_flags |= STYLE_BACKGROUND;
     p_spu_sys->p_default_style->i_font_color = rgi_eia608_colors[EIA608_COLOR_DEFAULT];
-    p_spu_sys->p_default_style->f_font_relsize = 100 / EIA608_SCREEN_ROWS * 3/4;
+    /* FCC defined "safe area" for EIA-608 captions is 80% of the height of the display */
+    p_spu_sys->p_default_style->f_font_relsize = 100 * 8 / 10 / EIA608_SCREEN_ROWS;
     p_spu_sys->p_default_style->i_features |= (STYLE_HAS_FONT_COLOR | STYLE_HAS_FLAGS);
 
     return p_spu;
-- 
1.9.1



More information about the vlc-devel mailing list