X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fwebvttdec.c;h=fb1a4221242fb19c5d4eb3fc2617f12530e15e54;hb=bf39beca8784077a3918de0933eaaa84a94e42a4;hp=1284a172c43af636ea2504eec27cd0c838cfdc8f;hpb=f85e460078d8c4347f0d11029c9c95fe073ea202;p=ffmpeg
diff --git a/libavcodec/webvttdec.c b/libavcodec/webvttdec.c
index 1284a172c43..fb1a4221242 100644
--- a/libavcodec/webvttdec.c
+++ b/libavcodec/webvttdec.c
@@ -37,11 +37,14 @@ static const struct {
{"", "{\\b1}"}, {"", "{\\b0}"},
{"", "{\\u1}"}, {"", "{\\u0}"},
{"{", "\\{"}, {"}", "\\}"}, // escape to avoid ASS markup conflicts
+ {">", ">"}, {"<", "<"},
+ {"", ""}, {"", ""}, // FIXME: properly honor bidi marks
+ {"&", "&"}, {" ", "\\h"},
};
static int webvtt_event_to_ass(AVBPrint *buf, const char *p)
{
- int i, skip = 0;
+ int i, again, skip = 0;
while (*p) {
@@ -51,12 +54,18 @@ static int webvtt_event_to_ass(AVBPrint *buf, const char *p)
if (!strncmp(p, from, len)) {
av_bprintf(buf, "%s", webvtt_tag_replace[i].to);
p += len;
+ again = 1;
break;
}
}
if (!*p)
break;
+ if (again) {
+ again = 0;
+ skip = 0;
+ continue;
+ }
if (*p == '<')
skip = 1;
else if (*p == '>')