Commit ad5c00b0ce for ffmpeg

commit ad5c00b0ce43c6c5bc4c2677699fb2876bf58379
Author: Ruk Doe <info@doany.io>
Date:   Sat Oct 10 15:05:16 2026 +0900

    avcodec/libaribcaption: keep the clear when ass mode skips every region as ruby

    With ignore_ruby=1 and ass_single_rect=0, a caption whose regions are all
    ruby skips every region and returned no event, even when it carries a
    clear screen (CS). The previous caption then stayed on screen. The bitmap
    path and ass_single_rect=1 already erase it in that case.

    Emit the empty clear event in that case too.

    Such captions do occur in broadcasts: among 2293 captions from 40 recent
    Japanese TV recordings, 3 carried CS with only ruby regions. With this
    change, ignore_ruby=1 output gains exactly those 3 clear events, and
    output with the default options is unchanged for all 40 recordings.

    Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01DdDiDRusmi6eD7qSrKBjHb

diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c
index b9a7c2ff80..3e930d68a0 100644
--- a/libavcodec/libaribcaption.c
+++ b/libavcodec/libaribcaption.c
@@ -781,6 +781,15 @@ static int aribcaption_trans_ass_subtitle(ARIBCaptionContext *ctx)
             rect_idx++;
         }
     }
+    if (!single_rect && !rect_idx) {
+        /* Every region was skipped as ruby. A clear screen (CS) must still
+           erase the previous caption. */
+        av_bprint_finalize(&buf, NULL);
+        if (!(ctx->caption.flags & ARIBCC_CAPTIONFLAGS_CLEARSCREEN))
+            return 0;
+        ret = ff_ass_add_rect(sub, "", ctx->readorder++, 0, NULL, NULL);
+        return ret < 0 ? ret : 1;
+    }
     if (single_rect) {
         if (!av_bprint_is_complete(&buf)) {
             ret = AVERROR(ENOMEM);