Skip to content

fix(build): decouple WITH_FFMPEG from ENABLE_HARDSUBX, fix FFmpeg 5.0+ API#2259

Merged
cfsmp3 merged 2 commits intomasterfrom
fix/decouple-ffmpeg-hardsubx
Apr 7, 2026
Merged

fix(build): decouple WITH_FFMPEG from ENABLE_HARDSUBX, fix FFmpeg 5.0+ API#2259
cfsmp3 merged 2 commits intomasterfrom
fix/decouple-ffmpeg-hardsubx

Conversation

@cfsmp3
Copy link
Copy Markdown
Contributor

@cfsmp3 cfsmp3 commented Apr 7, 2026

Summary

  • Remove ENABLE_HARDSUBX from WITH_FFMPEG CMake blocks — hardsubx should only be enabled by WITH_HARDSUBX, not implied by FFmpeg
  • WITH_HARDSUBX now auto-enables WITH_OCR and WITH_FFMPEG (it requires both)
  • Fix const AVCodec* in ffmpeg_intgr.c for FFmpeg 5.0+ API compatibility

Background

Since 2017 (commit 4f5f564b), WITH_FFMPEG=ON automatically defined ENABLE_HARDSUBX. At that time there was no separate WITH_HARDSUBX option — FFmpeg and hardsubx were the same thing. In 2018 (PR #966), WITH_HARDSUBX was added as a separate option but the old coupling was never removed. This made -DWITH_FFMPEG=ON fail because it compiled hardsubx code without linking tesseract/leptonica.

Test plan

All 7 build combinations tested:

# Flags Before After
1 Default OK OK
2 WITH_FFMPEG FAILS OK
3 WITH_HARDSUBX + WITH_OCR OK OK
4 WITH_FFMPEG + WITH_HARDSUBX + WITH_OCR FAILS OK
5 WITH_FFMPEG + WITH_OCR FAILS OK
6 WITH_OCR OK OK
7 WITH_HARDSUBX only FAILS OK

Default build regression test: output byte-identical to master.

🤖 Generated with Claude Code

cfsmp3 and others added 2 commits April 6, 2026 21:57
…+ API

Since 2017 (commit 4f5f564), WITH_FFMPEG=ON automatically defined
ENABLE_HARDSUBX. In 2018 (PR #966), WITH_HARDSUBX was added as a
separate option but the old coupling was never removed. This made
-DWITH_FFMPEG=ON fail to build because it compiled hardsubx code
without linking tesseract/leptonica.

Fixes:
- Remove ENABLE_HARDSUBX from both WITH_FFMPEG blocks (src/CMakeLists.txt
  and src/lib_ccx/CMakeLists.txt). ENABLE_HARDSUBX is now only defined
  by the WITH_HARDSUBX block, where it belongs.
- WITH_HARDSUBX now auto-enables WITH_OCR and WITH_FFMPEG since it
  requires both. Previously -DWITH_HARDSUBX=ON without -DWITH_OCR=ON
  also failed to link.
- Fix const AVCodec* in ffmpeg_intgr.c for FFmpeg 5.0+ API (the
  av_find_best_stream signature changed in libavcodec 59).

Tested all 7 build combinations:
  1. Default                              OK (was OK)
  2. WITH_FFMPEG                          OK (was BROKEN)
  3. WITH_HARDSUBX + WITH_OCR             OK (was OK)
  4. WITH_FFMPEG + WITH_HARDSUBX + OCR    OK (was BROKEN)
  5. WITH_FFMPEG + WITH_OCR               OK (was BROKEN)
  6. WITH_OCR                             OK (was OK)
  7. WITH_HARDSUBX only                   OK (was BROKEN)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cfsmp3 cfsmp3 merged commit 5fdd9b8 into master Apr 7, 2026
43 of 45 checks passed
@cfsmp3 cfsmp3 deleted the fix/decouple-ffmpeg-hardsubx branch April 7, 2026 05:16
@ccextractor-bot
Copy link
Copy Markdown
Collaborator

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 5fdd9b8...:
Report Name Tests Passed
Broken 9/13
CEA-708 1/14
DVB 3/7
DVD 3/3
DVR-MS 2/2
General 16/27
Hardsubx 1/1
Hauppage 3/3
MP4 1/3
NoCC 10/10
Options 77/86
Teletext 19/21
WTV 11/13
XDS 30/34

Your PR breaks these cases:

NOTE: The following tests have been failing on the master branch as well as the PR:

Congratulations: Merging this PR would fix the following tests:

  • ccextractor --out=srt --latin1 --autoprogram 56c9f34548..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla 5d3a29f9f8..., Last passed: Never
  • ccextractor --autoprogram --out=srt --latin1 4e56e88ba4..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 c0d2fba8c0..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 27d7a43dd6..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 e2e2b501e0..., 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-bot
Copy link
Copy Markdown
Collaborator

CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 395f9b3...:
Report Name Tests Passed
Broken 9/13
CEA-708 1/14
DVB 4/7
DVD 3/3
DVR-MS 2/2
General 22/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 80/86
Teletext 20/21
WTV 13/13
XDS 31/34

Your PR breaks these cases:

NOTE: The following tests have been failing on the master branch as well as the PR:

Congratulations: Merging this PR would fix the following tests:

  • ccextractor --autoprogram --out=srt --latin1 --quant 0 85271be4d2..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65..., Last passed: Never
  • ccextractor --out=srt --latin1 --autoprogram 29e5ffd34b..., Last passed: Never
  • ccextractor --out=spupng c83f765c66..., Last passed: Never
  • ccextractor --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsnotafter 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsforatmost 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants