[PR #1918] fix: Apply --delay option to DVB/bitmap subtitles #2714

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

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

State: closed
Merged: Yes


Summary

The --delay option was not being applied to DVB and other bitmap-based subtitles (DVD subtitles, etc.), only to CEA-608 subtitles. This made it impossible for users to correct timing offsets in DVB subtitle extraction.

Changes

  • Add subs_delay to sub->start_time and sub->end_time for CC_BITMAP subtitles in encode_sub(), matching the behavior for CC_608
  • Add bounds checking to skip subtitles that become negative after applying a negative delay
  • Properly free bitmap data when skipping to avoid memory leaks

Background

Investigation of issue #1248 revealed that while the original timing offset issue (6600ms too early) in certain DVB streams requires the sample file for root cause analysis, the --delay option should have been a viable workaround. However, the delay was never actually applied to bitmap-based subtitles.

In encode_sub() at ccx_encoders_common.c:

  • For CC_608 subtitles: subs_delay was correctly applied
  • For CC_BITMAP subtitles: subs_delay was never applied

Test plan

  • Build passes
  • Verify --delay option works with DVB subtitles
  • Verify negative delays properly skip early subtitles without memory leaks

Fixes #1248 (provides workaround via --delay)

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/CCExtractor/ccextractor/pull/1918 **State:** closed **Merged:** Yes --- ## Summary The `--delay` option was not being applied to DVB and other bitmap-based subtitles (DVD subtitles, etc.), only to CEA-608 subtitles. This made it impossible for users to correct timing offsets in DVB subtitle extraction. ## Changes - Add `subs_delay` to `sub->start_time` and `sub->end_time` for `CC_BITMAP` subtitles in `encode_sub()`, matching the behavior for `CC_608` - Add bounds checking to skip subtitles that become negative after applying a negative delay - Properly free bitmap data when skipping to avoid memory leaks ## Background Investigation of issue #1248 revealed that while the original timing offset issue (6600ms too early) in certain DVB streams requires the sample file for root cause analysis, the `--delay` option should have been a viable workaround. However, the delay was never actually applied to bitmap-based subtitles. In `encode_sub()` at `ccx_encoders_common.c`: - For `CC_608` subtitles: `subs_delay` was correctly applied - For `CC_BITMAP` subtitles: `subs_delay` was **never applied** ## Test plan - [ ] Build passes - [ ] Verify `--delay` option works with DVB subtitles - [ ] Verify negative delays properly skip early subtitles without memory leaks ## Related Issues Fixes #1248 (provides workaround via `--delay`) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claunia added the pull-request label 2026-01-29 17:23:33 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2714