summaryrefslogtreecommitdiff
path: root/libavcodec/webvttenc.c
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2016-01-06 13:43:23 +0100
committerClément Bœsch <u@pkh.me>2016-02-26 21:49:34 +0100
commit29412821241050c846dbceaad4b9752857659977 (patch)
treeeb42444a7a6bf5d2dc66cdec8c7aa26be32bed99 /libavcodec/webvttenc.c
parent805685fffd3115d3f9260d8df15ef36b6b3b8006 (diff)
lavc: allow subtitle text format to be ASS without timing
Diffstat (limited to 'libavcodec/webvttenc.c')
-rw-r--r--libavcodec/webvttenc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/libavcodec/webvttenc.c b/libavcodec/webvttenc.c
index 9f67a2eab6..f85b34092a 100644
--- a/libavcodec/webvttenc.c
+++ b/libavcodec/webvttenc.c
@@ -164,16 +164,28 @@ static int webvtt_encode_frame(AVCodecContext *avctx,
av_bprint_clear(&s->buffer);
for (i=0; i<sub->num_rects; i++) {
+ const char *ass = sub->rects[i]->ass;
+
if (sub->rects[i]->type != SUBTITLE_ASS) {
av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n");
return AVERROR(ENOSYS);
}
- dialog = ff_ass_split_dialog(s->ass_ctx, sub->rects[i]->ass, 0, &num);
+ if (!strncmp(ass, "Dialogue: ", 10)) {
+ dialog = ff_ass_split_dialog(s->ass_ctx, ass, 0, &num);
+ // TODO reindent
for (; dialog && num--; dialog++) {
webvtt_style_apply(s, dialog->style);
ff_ass_split_override_codes(&webvtt_callbacks, s, dialog->text);
}
+ } else {
+ dialog = ff_ass_split_dialog2(s->ass_ctx, ass);
+ if (!dialog)
+ return AVERROR(ENOMEM);
+ webvtt_style_apply(s, dialog->style);
+ ff_ass_split_override_codes(&webvtt_callbacks, s, dialog->text);
+ ff_ass_free_dialog(&dialog);
+ }
}
if (!av_bprint_is_complete(&s->buffer))