]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/microdvddec.c
vc2enc: add non-experimental support for all video formats from spec
[ffmpeg] / libavcodec / microdvddec.c
index 46d6d1473b424a336345e4b0c5482954c49fdca7..e8d271931f46000b02a8d04711b4ac3531dc0939 100644 (file)
@@ -280,6 +280,7 @@ static int microdvd_decode_frame(AVCodecContext *avctx,
     AVBPrint new_line;
     char *line = avpkt->data;
     char *end = avpkt->data + avpkt->size;
+    FFASSDecoderContext *s = avctx->priv_data;
     struct microdvd_tag tags[sizeof(MICRODVD_TAGS) - 1] = {{0}};
 
     if (avpkt->size <= 0)
@@ -308,14 +309,7 @@ static int microdvd_decode_frame(AVCodecContext *avctx,
         }
     }
     if (new_line.len) {
-        int ret;
-            int64_t start    = avpkt->pts;
-            int64_t duration = avpkt->duration;
-            int ts_start     = av_rescale_q(start,    avctx->time_base, (AVRational){1,100});
-            int ts_duration  = duration != -1 ?
-                av_rescale_q(duration, avctx->time_base, (AVRational){1,100}) : -1;
-
-        ret = ff_ass_add_rect_bprint(sub, &new_line, ts_start, ts_duration);
+        int ret = ff_ass_add_rect(sub, new_line.str, s->readorder++, 0, NULL, NULL);
         av_bprint_finalize(&new_line, NULL);
         if (ret < 0)
             return ret;
@@ -381,4 +375,6 @@ AVCodec ff_microdvd_decoder = {
     .id           = AV_CODEC_ID_MICRODVD,
     .init         = microdvd_init,
     .decode       = microdvd_decode_frame,
+    .flush        = ff_ass_decoder_flush,
+    .priv_data_size = sizeof(FFASSDecoderContext),
 };