]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/samidec.c
avcodec/fft: Add revtab32 for FFTs with more than 65536 samples
[ffmpeg] / libavcodec / samidec.c
index 95f35abd42ffb63551bd4864339d68398f956bc5..16f3f58c1cfeb7fba0bdf91d4ba0ba263901a543 100644 (file)
@@ -35,6 +35,7 @@ typedef struct {
     AVBPrint encoded_source;
     AVBPrint encoded_content;
     AVBPrint full;
+    int readorder;
 } SAMIContext;
 
 static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src)
@@ -131,10 +132,8 @@ static int sami_decode_frame(AVCodecContext *avctx,
     SAMIContext *sami = avctx->priv_data;
 
     if (ptr && avpkt->size > 0 && !sami_paragraph_to_ass(avctx, 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;
-        int ret = ff_ass_add_rect_bprint(sub, &sami->full, ts_start, ts_duration);
+        // TODO: pass escaped sami->encoded_source.str as source
+        int ret = ff_ass_add_rect(sub, sami->full.str, sami->readorder++, 0, NULL, NULL);
         if (ret < 0)
             return ret;
     }
@@ -164,6 +163,13 @@ static av_cold int sami_close(AVCodecContext *avctx)
     return 0;
 }
 
+static void sami_flush(AVCodecContext *avctx)
+{
+    SAMIContext *sami = avctx->priv_data;
+    if (!(avctx->flags2 & AV_CODEC_FLAG2_RO_FLUSH_NOOP))
+        sami->readorder = 0;
+}
+
 AVCodec ff_sami_decoder = {
     .name           = "sami",
     .long_name      = NULL_IF_CONFIG_SMALL("SAMI subtitle"),
@@ -173,4 +179,5 @@ AVCodec ff_sami_decoder = {
     .init           = sami_init,
     .close          = sami_close,
     .decode         = sami_decode_frame,
+    .flush          = sami_flush,
 };