[vlc-commits] subsdec: code cosmetic and comments

Jean-Baptiste Kempf git at videolan.org
Mon Jun 27 15:37:35 CEST 2016


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jun 27 13:55:19 2016 +0200| [cd787a9b77668d7bc243482b686b89dc452b4503] | committer: Jean-Baptiste Kempf

subsdec: code cosmetic and comments

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

 modules/codec/subsdec.c |   54 ++++++++++++++++++++++++-----------------------
 1 file changed, 28 insertions(+), 26 deletions(-)

diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index 29504d2..aa7d3aa 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -739,6 +739,7 @@ static text_segment_t* ParseSubtitles( int *pi_align, const char *psz_subtitle )
     /* */
     while( *psz_subtitle )
     {
+        /* HTML extensions */
         if( *psz_subtitle == '<' )
         {
             char *psz_tagname = GetTag( &psz_subtitle, false );
@@ -912,6 +913,7 @@ static text_segment_t* ParseSubtitles( int *pi_align, const char *psz_subtitle )
                 psz_subtitle++;
             }
         }
+        /* SSA extensions */
         else if( psz_subtitle[0] == '{' && psz_subtitle[1] == '\\' &&
                  strchr( psz_subtitle, '}' ) )
         {
@@ -931,36 +933,36 @@ static text_segment_t* ParseSubtitles( int *pi_align, const char *psz_subtitle )
             /* Hide {\stupidity} */
             psz_subtitle = strchr( psz_subtitle, '}' ) + 1;
         }
+        /* MicroDVD extensions */
         else if( psz_subtitle[0] == '{' &&
-                ( psz_subtitle[1] == 'Y' || psz_subtitle[1] == 'y' )
-                && psz_subtitle[2] == ':' && strchr( psz_subtitle, '}' ) )
+                 psz_subtitle[2] == ':' && strchr( psz_subtitle, '}' ) )
         {
-            // FIXME: We don't do difference between Y and y, and we should.
-            if( psz_subtitle[3] == 'i' )
+            // FIXME: We don't do difference between X and x, and we should:
+            // Capital Letters applies to the whole text and not one line
+            if( psz_subtitle[1] == 'Y' || psz_subtitle[1] == 'y' )
             {
-                p_segment = NewTextSegmentPushStyle( p_segment, &p_stack );
-                p_segment->style->i_style_flags |= STYLE_ITALIC;
-                p_segment->style->i_features |= STYLE_HAS_FLAGS;
-                psz_subtitle++;
-            }
-            if( psz_subtitle[3] == 'b' )
-            {
-                p_segment = NewTextSegmentPushStyle( p_segment, &p_stack );
-                p_segment->style->i_style_flags |= STYLE_BOLD;
-                p_segment->style->i_features |= STYLE_HAS_FLAGS;
-                psz_subtitle++;
-            }
-            if( psz_subtitle[3] == 'u' )
-            {
-                p_segment = NewTextSegmentPushStyle( p_segment, &p_stack );
-                p_segment->style->i_style_flags |= STYLE_UNDERLINE;
-                p_segment->style->i_features |= STYLE_HAS_FLAGS;
-                psz_subtitle++;
+                if( psz_subtitle[3] == 'i' )
+                {
+                    p_segment = NewTextSegmentPushStyle( p_segment, &p_stack );
+                    p_segment->style->i_style_flags |= STYLE_ITALIC;
+                    p_segment->style->i_features |= STYLE_HAS_FLAGS;
+                    psz_subtitle++;
+                }
+                if( psz_subtitle[3] == 'b' )
+                {
+                    p_segment = NewTextSegmentPushStyle( p_segment, &p_stack );
+                    p_segment->style->i_style_flags |= STYLE_BOLD;
+                    p_segment->style->i_features |= STYLE_HAS_FLAGS;
+                    psz_subtitle++;
+                }
+                if( psz_subtitle[3] == 'u' )
+                {
+                    p_segment = NewTextSegmentPushStyle( p_segment, &p_stack );
+                    p_segment->style->i_style_flags |= STYLE_UNDERLINE;
+                    p_segment->style->i_features |= STYLE_HAS_FLAGS;
+                    psz_subtitle++;
+                }
             }
-            psz_subtitle = strchr( psz_subtitle, '}' ) + 1;
-        }
-        else if( psz_subtitle[0] == '{' &&  psz_subtitle[2] == ':' && strchr( psz_subtitle, '}' ) )
-        {
             // Hide other {x:y} atrocities, like {c:$bbggrr} or {P:x}
             psz_subtitle = strchr( psz_subtitle, '}' ) + 1;
         }



More information about the vlc-commits mailing list