This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 84c71fb2e42aedacc208939ddbdf4dd39e071502 Author: Ruk Doe <[email protected]> AuthorDate: Sat Oct 10 12:09:03 2026 +0900 Commit: michaelni <[email protected]> CommitDate: Fri Nov 6 04:39:07 2026 +0000 avcodec/libaribcaption: only clear on CS in text and ass mode The text and ass paths treated every caption without regions as a clear and emitted an empty ("") subtitle. A statement containing only TIME also decodes to zero regions, without the clear-screen flag, so it erased the caption that was being displayed. Test ARIBCC_CAPTIONFLAGS_CLEARSCREEN as the bitmap path already does, and emit nothing for other regionless captions. Add text and ass mode tests on the existing aribcaption_clear.ts sample (visible caption, TIME-only statement, CS-only statement). Each reference has two events; before this change there was a third, empty one for the TIME-only statement. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DdDiDRusmi6eD7qSrKBjHb --- libavcodec/libaribcaption.c | 14 +++++++++++++- tests/fate/subtitles.mak | 8 ++++++++ .../fate/{sub-mpsub-frames => sub-aribcaption-clear-ass} | 14 ++++++-------- .../{sub-aribcaption-clear => sub-aribcaption-clear-text} | 6 +++--- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c index 9bad475f57..b8b5ad8a47 100644 --- a/libavcodec/libaribcaption.c +++ b/libavcodec/libaribcaption.c @@ -618,13 +618,19 @@ static int aribcaption_trans_ass_subtitle(ARIBCaptionContext *ctx) if (ctx->avctx->profile == AV_PROFILE_ARIB_PROFILE_C) single_rect = true; - sub->format = 1; /* text */ if (ctx->caption.region_count == 0) { + /* Only an explicit clear screen (CS) erases the previous caption; + a statement containing only TIME also has no region. */ + if (!(ctx->caption.flags & ARIBCC_CAPTIONFLAGS_CLEARSCREEN)) + return 0; /* clear previous caption for indefinite duration */ + sub->format = 1; /* text */ ff_ass_add_rect(sub, "", ctx->readorder++, 0, NULL, NULL); return 1; } + sub->format = 1; /* text */ + av_bprint_init(&buf, ARIBC_BPRINT_SIZE_INIT, ARIBC_BPRINT_SIZE_MAX); if (single_rect && ctx->avctx->profile != AV_PROFILE_ARIB_PROFILE_C) { @@ -814,6 +820,12 @@ static int aribcaption_trans_text_subtitle(ARIBCaptionContext *ctx) int ret = 0; const char *text; + /* Only an explicit clear screen (CS) erases the previous caption; + a statement containing only TIME also has no region. */ + if (ctx->caption.region_count == 0 && + !(ctx->caption.flags & ARIBCC_CAPTIONFLAGS_CLEARSCREEN)) + return 0; + sub->rects = av_calloc(1, sizeof(*sub->rects)); if (!sub->rects) { ret = AVERROR(ENOMEM); diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak index 200125f718..7dbc8b8316 100644 --- a/tests/fate/subtitles.mak +++ b/tests/fate/subtitles.mak @@ -172,6 +172,14 @@ FATE_SUBTITLES_PROBE-$(call DEMDEC, MPEGTS, LIBARIBCAPTION) += fate-sub-aribcapt fate-sub-aribcaption-clear: CMD = probeframes -sub_type bitmap $(TARGET_SAMPLES)/sub/aribcaption_clear.ts fate-sub-aribcaption-clear: CMP = diff +# same sample in text and ass mode: only CS must emit a clear event, which +# the ass dialogue shows as an empty text +FATE_SUBTITLES_PROBE-$(call DEMDEC, MPEGTS, LIBARIBCAPTION) += fate-sub-aribcaption-clear-text +fate-sub-aribcaption-clear-text: CMD = probeframes -sub_type text $(TARGET_SAMPLES)/sub/aribcaption_clear.ts +FATE_SUBTITLES_ASS-$(call DEMDEC, MPEGTS, LIBARIBCAPTION) += fate-sub-aribcaption-clear-ass +fate-sub-aribcaption-clear-ass: CMD = fmtstdout ass -sub_type ass -font sans-serif -i $(TARGET_SAMPLES)/sub/aribcaption_clear.ts +fate-sub-aribcaption-clear-text fate-sub-aribcaption-clear-ass: CMP = diff + FATE_SUBTITLES-$(call ENCMUX, ASS, ASS) += $(FATE_SUBTITLES_ASS-yes) FATE_SUBTITLES += $(FATE_SUBTITLES-yes) FATE_SUBTITLES := $(if $(CONFIG_PIPE_PROTOCOL), $(FATE_SUBTITLES)) diff --git a/tests/ref/fate/sub-mpsub-frames b/tests/ref/fate/sub-aribcaption-clear-ass similarity index 50% copy from tests/ref/fate/sub-mpsub-frames copy to tests/ref/fate/sub-aribcaption-clear-ass index ab9d5a78b2..eaa595fd0b 100644 --- a/tests/ref/fate/sub-mpsub-frames +++ b/tests/ref/fate/sub-aribcaption-clear-ass @@ -1,16 +1,14 @@ [Script Info] -; Script generated by FFmpeg/Lavc ScriptType: v4.00+ -PlayResX: 384 -PlayResY: 288 -ScaledBorderAndShadow: yes -YCbCr Matrix: None +PlayResX: 960 +PlayResY: 540 +WrapStyle: 2 [V4+ Styles] Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding -Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,1 +Style: Default,sans-serif,36,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,4,0,4,2,10,10,10,0 [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text -Dialogue: 0,0:00:01.00,0:00:02.50,Default,,0,0,0,,Start at 1sec,\Nlast 1.5 seconds -Dialogue: 0,0:00:02.54,0:00:11.54,Default,,0,0,0,,One frame later,\Nduring 9 seconds +Dialogue: 0,0:00:01.00,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(200,300)}{\fsp4}{\3a&Hff&}{\4a&Hff&}〓 +Dialogue: 0,0:00:03.00,9:59:59.99,Default,,0,0,0,, diff --git a/tests/ref/fate/sub-aribcaption-clear b/tests/ref/fate/sub-aribcaption-clear-text similarity index 89% copy from tests/ref/fate/sub-aribcaption-clear copy to tests/ref/fate/sub-aribcaption-clear-text index 8ba75d0220..caa0d942b9 100644 --- a/tests/ref/fate/sub-aribcaption-clear +++ b/tests/ref/fate/sub-aribcaption-clear-text @@ -2,7 +2,7 @@ media_type=subtitle pts=2000000 pts_time=2.000000 -format=0 +format=1 start_display_time=0 end_display_time=4294967295 num_rects=1 @@ -11,8 +11,8 @@ num_rects=1 media_type=subtitle pts=4000000 pts_time=4.000000 -format=0 +format=1 start_display_time=0 end_display_time=4294967295 -num_rects=0 +num_rects=1 [/SUBTITLE] -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
