diff options
author | Clément Bœsch <u@pkh.me> | 2017-07-29 21:22:17 +0200 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2017-08-01 15:50:00 +0200 |
commit | 479ab8c3f842145fcdd87a574b3fd7b4022034a3 (patch) | |
tree | e874d027fad3bbb7784e539be38a144983bb4341 | |
parent | e80037186327f97fffad75161e7d71cd9f5685f6 (diff) | |
download | ffmpeg-479ab8c3f842145fcdd87a574b3fd7b4022034a3.tar.gz |
lavc/htmlsubtitles: handle colors starting with many '#'
-rw-r--r-- | libavcodec/htmlsubtitles.c | 4 | ||||
-rw-r--r-- | tests/ref/fate/sub-srt-badsyntax | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/htmlsubtitles.c b/libavcodec/htmlsubtitles.c index ae2c48b501..3205d57149 100644 --- a/libavcodec/htmlsubtitles.c +++ b/libavcodec/htmlsubtitles.c @@ -28,6 +28,10 @@ static int html_color_parse(void *log_ctx, const char *str) { uint8_t rgba[4]; + int nb_sharps = 0; + while (str[nb_sharps] == '#') + nb_sharps++; + str += FFMAX(0, nb_sharps - 1); if (av_parse_color(rgba, str, strcspn(str, "\" >"), log_ctx) < 0) return -1; return rgba[0] | rgba[1] << 8 | rgba[2] << 16; diff --git a/tests/ref/fate/sub-srt-badsyntax b/tests/ref/fate/sub-srt-badsyntax index 791e00e691..1561d3f2f2 100644 --- a/tests/ref/fate/sub-srt-badsyntax +++ b/tests/ref/fate/sub-srt-badsyntax @@ -15,7 +15,7 @@ Dialogue: 0,0:01:10.00,0:01:14.50,Default,,0,0,0,,>>> RebelSubTeam <<< Dialogue: 0,0:02:37.75,0:02:43.70,Default,,0,0,0,,{\b1}~ASUKO MARCH!~\N>>:<<\Ntranslation by: cangii\NRetiming by: furransu{\b0}
Dialogue: 0,0:03:38.32,0:03:42.78,Default,,0,0,0,,<<THE HIGH ROLLERS>>\N<<Grandes Jogadores>>
Dialogue: 0,0:04:50.43,0:05:01.03,Default,,0,0,0,,<<flash gordon\Npisode 4\Nsaison 1>\Nwww.SeriesSub.com>
-Dialogue: 0,0:20:31.85,0:20:56.84,Default,,0,0,0,,\N<<<<www.egfire.com>>>>
+Dialogue: 0,0:20:31.85,0:20:56.84,Default,,0,0,0,,{\c&HFFFF&}\N<<<<www.egfire.com>>>>{\c}
Dialogue: 0,0:37:59.69,0:38:01.59,Default,,0,0,0,,mint asztalt foglaltatni\Na <<>Le Cirque-ben.
Dialogue: 0,0:53:43.78,0:53:45.94,Default,,0,0,0,,<<That's OK, >> - he calmed himself.
Dialogue: 0,0:53:46.22,0:53:49.09,Default,,0,0,0,,<<lt's not a long way to the hotel,\Nthe hotel is within easy reach.
|