summaryrefslogtreecommitdiffstats
path: root/libavcodec/webvttdec.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/webvttdec.c
parent805685fffd3115d3f9260d8df15ef36b6b3b8006 (diff)
downloadffmpeg-streaming-29412821241050c846dbceaad4b9752857659977.zip
ffmpeg-streaming-29412821241050c846dbceaad4b9752857659977.tar.gz
lavc: allow subtitle text format to be ASS without timing
Diffstat (limited to 'libavcodec/webvttdec.c')
-rw-r--r--libavcodec/webvttdec.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/libavcodec/webvttdec.c b/libavcodec/webvttdec.c
index 7354588..7b2d175 100644
--- a/libavcodec/webvttdec.c
+++ b/libavcodec/webvttdec.c
@@ -85,15 +85,12 @@ static int webvtt_decode_frame(AVCodecContext *avctx,
int ret = 0;
AVSubtitle *sub = data;
const char *ptr = avpkt->data;
+ FFASSDecoderContext *s = avctx->priv_data;
AVBPrint buf;
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
- if (ptr && avpkt->size > 0 && !webvtt_event_to_ass(&buf, ptr)) {
- int ts_start = av_rescale_q(avpkt->pts, avctx->time_base, (AVRational){1,100});
- int ts_duration = avpkt->duration != -1 ?
- av_rescale_q(avpkt->duration, avctx->time_base, (AVRational){1,100}) : -1;
- ret = ff_ass_add_rect_bprint(sub, &buf, ts_start, ts_duration);
- }
+ if (ptr && avpkt->size > 0 && !webvtt_event_to_ass(&buf, ptr))
+ ret = ff_ass_add_rect(sub, buf.str, s->readorder++, 0, NULL, NULL);
av_bprint_finalize(&buf, NULL);
if (ret < 0)
return ret;
@@ -108,4 +105,6 @@ AVCodec ff_webvtt_decoder = {
.id = AV_CODEC_ID_WEBVTT,
.decode = webvtt_decode_frame,
.init = ff_ass_subtitle_header_default,
+ .flush = ff_ass_decoder_flush,
+ .priv_data_size = sizeof(FFASSDecoderContext),
};
OpenPOWER on IntegriCloud