[vlc-devel] Re: [PATCH] Subtitle Comments

rataime rataime at gmail.com
Sun Feb 4 20:03:26 CET 2007


Given that we both wanted to post a patch (but didn't know the mailing list
was moderated for registered users), I think the best thing to do is to have
a single thread, so please discard the other messages that had/could
appear(ed).

Here's my take on it :


--- subsdec.c    2007-02-03 15:32:39.000000000 +0100
+++ subsdec-modif.c    2007-02-03 15:39:19.000000000 +0100
@@ -487,16 +487,19 @@
             i_text++;
             psz_buffer_sub += 2;
         }
-        else if( psz_buffer_sub[0] == '{' &&
-                 psz_buffer_sub[1] == '\\' )
+        else if( psz_buffer_sub[1] == '{' &&
+                 psz_buffer_sub[0] != '\\' )
         {
-            /* SSA control code */
-            while( psz_buffer_sub[0] != '\0' &&
-                   psz_buffer_sub[0] != '}' )
+            /* We don't need to show SSA comments, so we strip them */
+            psz_new_subtitle[i_text] = psz_buffer_sub[0];
+            psz_buffer_sub++;
+            while( psz_buffer_sub[1] != '\0' &&
+                   (psz_buffer_sub[1] != '}' ||
+                    psz_buffer_sub[0] == '\\' ))
             {
                 psz_buffer_sub++;
             }
-            psz_buffer_sub++;
+            psz_buffer_sub+=2;
         }
         else
         {


There's a few avantages with this method :
- No new variables/flags
- No checking for special characters (ex \n) inside the comments, so we can
avoid voluntary breaking of VLC
- The character { or } can be used if precede by a backslash (eg " \{this is
not a comment\}")

Please review it, as this is the first time i've hacked VLC

Gwenolé LE PACHE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20070204/c7e34a4c/attachment.html>


More information about the vlc-devel mailing list