Added support for \N \n and \h in subtitles.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 11 Jan 2010 20:36:43 +0000 (21:36 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 13 Jan 2010 18:28:37 +0000 (19:28 +0100)
modules/codec/subtitles/subsdec.c

index 9d32434..80b2562 100644 (file)
@@ -955,6 +955,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;