X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmpl2dec.c;h=409e4b3708a19f9dd59b4f9a2a2aa16f365442a4;hb=305344d89e21ed11c74274167cf597f151778c42;hp=ca95dc8ae8d2706108e9c8bf44782e81673c3ee2;hpb=c86ecdf3f7b0c78ebfea23989b1a5d34885e119f;p=ffmpeg diff --git a/libavcodec/mpl2dec.c b/libavcodec/mpl2dec.c index ca95dc8ae8d..409e4b3708a 100644 --- a/libavcodec/mpl2dec.c +++ b/libavcodec/mpl2dec.c @@ -69,13 +69,11 @@ static int mpl2_decode_frame(AVCodecContext *avctx, void *data, AVBPrint buf; AVSubtitle *sub = data; const char *ptr = avpkt->data; - const int ts_start = av_rescale_q(avpkt->pts, avctx->time_base, (AVRational){1,100}); - const int ts_duration = avpkt->duration != -1 ? - av_rescale_q(avpkt->duration, avctx->time_base, (AVRational){1,100}) : -1; + FFASSDecoderContext *s = avctx->priv_data; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); if (ptr && avpkt->size > 0 && *ptr && !mpl2_event_to_ass(&buf, ptr)) - ret = ff_ass_add_rect_bprint(sub, &buf, ts_start, ts_duration); + ret = ff_ass_add_rect(sub, buf.str, s->readorder++, 0, NULL, NULL); av_bprint_finalize(&buf, NULL); if (ret < 0) return ret; @@ -90,4 +88,6 @@ AVCodec ff_mpl2_decoder = { .id = AV_CODEC_ID_MPL2, .decode = mpl2_decode_frame, .init = ff_ass_subtitle_header_default, + .flush = ff_ass_decoder_flush, + .priv_data_size = sizeof(FFASSDecoderContext), };