[vlc-devel] [PATCH] Comments in ssa subtitles shoudn't be displayed

rataime rataime at gmail.com
Sat Feb 3 16:04:26 CET 2007


Hello,

Following a stupid move by a fansub group, namely using subtitle comments in
order to break VLC, to prevent people from using what they call a 'broken
player', I tried to make those works :

--- 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
         {

It seems that the previous coder got confused between \{ and {\, thus not
striping the comments from the subtitle.
Please check this code, as I am far from being a C pro, and as this was my
first time looking into VLC source.
Still, it seems to be working : I tested it on the previously non-working
movie, and on various snippets.

However, I still have a question : I believe SSA subtitles are the same,
whether they come inside an mvk or as an independant file. But there's 2
functions with exactly the same role, one in subsdec.c, the other in
subtitle.c, and they doesn't share the same code, which means the bug will
remain when the SSA is loaded from a file. It's quite confusing, even for
admins (the file j-b pointed me to was for external subs, it took me some
time to notice it ).

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


More information about the vlc-devel mailing list