Skip to content

Commit 9f250b1

Browse files
authored
fix(cea708): use dynamic current_fps instead of hardcoded 29.97 in SCC frame delays (#2173)
Replace all 6 hardcoded 1000/29.97 frame delay calculations in dtvcc_write_scc() with 1000/current_fps so that CEA-708 SCC output uses the actual stream framerate instead of assuming NTSC 29.97. Fixes #2172
1 parent 0b1a967 commit 9f250b1

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

docs/CHANGES.TXT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Fix: Remove strdup() memory leaks in WebVTT styling encoder, fix invalid CSS rgba(0,256,0) green value, fix missing free(unescaped) on write-error path (#2154)
55
- Fix: Prevent crash in Rust timing module when logging out-of-range PTS/FTS timestamps from malformed streams.
66
- Fix: Resolve Windows MSVC debug build crash caused by cross-CRT invalid free on Rust-allocated output_filename (#2126)
7+
- Fix: Use dynamic current_fps instead of hardcoded 29.97 in CEA-708 SCC frame delay calculations (#2172)
78

89
0.96.6 (2026-02-19)
910
-------------------

src/lib_ccx/ccx_decoders_708_output.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,11 @@ void dtvcc_write_scc(dtvcc_writer_ctx *writer, dtvcc_service_decoder *decoder, s
550550
if (tv->old_cc_time_end > time_show.time_in_ms)
551551
{
552552
// Correct the frame delay
553-
time_show.time_in_ms -= 1000 / 29.97;
553+
time_show.time_in_ms -= 1000 / current_fps;
554554
print_scc_time(time_show, buf);
555555
buf_len = strlen(buf);
556556
SCC_SNPRINTF("\t942c 942c");
557-
time_show.time_in_ms += 1000 / 29.97;
557+
time_show.time_in_ms += 1000 / current_fps;
558558
// Clear the buffer and start pop on caption
559559
SCC_SNPRINTF("94ae 94ae 9420 9420");
560560
}
@@ -566,20 +566,20 @@ void dtvcc_write_scc(dtvcc_writer_ctx *writer, dtvcc_service_decoder *decoder, s
566566
buf_len = strlen(buf);
567567
SCC_SNPRINTF("\t942c 942c \n\n");
568568
// Correct the frame delay
569-
time_show.time_in_ms -= 1000 / 29.97;
569+
time_show.time_in_ms -= 1000 / current_fps;
570570
// Clear the buffer and start pop on caption in new time
571571
print_scc_time(time_show, buf + buf_len);
572572
buf_len = strlen(buf);
573573
SCC_SNPRINTF("\t94ae 94ae 9420 9420");
574-
time_show.time_in_ms += 1000 / 29.97;
574+
time_show.time_in_ms += 1000 / current_fps;
575575
}
576576
else
577577
{
578-
time_show.time_in_ms -= 1000 / 29.97;
578+
time_show.time_in_ms -= 1000 / current_fps;
579579
print_scc_time(time_show, buf);
580580
buf_len = strlen(buf);
581581
SCC_SNPRINTF("\t942c 942c 94ae 94ae 9420 9420");
582-
time_show.time_in_ms += 1000 / 29.97;
582+
time_show.time_in_ms += 1000 / current_fps;
583583
}
584584

585585
int total_subtitle_count = count_captions_lines_scc(tv);

0 commit comments

Comments
 (0)