Fix premature ending error in switch_to_next_file()
Fixes #1701
Problem:
The is_decoder_processed_enough() function always returned 'CCX_FALSE' in multiprogram mode due to an unnecessary 'ctx->multiprogram == CCX_FALSE' check. This caused false "premature ending" errors in switch_to_next_file().
Solution:
Remove the multiprogram check from is_decoder_processed_enough(). The function should return CCX_TRUE when any decoder has processed enough data, regardless of multiprogram setting.
Testing:
- Verified the fix resolves the issue with the original failing file
- Confirmed no regressions in normal operation
- Program now correctly handles files with no subtitles without false errors
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit b293017...:
| Report Name | Tests Passed |
| Broken | 12/13 |
| CEA-708 | 14/14 |
| DVB | 7/7 |
| DVD | 3/3 |
| DVR-MS | 2/2 |
| General | 26/27 |
| Hardsubx | 1/1 |
| Hauppage | 3/3 |
| MP4 | 3/3 |
| NoCC | 10/10 |
| Options | 85/86 |
| Teletext | 21/21 |
| WTV | 13/13 |
| XDS | 34/34 |
Your PR breaks these cases:
- ccextractor --out=ttxt --latin1 001dd8cdf7...
- ccextractor --autoprogram --out=ttxt --latin1 --ucla adce82fd39...
- ccextractor --no-goptime c83f765c66...
Congratulations: Merging this PR would fix the following tests:
- ccextractor --hardsubx 1a0302f7fd..., Last passed: Never
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).
Check the result page for more info.
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit b293017...:
| Report Name | Tests Passed |
| Broken | 13/13 |
| CEA-708 | 14/14 |
| DVB | 7/7 |
| DVD | 3/3 |
| DVR-MS | 2/2 |
| General | 27/27 |
| Hardsubx | 1/1 |
| Hauppage | 3/3 |
| MP4 | 3/3 |
| NoCC | 10/10 |
| Options | 86/86 |
| Teletext | 21/21 |
| WTV | 13/13 |
| XDS | 34/34 |
Congratulations: Merging this PR would fix the following tests:
- ccextractor --autoprogram --out=srt --latin1 f1422b8bfe..., Last passed: Never
- ccextractor --datapid 5603 --autoprogram --out=srt --latin1 --teletext 85c7fc1ad7..., Last passed: Never
- ccextractor --autoprogram --out=srt --latin1 --quant 0 85271be4d2..., Last passed: Never
- ccextractor --hardsubx 1a0302f7fd..., Last passed: Never
- ccextractor --autoprogram --out=ttxt --latin1 c0d2fba8c0..., Last passed: Never
- ccextractor --autoprogram --out=ttxt --latin1 006fdc391a..., Last passed: Never
- ccextractor --autoprogram --out=ttxt --latin1 e92a1d4d2a..., Last passed: Never
- ccextractor --autoprogram --out=ttxt --latin1 7e4ebf7fd7..., Last passed: Never
- ccextractor --autoprogram --out=ttxt --latin1 9256a60e4b..., Last passed: Never
- ccextractor --autoprogram --out=ttxt --latin1 27d7a43dd6..., Last passed: Never
- ccextractor --autoprogram --out=ttxt --latin1 297a44921a..., Last passed: Never
- ccextractor --autoprogram --out=ttxt --latin1 efbe129086..., Last passed: Never
- ccextractor --autoprogram --out=ttxt --latin1 eae0077731..., Last passed: Never
- ccextractor --autoprogram --out=ttxt --latin1 e2e2b501e0..., Last passed: Never
- ccextractor --autoprogram --out=ttxt --latin1 c6407fb294..., Last passed: Never
- ccextractor --autoprogram --out=ttxt --latin1 --datets dcada745de..., Last passed: Never
- ccextractor --autoprogram --out=srt --latin1 --tpage 398 5d5838bde9..., Last passed: Never
- ccextractor --autoprogram --out=srt --latin1 --teletext --tpage 398 3b276ad8bf..., Last passed: Never
All tests passing on the master branch were passed completely.
Check the result page for more info.
Hi @DhanushVarma-2,
Thank you for this contribution! However, both changes in this PR have now been superseded by other merged PRs:
-
CMakeLists.txt (Tesseract linking): This exact change was merged via your other PR #1760 on Dec 14, 2025.
-
lib_ccx.c (is_decoder_processed_enough fix): This was addressed by PR #1823, which implemented a more comprehensive fix that properly handles both single-program and multiprogram modes.
Since all the issues this PR aimed to fix are now resolved on master, I'm closing this PR as obsolete.
Thanks again for identifying these issues!