[vlc-commits] ttml codec: add support for relative fontsize

Stanislas Plessia git at videolan.org
Wed Sep 14 18:39:43 CEST 2016


vlc | branch: master | Stanislas Plessia <stplessia at gmail.com> | Mon Aug 29 16:01:02 2016 +0200| [bb226c7c651e77968949c24c984bd7fa79af80cb] | committer: Hugo Beauzée-Luyssen

ttml codec: add support for relative fontsize

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bb226c7c651e77968949c24c984bd7fa79af80cb
---

 modules/codec/substtml.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/codec/substtml.c b/modules/codec/substtml.c
index ddc846a..daa561a 100644
--- a/modules/codec/substtml.c
+++ b/modules/codec/substtml.c
@@ -182,7 +182,12 @@ static void ParseTTMLStyle( decoder_t *p_dec, xml_reader_t* p_reader )
         }
         else if ( !strcasecmp( "tts:fontSize", attr ) )
         {
-            p_ttml_style->font_style->i_font_size  = atoi( val );
+            char* psz_end = NULL;
+            float size = strtof( val, &psz_end );
+            if( *psz_end == '%' )
+                p_ttml_style->font_style->f_font_relsize = size;
+            else
+                p_ttml_style->font_style->i_font_size = (int)( size + 0.5 );
         }
         else if ( !strcasecmp( "tts:color", attr ) )
         {



More information about the vlc-commits mailing list