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

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

Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1823

State: closed
Merged: Yes


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

**Original Pull Request:** https://github.com/CCExtractor/ccextractor/pull/1823 **State:** closed **Merged:** Yes --- ## 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)
claunia added the pull-request label 2026-01-29 17:22:51 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2574