]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ccaption_dec.c
libkvazaar: Set frame rate as a rational number
[ffmpeg] / libavcodec / ccaption_dec.c
index 3e335804fa4d4cc782aeb480134d1cf13d17fb87..790f0718fd1a988401e10bb71f42ad14da1a7575 100644 (file)
@@ -294,8 +294,11 @@ static void roll_up(CCaptionSubContext *ctx)
      */
     keep_lines = FFMIN(ctx->cursor_row + 1, ctx->rollup);
 
-    for (i = 0; i < ctx->cursor_row - keep_lines; i++)
+    for (i = 0; i < SCREEN_ROWS; i++) {
+        if (i > ctx->cursor_row - keep_lines && i <= ctx->cursor_row)
+            continue;
         UNSET_FLAG(screen->row_used, i);
+    }
 
     for (i = 0; i < keep_lines && screen->row_used; i++) {
         const int i_row = ctx->cursor_row - keep_lines + i + 1;
@@ -622,13 +625,14 @@ static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avp
 
     if (ctx->real_time && ctx->screen_touched &&
         avpkt->pts > ctx->last_real_time + av_rescale_q(20, ass_tb, avctx->time_base)) {
+        int start_time;
         ctx->last_real_time = avpkt->pts;
         ctx->screen_touched = 0;
 
         capture_screen(ctx);
         ctx->buffer_changed = 0;
 
-        int start_time = av_rescale_q(avpkt->pts, avctx->time_base, ass_tb);
+        start_time = av_rescale_q(avpkt->pts, avctx->time_base, ass_tb);
         ret = ff_ass_add_rect_bprint(sub, &ctx->buffer, start_time, -1);
         if (ret < 0)
             return ret;