Expand description
Refactored sync module focused on VAD (Voice Activity Detection).
Provides unified subtitle synchronization functionality using local VAD (Voice Activity Detection) for voice detection and sync offset calculation.
§Core Components
SyncEngine- VAD-based sync engineSyncMethod- Sync method enumeration (VAD and manual)SyncResult- Sync result structure containing offset and confidenceshift_subtitle_timing- VAD-independent manual-offset timing transform
§Usage
use subx_core::core::sync::{SyncEngine, SyncMethod};
use subx_core::config::SyncConfig;
use std::path::Path;
use subx_core::core::formats::{Subtitle, SubtitleFormatType, SubtitleMetadata};
let engine = SyncEngine::new(SyncConfig::default())?;
let video_path = Path::new("video.mp4");
let metadata = SubtitleMetadata::new(SubtitleFormatType::Srt);
let subtitle = Subtitle::new(SubtitleFormatType::Srt, metadata);
let result = engine.detect_sync_offset(video_path, &subtitle, Some(SyncMethod::LocalVad)).await?;Re-exports§
pub use engine::MethodSelectionStrategy;pub use engine::SyncEngine;pub use engine::SyncMethod;pub use engine::SyncResult;
Modules§
- engine
- Refactored sync engine with VAD (Voice Activity Detection) support.
Structs§
- Sync
Pairing Request - Parser-agnostic description of one
syncinvocation’s inputs.
Enums§
- Batch
Request - How the caller requested batch processing.
- Sync
Mode - Sync mode: single file or batch.
Constants§
- SYNC_
SUBTITLE_ EXTENSIONS - Subtitle extensions recognised when auto-pairing a sync input.
- SYNC_
VIDEO_ EXTENSIONS - Video container extensions recognised when auto-pairing a sync input.
Functions§
- create_
default_ output_ path - Creates a default output path by appending
_syncedto the file stem. - resolve_
sync_ pairing - Decide whether a sync invocation is a single pair or a batch, auto-pairing a lone video or subtitle with its sibling on disk.
- shift_
subtitle_ timing - Shift every subtitle entry’s start and end time by a manual offset.