PR #25774 opened by Forgejo_Fairy
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25774
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25774.patch

The Spanish/miscellaneous extended characters `12 2A` and `12 2D` currently 
decode to hyphen-minus and middle dot. Map them to U+2014 EM DASH and U+2022 
BULLET, respectively, so the reproducer in #25699 produces `—•` instead of `-·`.

These text mappings match libcaption. libzvbi also identifies the characters as 
em dash and round bullet, although it uses U+2500 for the dash’s box-drawing 
role.

Add a generated SCC FATE test covering replacement of preceding fallback 
characters and preservation of ordinary hyphen-minus and full stop. Expected 
output resides in `tests/ref/fate/sub-scc-extended`; no external sample is 
required.

Validation on ARM64 Linux: the new test fails before the mapping changes and 
passes afterward; `fate-sub-scc` and `fate-sub-scc-remux` also pass. The exact 
issue reproducer produces U+2014 followed by U+2022 with the fix.

Fixes #25699.


From beb0825112030a8de8e11acfa2661b94683a9805 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Thu, 5 Nov 2026 01:54:19 +0000
Subject: [PATCH] avcodec/ccaption_dec: fix extended em dash and bullet
 mappings

Map the Spanish/miscellaneous extended em dash (0x12 0x2a) to
U+2014 and round bullet (0x12 0x2d) to U+2022 instead of a
hyphen-minus and middle dot, respectively.

Add a generated SCC FATE test checking fallback replacement and
that basic hyphen-minus and full stop remain unchanged. The test
needs no external sample.

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/25699
Assisted-by: Fairy
---
 libavcodec/ccaption_dec.c       |  4 ++--
 tests/fate/subtitles.mak        | 12 +++++++++++-
 tests/ref/fate/sub-scc-extended | 15 +++++++++++++++
 3 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 tests/ref/fate/sub-scc-extended

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index fc49a2cb0b6..489625489d7 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -112,10 +112,10 @@ enum cc_charset {
         ENTRY(0x27, "\u00a1")                            \
         ENTRY(0x28, "*")                                 \
         ENTRY(0x29, "'")                                 \
-        ENTRY(0x2a, "-")                                 \
+        ENTRY(0x2a, "\u2014")                            \
         ENTRY(0x2b, "\u00a9")                            \
         ENTRY(0x2c, "\u2120")                            \
-        ENTRY(0x2d, "\u00b7")                            \
+        ENTRY(0x2d, "\u2022")                            \
         ENTRY(0x2e, "\u201c")                            \
         ENTRY(0x2f, "\u201d")                            \
         ENTRY(0x30, "\u00c0")                            \
diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index 200125f718f..a6ee2f112f6 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -131,6 +131,15 @@ FATE_SUBTITLES-$(call DEMDEC, SCC, CCAPTION) += 
fate-sub-scc
 fate-sub-scc: CMD = fmtstdout ass -ss 57 -i $(TARGET_SAMPLES)/sub/witch.scc
 fate-sub-scc: CMP = diff
 
+# Extended characters replace their basic fallbacks; trailing basic 
punctuation stays unchanged.
+tests/data/sub-scc-extended.scc: TAG = GEN
+tests/data/sub-scc-extended.scc: | tests/data
+       $(Q)printf 'Scenarist_SCC V1.0\n\n00:00:00:00\t9420 9420 94ae 94ae 9470 
9470 ad80 922a ae80 92ad adae 942f 942f\n\n00:00:03:00\t942c 942c\n' > $@
+
+FATE_SUB_SCC-$(call ALLYES, FILE_PROTOCOL PIPE_PROTOCOL SCC_DEMUXER 
CCAPTION_DECODER ASS_ENCODER ASS_MUXER) += fate-sub-scc-extended
+fate-sub-scc-extended: tests/data/sub-scc-extended.scc
+fate-sub-scc-extended: CMD = fmtstdout ass -i 
$(TARGET_PATH)/tests/data/sub-scc-extended.scc
+
 FATE_SUBTITLES-$(call DEMMUX, SCC, SCC) += fate-sub-scc-remux
 fate-sub-scc-remux: CMD = fmtstdout scc -i $(TARGET_SAMPLES)/sub/witch.scc -ss 
4:00 -map 0 -c copy
 
@@ -180,5 +189,6 @@ fate-sub-%: CMP = rawdiff
 
 FATE_SAMPLES_FFMPEG += $(FATE_SUBTITLES)
 FATE_SAMPLES_FFPROBE += $(FATE_SUBTITLES_PROBE-yes)
-fate-subtitles: $(FATE_SUBTITLES) $(FATE_SUB_KARAOKE-yes) 
$(FATE_SUBTITLES_PROBE-yes)
+fate-subtitles: $(FATE_SUB_SCC-yes) $(FATE_SUBTITLES) $(FATE_SUB_KARAOKE-yes) 
$(FATE_SUBTITLES_PROBE-yes)
 FATE_FFMPEG-yes += $(FATE_SUB_KARAOKE-yes)
+FATE_FFMPEG-yes += $(FATE_SUB_SCC-yes)
diff --git a/tests/ref/fate/sub-scc-extended b/tests/ref/fate/sub-scc-extended
new file mode 100644
index 00000000000..2cb45e0e451
--- /dev/null
+++ b/tests/ref/fate/sub-scc-extended
@@ -0,0 +1,15 @@
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+ScaledBorderAndShadow: yes
+YCbCr Matrix: None
+
+[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,Monospace,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,3,1,0,2,10,10,10,1
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:00.00,0:00:03.00,Default,,0,0,0,,{\an7}{\pos(38,243)}—•-.
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to