[PR #1818] [MERGED] fix: Enable stdout output for CEA-708 captions on Windows #2560

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

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1818
Author: @cfsmp3
Created: 12/14/2025
Status: Merged
Merged: 12/18/2025
Merged by: @cfsmp3

Base: masterHead: fix/issue-1693-stdout-crash


📝 Commits (2)

  • ecb0780 fix: Enable stdout output for CEA-708 captions on Windows
  • e2dfdaa Merge branch 'master' into fix/issue-1693-stdout-crash

📊 Changes

4 files changed (+81 additions, -3 deletions)

View changed files

📝 src/lib_ccx/ccx_encoders_common.c (+5 -0)
📝 src/rust/src/decoder/service_decoder.rs (+0 -1)
📝 src/rust/src/decoder/tv_screen.rs (+73 -0)
📝 src/rust/src/lib.rs (+3 -2)

📄 Description

Summary

Fixes #1693 - ccextractorwinfull.exe can't print captions to stdout

The CEA-708 decoder crashed on Windows when using --stdout because the dtvcc_writer was not properly initialized for stdout output.

Changes

  1. Fixed Windows stdout handle initialization (ccx_encoders_common.c):

    • Use GetStdHandle(STD_OUTPUT_HANDLE) instead of NULL for fhandle
    • This allows the Rust writer to detect stdout mode properly
  2. Changed env_logger target from Stdout to Stderr (lib.rs):

    • Debug messages no longer pollute stdout when using --stdout
    • This prevents mixing debug output with subtitle content
  3. Removed redundant debug statement (service_decoder.rs):

    • The bare debug!("{}", self.current_window) was noisy and duplicated by a more detailed debug statement below it

Test plan

  • All 270 Rust tests pass
  • Added test_writer_output_with_valid_fd - verifies stdout mode works when fd is pre-set
  • Added test_writer_output_missing_filename_and_fd - verifies proper error handling (not panic)
  • Verified subtitles extract correctly to stdout on Linux
  • Windows fix uses proper GetStdHandle(STD_OUTPUT_HANDLE) API

🤖 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/1818 **Author:** [@cfsmp3](https://github.com/cfsmp3) **Created:** 12/14/2025 **Status:** ✅ Merged **Merged:** 12/18/2025 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `fix/issue-1693-stdout-crash` --- ### 📝 Commits (2) - [`ecb0780`](https://github.com/CCExtractor/ccextractor/commit/ecb0780af53cc134624a6537f142c950a9d8606d) fix: Enable stdout output for CEA-708 captions on Windows - [`e2dfdaa`](https://github.com/CCExtractor/ccextractor/commit/e2dfdaa6a85ed7de15490d6479ab917149b18a6e) Merge branch 'master' into fix/issue-1693-stdout-crash ### 📊 Changes **4 files changed** (+81 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/lib_ccx/ccx_encoders_common.c` (+5 -0) 📝 `src/rust/src/decoder/service_decoder.rs` (+0 -1) 📝 `src/rust/src/decoder/tv_screen.rs` (+73 -0) 📝 `src/rust/src/lib.rs` (+3 -2) </details> ### 📄 Description ## Summary Fixes #1693 - ccextractorwinfull.exe can't print captions to stdout The CEA-708 decoder crashed on Windows when using `--stdout` because the `dtvcc_writer` was not properly initialized for stdout output. ## Changes 1. **Fixed Windows stdout handle initialization** (`ccx_encoders_common.c`): - Use `GetStdHandle(STD_OUTPUT_HANDLE)` instead of `NULL` for `fhandle` - This allows the Rust writer to detect stdout mode properly 2. **Changed env_logger target from Stdout to Stderr** (`lib.rs`): - Debug messages no longer pollute stdout when using `--stdout` - This prevents mixing debug output with subtitle content 3. **Removed redundant debug statement** (`service_decoder.rs`): - The bare `debug!("{}", self.current_window)` was noisy and duplicated by a more detailed debug statement below it ## Test plan - [x] All 270 Rust tests pass - [x] Added `test_writer_output_with_valid_fd` - verifies stdout mode works when fd is pre-set - [x] Added `test_writer_output_missing_filename_and_fd` - verifies proper error handling (not panic) - [x] Verified subtitles extract correctly to stdout on Linux - [x] Windows fix uses proper `GetStdHandle(STD_OUTPUT_HANDLE)` API 🤖 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:22:47 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2560