@@ -123,6 +123,11 @@ static void webvtt_new_line_cb(void *priv, int forced)
webvtt_print(priv, "\n");
}
+static void webvtt_hard_space_cb(void *priv)
+{
+ webvtt_print(priv, " ");
+}
+
static void webvtt_style_cb(void *priv, char style, int close)
{
if (style == 's') // strikethrough unsupported
@@ -147,6 +152,7 @@ static void webvtt_end_cb(void *priv)
static const ASSCodesCallbacks webvtt_callbacks = {
.text = webvtt_text_cb,
.new_line = webvtt_new_line_cb,
+ .hard_space = webvtt_hard_space_cb,
.style = webvtt_style_cb,
.color = NULL,
.font_name = NULL,
@@ -132,26 +132,26 @@ but show this: {normal text}
\ N is a forced line break
\ h is a hard space
Normal spaces at the start and at the end of the line are trimmed while hard spaces are not trimmed.
-The line will never break automatically right before or after a hard space. :-D
+The line will never break automatically right before or after a hard space. :-D
00:54.501 --> 00:56.500
- A (05 hard spaces followed by a letter)
+ A (05 hard spaces followed by a letter)
A (Normal spaces followed by a letter)
A (No hard spaces followed by a letter)
00:56.501 --> 00:58.500
- A (05 hard spaces followed by a letter)
+ A (05 hard spaces followed by a letter)
A (Normal spaces followed by a letter)
A (No hard spaces followed by a letter)
Show this: \TEST and this: \-)
00:58.501 --> 01:00.500
-A letter followed by 05 hard spaces: A
+A letter followed by 05 hard spaces: A
A letter followed by normal spaces: A
A letter followed by no hard spaces: A
-05 hard spaces between letters: A A
+05 hard spaces between letters: A A
5 normal spaces between letters: A A
^--Forced line break
Signed-off-by: softworkz <softworkz@hotmail.com> --- libavcodec/webvttenc.c | 6 ++++++ tests/ref/fate/sub-webvttenc | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-)