[PR #1916] [MERGED] feat(scc): Add configurable frame rate and styled PAC codes for SCC output #2709

Open
opened 2026-01-29 17:23:32 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1916
Author: @cfsmp3
Created: 12/27/2025
Status: Merged
Merged: 12/28/2025
Merged by: @cfsmp3

Base: masterHead: fix/issue-1191-scc-framerate-and-preamble-codes


📝 Commits (1)

  • 021b788 feat(scc): Add configurable frame rate and styled PAC codes for SCC output

📊 Changes

6 files changed (+192 additions, -4 deletions)

View changed files

📝 src/lib_ccx/ccx_common_option.c (+1 -0)
📝 src/lib_ccx/ccx_common_option.h (+3 -0)
📝 src/lib_ccx/ccx_encoders_common.c (+1 -0)
📝 src/lib_ccx/ccx_encoders_common.h (+3 -0)
📝 src/lib_ccx/ccx_encoders_scc.c (+181 -4)
📝 src/rust/src/common.rs (+3 -0)

📄 Description

Summary

This PR addresses the remaining items from issue #1191 (SCC/CCD format improvements):

  • SCC Output Frame Rate: The --scc-framerate option now affects both input parsing AND output encoding (was hardcoded to 29.97fps)
  • Styled PAC Optimization: When captions start at column 0 with non-default color/font, uses a single styled PAC instead of indent PAC + mid-row code

Changes

1. SCC Output Frame Rate

  • Added scc_framerate to encoder_cfg and encoder_ctx structs
  • Added get_scc_fps() helper function in SCC encoder
  • Updated add_timestamp() to use configurable frame rate
  • Supports 24, 25, 29.97 (default), and 30 fps

2. Styled PAC (Preamble Address Code) Optimization

  • Added get_styled_pac_byte2() - computes byte2 for styled PACs (0x40-0x4F range)
  • Added row_uses_high_range() - determines which PAC byte range to use
  • Added write_styled_preamble() - writes styled PAC directly
  • Added can_use_styled_pac() - checks if optimization applies
  • Updated write_cc_buffer_as_scenarist() to use styled PAC when appropriate

This resolves the TODO comment at line 487: "Preamble code need to take into account font as well"

Test plan

  • Build succeeds
  • SCC output with different frame rates produces correct frame numbers
  • Rust SCC demuxer tests pass (12/12)
  • CI regression tests

Issue Reference

Fixes #1191

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1916 **Author:** [@cfsmp3](https://github.com/cfsmp3) **Created:** 12/27/2025 **Status:** ✅ Merged **Merged:** 12/28/2025 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `fix/issue-1191-scc-framerate-and-preamble-codes` --- ### 📝 Commits (1) - [`021b788`](https://github.com/CCExtractor/ccextractor/commit/021b788461b6c5508d316d0fd5e103790fd1e347) feat(scc): Add configurable frame rate and styled PAC codes for SCC output ### 📊 Changes **6 files changed** (+192 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/lib_ccx/ccx_common_option.c` (+1 -0) 📝 `src/lib_ccx/ccx_common_option.h` (+3 -0) 📝 `src/lib_ccx/ccx_encoders_common.c` (+1 -0) 📝 `src/lib_ccx/ccx_encoders_common.h` (+3 -0) 📝 `src/lib_ccx/ccx_encoders_scc.c` (+181 -4) 📝 `src/rust/src/common.rs` (+3 -0) </details> ### 📄 Description ## Summary This PR addresses the remaining items from issue #1191 (SCC/CCD format improvements): - **SCC Output Frame Rate**: The `--scc-framerate` option now affects both input parsing AND output encoding (was hardcoded to 29.97fps) - **Styled PAC Optimization**: When captions start at column 0 with non-default color/font, uses a single styled PAC instead of indent PAC + mid-row code ## Changes ### 1. SCC Output Frame Rate - Added `scc_framerate` to `encoder_cfg` and `encoder_ctx` structs - Added `get_scc_fps()` helper function in SCC encoder - Updated `add_timestamp()` to use configurable frame rate - Supports 24, 25, 29.97 (default), and 30 fps ### 2. Styled PAC (Preamble Address Code) Optimization - Added `get_styled_pac_byte2()` - computes byte2 for styled PACs (0x40-0x4F range) - Added `row_uses_high_range()` - determines which PAC byte range to use - Added `write_styled_preamble()` - writes styled PAC directly - Added `can_use_styled_pac()` - checks if optimization applies - Updated `write_cc_buffer_as_scenarist()` to use styled PAC when appropriate This resolves the TODO comment at line 487: "Preamble code need to take into account font as well" ## Test plan - [x] Build succeeds - [x] SCC output with different frame rates produces correct frame numbers - [x] Rust SCC demuxer tests pass (12/12) - [ ] CI regression tests ## Issue Reference Fixes #1191 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:23:32 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2709