[FFmpeg-devel] [PATCH 3/5] libavcodec/htmlsubtitles:Add <BR> parsing for sami

Yayoi yayoi.ukai at gmail.com
Fri Aug 28 07:48:54 CEST 2015


---
 libavcodec/htmlsubtitles.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/htmlsubtitles.c b/libavcodec/htmlsubtitles.c
index a138955..c1324d6 100644
--- a/libavcodec/htmlsubtitles.c
+++ b/libavcodec/htmlsubtitles.c
@@ -54,7 +54,7 @@ static void rstrip_spaces_buf(AVBPrint *buf)
 void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in)
 {
     char *param, buffer[128], tmp[128];
-    int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0, count;
+    int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0;
     SrtStack stack[16];
 
     stack[0].tag[0] = 0;
@@ -90,6 +90,13 @@ void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in)
                 av_bprint_chars(dst, *in, 1);
             break;
         case '<':
+            if (!av_strncasecmp(in, "<BR", 3)){
+                av_bprintf(dst, "\\N");
+                len = 3;
+                while (in[len] != '>')
+                    len++;
+                in += len + 1;
+            }
             tag_close = in[1] == '/';
             len = 0;
             if (sscanf(in+tag_close+1, "%127[^>]>%n", buffer, &len) >= 1 && len > 0) {
-- 
1.8.5.2 (Apple Git-48)



More information about the ffmpeg-devel mailing list