fix(subtitles): follow sub-delay in sidebar, navigation, and overlay matching

Anything comparing time-pos with parsed cues now converts through a
shared subtitle-clock helper: the sidebar highlight and click-to-seek,
the sub-seek cue sanitizer, overlay/primer line resolution, and the
replay pause point after sub-seek.
This commit is contained in:
sudacode committed 2026-10-25 21:40:02 -07:00
1 parent 929e78b28c
commit 4d27e068c6
20 files changed
+177 -41

No files matched your search

+1 -15
View File
@@ -1,5 +1,6 @@
import type { SubtitleTimingBlock } from '../../subtitle-timing-tracker';
import type { SubtitleMiningContext } from '../../types/subtitle';
import { shiftSubtitleRangeToVideoClock } from './subtitle-clock';
interface SubtitleTimingTrackerLike {
getRecentBlocks: (count: number) => string[];
@@ -56,21 +57,6 @@ export function handleMultiCopyDigit(
}
}
/**
* mpv's `sub-start`/`sub-end` and parsed cues carry the subtitle file's own timestamps,
* but mpv plays each line `sub-delay` seconds later (z/x retiming). Media is cut from the
* video, so subtitle timings move onto the video clock before they reach mining.
*/
export function shiftSubtitleRangeToVideoClock<T extends { startTime: number; endTime: number }>(
range: T,
subDelay: number,
): T {
if (!Number.isFinite(subDelay) || subDelay === 0) {
return range;
}
return { ...range, startTime: range.startTime + subDelay, endTime: range.endTime + subDelay };
}
/**
* Snapshot the live mpv subtitle line and its timings as a mining context. Media
* generation can run tens of seconds after the user mines (slow audio extraction),