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
This commit is contained in:
Ruk DoeandClaude Opus 5.5 authored and michaelni committed 2026-11-06 04:39:07 +00:00
1 parent 2a759286a2
commit ad5c00b0ce
1 file changed
+9
+9
View File
@@ -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);