Skip to main content

Module sync

Module sync 

Source
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

§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?;

Modules§

engine
Refactored sync engine with VAD (Voice Activity Detection) support.

Structs§

MethodSelectionStrategy
Method selection strategy for synchronization analysis.
SyncEngine
Unified sync engine based on VAD voice detection.
SyncPairingRequest
Parser-agnostic description of one sync invocation’s inputs.
SyncResult
Synchronization result structure.

Enums§

BatchRequest
How the caller requested batch processing.
SyncMethod
Sync method enumeration.
SyncMode
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 _synced to 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.