summaryrefslogtreecommitdiff
path: root/libavcodec/ccaption_dec.c
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2016-01-12 17:27:06 -0800
committerClément Bœsch <u@pkh.me>2016-01-14 23:13:15 +0100
commit3a0e5cfcee5bcbf60e3830da0d03041de3f1e5f5 (patch)
tree3045f4ee7d204fed03512eab772057996a8b2812 /libavcodec/ccaption_dec.c
parent9027806e3cf6b8d2693f74c57abfd88c8c2a9008 (diff)
downloadffmpeg-3a0e5cfcee5bcbf60e3830da0d03041de3f1e5f5.tar.gz
lavc/ccaption_dec: clear all unused rows during rollup
Sometimes rollup captions can move around the screen. This fixes "ghost" captions from below the current rollup area from continuing to be captured when a rollup moves higher up on the screen.
Diffstat (limited to 'libavcodec/ccaption_dec.c')
-rw-r--r--libavcodec/ccaption_dec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 3e335804fa..330ea6ac59 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -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;