[PR #1823] [MERGED] fix: Correct is_decoder_processed_enough() multiprogram logic and suppress false warnings #2569

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

📋 Pull Request Information

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

Base: masterHead: fix/issue-1701-switch-to-next-file-error


📝 Commits (1)

  • df1e075 fix: Correct is_decoder_processed_enough() multiprogram logic and suppress false warnings

📊 Changes

4 files changed (+107 additions, -13 deletions)

View changed files

📝 src/lib_ccx/file_functions.c (+9 -1)
📝 src/lib_ccx/lib_ccx.c (+23 -5)
📝 src/rust/src/file_functions/file.rs (+9 -1)
📝 src/rust/src/hlist.rs (+66 -6)

📄 Description

Summary

Fixes #1701

The is_decoder_processed_enough() function had a bug where it would always return FALSE in multiprogram mode, causing false "Error in switch_to_next_file()" warnings for files without captions.

Root Cause

The condition dec_ctx->processed_enough == CCX_TRUE && ctx->multiprogram == CCX_FALSE meant that in multiprogram mode (ctx->multiprogram == CCX_TRUE), the function would never return TRUE, even when all decoders had finished processing.

Changes

  • Fixed is_decoder_processed_enough() in both C and Rust:
    • In single-program mode: return TRUE if ANY decoder has processed enough
    • In multiprogram mode: return TRUE only if ALL decoders have processed enough
  • Added empty decoder list check in switch_to_next_file():
    • If no decoders exist (no captions found), suppress the "premature ending" warning
    • This is a normal condition for files without closed captions, not an error
  • Updated Rust tests to verify the new behavior

Files Modified

  • src/lib_ccx/lib_ccx.c - Fixed is_decoder_processed_enough() logic
  • src/lib_ccx/file_functions.c - Added empty decoder list check
  • src/rust/src/hlist.rs - Fixed Rust version + updated tests
  • src/rust/src/file_functions/file.rs - Added empty decoder list check

Test plan

  • Tested with sample .ogg file from issue - no more false error message
  • Tested with files containing captions - normal operation unaffected
  • Tested with --autoprogram (multiprogram mode) - works correctly
  • All Rust tests pass (12/12)

🤖 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/1823 **Author:** [@cfsmp3](https://github.com/cfsmp3) **Created:** 12/14/2025 **Status:** ✅ Merged **Merged:** 12/14/2025 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `fix/issue-1701-switch-to-next-file-error` --- ### 📝 Commits (1) - [`df1e075`](https://github.com/CCExtractor/ccextractor/commit/df1e07517016ddb19ab7565e6f79c06c2ac0c3e9) fix: Correct is_decoder_processed_enough() multiprogram logic and suppress false warnings ### 📊 Changes **4 files changed** (+107 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `src/lib_ccx/file_functions.c` (+9 -1) 📝 `src/lib_ccx/lib_ccx.c` (+23 -5) 📝 `src/rust/src/file_functions/file.rs` (+9 -1) 📝 `src/rust/src/hlist.rs` (+66 -6) </details> ### 📄 Description ## Summary Fixes #1701 The `is_decoder_processed_enough()` function had a bug where it would always return FALSE in multiprogram mode, causing false "Error in switch_to_next_file()" warnings for files without captions. ### Root Cause The condition `dec_ctx->processed_enough == CCX_TRUE && ctx->multiprogram == CCX_FALSE` meant that in multiprogram mode (`ctx->multiprogram == CCX_TRUE`), the function would never return TRUE, even when all decoders had finished processing. ### Changes - **Fixed `is_decoder_processed_enough()`** in both C and Rust: - In single-program mode: return TRUE if ANY decoder has processed enough - In multiprogram mode: return TRUE only if ALL decoders have processed enough - **Added empty decoder list check** in `switch_to_next_file()`: - If no decoders exist (no captions found), suppress the "premature ending" warning - This is a normal condition for files without closed captions, not an error - **Updated Rust tests** to verify the new behavior ### Files Modified - `src/lib_ccx/lib_ccx.c` - Fixed `is_decoder_processed_enough()` logic - `src/lib_ccx/file_functions.c` - Added empty decoder list check - `src/rust/src/hlist.rs` - Fixed Rust version + updated tests - `src/rust/src/file_functions/file.rs` - Added empty decoder list check ## Test plan - [x] Tested with sample `.ogg` file from issue - no more false error message - [x] Tested with files containing captions - normal operation unaffected - [x] Tested with `--autoprogram` (multiprogram mode) - works correctly - [x] All Rust tests pass (12/12) 🤖 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:49 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2569