[FFmpeg-devel] [PATCH] libavcodec/htmlsubtitles: skip newline characters at the beginning of the subtitle

Evgeny Shulgin izaronplatz at gmail.com
Fri Jun 16 21:23:46 EEST 2017


We can have a certain number of newline characters at the very beginning
of the subtitles. We must skip them to get the correct result.
---
 libavcodec/htmlsubtitles.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/htmlsubtitles.c b/libavcodec/htmlsubtitles.c
index 16295da..b144aaa 100644
--- a/libavcodec/htmlsubtitles.c
+++ b/libavcodec/htmlsubtitles.c
@@ -62,6 +62,9 @@ int ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
     strcpy(stack[0].param[PARAM_COLOR], "{\\c}");
     strcpy(stack[0].param[PARAM_FACE],  "{\\fn}");
 
+    while (*in && (*in == '\r' || *in == '\n'))
+        in++;
+
     for (; !end && *in; in++) {
         switch (*in) {
         case '\r':
-- 
2.7.4



More information about the ffmpeg-devel mailing list