subx_cli/core/sync/
mod.rs

1//! Refactored sync module focused on VAD (Voice Activity Detection).
2//!
3//! Provides unified subtitle synchronization functionality using local
4//! VAD (Voice Activity Detection) for voice detection and sync offset calculation.
5//!
6//! # Core Components
7//!
8//! - [`SyncEngine`] - VAD-based sync engine
9//! - [`SyncMethod`] - Sync method enumeration (VAD and manual)
10//! - [`SyncResult`] - Sync result structure containing offset and confidence
11//!
12//! # Usage
13//!
14//! ```no_run
15//! use subx_cli::core::sync::{SyncEngine, SyncMethod};
16//! use subx_cli::config::SyncConfig;
17//! use std::path::Path;
18//! use subx_cli::core::formats::{Subtitle, SubtitleFormatType, SubtitleMetadata};
19//!
20//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
21//! let engine = SyncEngine::new(SyncConfig::default())?;
22//! let video_path = Path::new("video.mp4");
23//! let metadata = SubtitleMetadata::new(SubtitleFormatType::Srt);
24//! let subtitle = Subtitle::new(SubtitleFormatType::Srt, metadata);
25//! let result = engine.detect_sync_offset(video_path, &subtitle, Some(SyncMethod::LocalVad)).await?;
26//! # Ok(())
27//! # }
28//! ```
29
30pub mod engine;
31
32// Re-export main types
33pub use engine::{MethodSelectionStrategy, SyncEngine, SyncMethod, SyncResult};
34
35// Backward compatibility exports (marked as deprecated)
36#[allow(deprecated)]
37pub use engine::OldSyncConfig;