From 17efc4766baf19840cf1af144adf602bcfea67f3 Mon Sep 17 00:00:00 2001 From: Ruk Doe Date: Sat, 10 Oct 2026 16:32:59 +0900 Subject: [PATCH] avcodec/libaribcaption: share the bitmap no-image path ARIBCC_RENDER_STATUS_NO_IMAGE leaves the render result empty, so it reaches the same "no image" check as a GOT_IMAGE result without images. Let it fall through instead of keeping a second copy of the clear handling, and log the image count before the result is cleaned up, which reset it to 0. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01DdDiDRusmi6eD7qSrKBjHb --- libavcodec/libaribcaption.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c index a5121b6eb7..6b6345e2ef 100644 --- a/libavcodec/libaribcaption.c +++ b/libavcodec/libaribcaption.c @@ -346,19 +346,8 @@ static int aribcaption_trans_bitmap_subtitle(ARIBCaptionContext *ctx) return 0; case ARIBCC_RENDER_STATUS_NO_IMAGE: - ff_dlog(ctx, "no image\n"); - /* A caption carrying an explicit clear screen (CS) produces no - image. Report an empty subtitle so that the previously displayed - bitmap is erased; the TEXT path already does this by emitting "". - Do not treat every regionless caption as a clear: a statement - containing only TIME also decodes to zero regions but must not - erase the display. */ - if (ctx->caption.flags & ARIBCC_CAPTIONFLAGS_CLEARSCREEN) { - sub->format = 0; /* graphic */ - sub->num_rects = 0; - return 1; - } - return 0; + /* the result holds no image, handled below */ + break; case ARIBCC_RENDER_STATUS_ERROR: av_log(ctx, AV_LOG_ERROR, @@ -373,8 +362,14 @@ static int aribcaption_trans_bitmap_subtitle(ARIBCaptionContext *ctx) } if (!ctx->render_result.image_count || ctx->render_result.images == NULL) { - aribcc_render_result_cleanup(&ctx->render_result); ff_dlog(ctx, "no image (%d)\n", ctx->render_result.image_count); + aribcc_render_result_cleanup(&ctx->render_result); + /* A caption carrying an explicit clear screen (CS) may produce no + image. Report an empty subtitle so that the previously displayed + bitmap is erased; the TEXT path already does this by emitting "". + Do not treat every caption without image as a clear: a statement + containing only TIME also decodes to zero regions but must not + erase the display. */ if (ctx->caption.flags & ARIBCC_CAPTIONFLAGS_CLEARSCREEN) { sub->format = 0; /* graphic */ sub->num_rects = 0;