[vlc-commits] codec: substx3g: improve quicktime text media styling

Francois Cartegnie git at videolan.org
Wed May 22 20:21:30 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed May 22 19:45:07 2019 +0200| [887ad0be5e987efb6d10301335406eda64579b01] | committer: Francois Cartegnie

codec: substx3g: improve quicktime text media styling

refs BCDisassembly1RightSideTxt2.mov

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

 modules/codec/substx3g.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/modules/codec/substx3g.c b/modules/codec/substx3g.c
index 553c48e726..ebb650a0b8 100644
--- a/modules/codec/substx3g.c
+++ b/modules/codec/substx3g.c
@@ -487,20 +487,36 @@ static void ParseExtradataTextMedia( decoder_t *p_dec )
         return;
 
     /* DF @0 */
+    uint32_t i_flags = GetDWBE(p_extra);
+    if(i_flags & 0x1000) /* drop shadow */
+    {
+        p_style->i_style_flags |= STYLE_SHADOW;
+        p_style->i_features    |= STYLE_HAS_SHADOW_COLOR|STYLE_HAS_FLAGS|STYLE_HAS_SHADOW_ALPHA;
+        p_style->i_shadow_color = 0xC0C0C0;
+        p_style->i_shadow_alpha = STYLE_ALPHA_OPAQUE;
+    }
+    if(i_flags & 0x4000) /* key text*/
+    {
+        /*Controls background color. If this flag is set to 1, the text media handler does not display the
+          background color, so that the text overlay background tracks.*/
+        p_style->i_style_flags &= ~STYLE_BACKGROUND;
+    }
+
     /* Just @4 */
 
     /* BGColor @8, read top of 16 bits */
     p_style->i_background_color = (p_extra[8]  << 16) |
                                   (p_extra[10] <<  8) |
                                    p_extra[12];
-    p_style->i_features |= STYLE_HAS_BACKGROUND_COLOR;
+    p_style->i_features |= STYLE_HAS_BACKGROUND_COLOR | STYLE_HAS_BACKGROUND_ALPHA;
+    p_style->i_background_alpha = STYLE_ALPHA_OPAQUE;
 
     /* BoxRecord @14 */
     /* Reserved 64 @22 */
     /* Font # @30 */
 
     /* Font Face @32 */
-    p_style->i_style_flags = ConvertToVLCFlags( GetWBE(&p_extra[32]) );
+    p_style->i_style_flags |= ConvertToVLCFlags( GetWBE(&p_extra[32]) );
     if( p_style->i_style_flags )
         p_style->i_features |= STYLE_HAS_FLAGS;
     /* Reserved 8 @34 */
@@ -536,6 +552,10 @@ static int OpenDecoder( vlc_object_t *p_this )
     if( !p_dec->p_sys )
         return VLC_ENOMEM;
 
+    text_style_t *p_default_style = p_dec->p_sys;
+    p_default_style->i_style_flags |= STYLE_BACKGROUND;
+    p_default_style->i_features |= STYLE_HAS_FLAGS;
+
     if( p_dec->fmt_in.i_codec == VLC_CODEC_TX3G )
         ParseExtradataTx3g( p_dec );
     else



More information about the vlc-commits mailing list