[vlc-devel] commit: Added support for \N \n and \h in subtitles. (Laurent Aimar )

git version control git at videolan.org
Thu Jan 14 01:41:56 CET 2010


vlc-1.0-bugfix | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Jan 11 21:36:43 2010 +0100| [2346a43d146923486f6bdba8055ffc7c42f30323] | committer: Jean-Baptiste Kempf 

Added support for \N \n and \h in subtitles.
(cherry picked from commit 5fd8aa306ebd4ebaf6a8678d4dd8c6dcd79d31d9)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc-1.0-bugfix.git/?a=commit;h=2346a43d146923486f6bdba8055ffc7c42f30323
---

 modules/codec/subtitles/subsdec.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/modules/codec/subtitles/subsdec.c b/modules/codec/subtitles/subsdec.c
index beb2e4d..6a3612f 100644
--- a/modules/codec/subtitles/subsdec.c
+++ b/modules/codec/subtitles/subsdec.c
@@ -946,6 +946,25 @@ static char *CreateHtmlSubtitle( int *pi_align, char *psz_subtitle )
             /* Hide {Y:stupidity} */
             psz_subtitle = strchr( psz_subtitle, '}' ) + 1;
         }
+        else if( psz_subtitle[0] == '\\' && psz_subtitle[1] )
+        {
+            if( psz_subtitle[1] == 'N' || psz_subtitle[1] == 'n' )
+            {
+                HtmlPut( &psz_html, "<br/>" );
+                psz_subtitle += 2;
+            }
+            else if( psz_subtitle[1] == 'h' )
+            {
+                /* Non breakable space */
+                HtmlPut( &psz_html, NO_BREAKING_SPACE );
+                psz_subtitle += 2;
+            }
+            else
+            {
+                HtmlPut( &psz_html, "\\" );
+                psz_subtitle++;
+            }
+        }
         else
         {
             *psz_html = *psz_subtitle;




More information about the vlc-devel mailing list