feat: implement project management and media track handling
- Added domain entities for audio, subtitle, and video tracks. - Created a Project entity to manage media editing sessions. - Implemented value objects for file paths, sync offsets, track IDs, and languages. - Developed infrastructure for asynchronous FFmpeg process execution. - Built a user interface for selecting video files, adding audio and subtitle tracks, and managing output settings. - Integrated error handling and logging for media processing tasks.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use crate::domain::entities::{AudioTrack, SubtitleTrack};
|
||||
use crate::domain::value_objects::{SyncOffset, TrackId, TrackLanguage};
|
||||
|
||||
/// Faixa externa adicionada pelo usuário ao projeto.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum Track {
|
||||
Audio(AudioTrack),
|
||||
Subtitle(SubtitleTrack),
|
||||
}
|
||||
|
||||
impl Track {
|
||||
pub fn id(&self) -> TrackId {
|
||||
match self {
|
||||
Track::Audio(t) => t.id,
|
||||
Track::Subtitle(t) => t.id,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn offset(&self) -> SyncOffset {
|
||||
match self {
|
||||
Track::Audio(t) => t.offset,
|
||||
Track::Subtitle(t) => t.offset,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn language(&self) -> &TrackLanguage {
|
||||
match self {
|
||||
Track::Audio(t) => &t.language,
|
||||
Track::Subtitle(t) => &t.language,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_offset(&mut self, offset: SyncOffset) {
|
||||
match self {
|
||||
Track::Audio(t) => t.offset = offset,
|
||||
Track::Subtitle(t) => t.offset = offset,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_language(&mut self, language: TrackLanguage) {
|
||||
match self {
|
||||
Track::Audio(t) => t.language = language,
|
||||
Track::Subtitle(t) => t.language = language,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user