[vlc-devel] [PATCH] Subtitle Comments

Aaron Mady defiant_00 at hotmail.com
Sat Feb 3 04:43:34 CET 2007


Not sure what you want attached, but here are the changes and the file.  This patch fixes comments within the video container file (tested with mkv files) by no longer displaying text contained between { }'s.

Aaron

$ svn diff
Index: modules/codec/subsdec.c
===================================================================
--- modules/codec/subsdec.c     (revision 18691)
+++ modules/codec/subsdec.c     (working copy)
@@ -473,6 +473,7 @@

     psz_new_subtitle = malloc( strlen( psz_buffer_sub ) + 1);
     i_text = 0;
+       vlc_bool_t b_within_comment = VLC_FALSE;
     while( psz_buffer_sub[0] != '\0' )
     {
         if( psz_buffer_sub[0] == '\\' && psz_buffer_sub[1] == 'n' )
@@ -498,12 +499,28 @@
             }
             psz_buffer_sub++;
         }
-        else
+               else if ( psz_buffer_sub[0] == '{' )
+               {
+                       b_within_comment = VLC_TRUE;
+                       psz_buffer_sub++;
+                       msg_Dbg( p_dec, "started a comment" );
+               }
+               else if ( psz_buffer_sub[0] == '}' )
+               {
+                       b_within_comment = VLC_FALSE;
+                       psz_buffer_sub++;
+                       msg_Dbg( p_dec, "ended a comment" );
+               }
+        else if ( b_within_comment == VLC_FALSE )
         {
             psz_new_subtitle[i_text] = psz_buffer_sub[0];
             i_text++;
             psz_buffer_sub++;
         }
+               else
+               {
+                       psz_buffer_sub++;
+               }
     }
     psz_new_subtitle[i_text] = '\0';
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20070202/23f86706/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subsdec.c
Type: application/octet-stream
Size: 31925 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20070202/23f86706/attachment.obj>


More information about the vlc-devel mailing list