feat: add AdjustExistingTrackDrift use case to adjust drift scale of existing tracks
- Implemented AdjustExistingTrackDrift struct with execute method to modify drift scale of existing tracks in a project. - Added tests for adjusting drift scale, handling non-existent track IDs, and invalid scale values. - Updated MediaTrackInfo and AudioTrack entities to include drift_scale field. - Enhanced Project entity with needs_mkvmerge method to determine if mkvmerge is required based on drift scale. - Integrated drift scale adjustments into existing track list UI, allowing users to modify drift values. - Updated various use cases and UI components to support drift scale functionality, including add audio/subtitle forms and batch processing. - Implemented mkvmerge availability check and integrated it into the application workflow for conditional processing.
This commit is contained in:
@@ -10,6 +10,8 @@ pub struct AddAudioTrackRequest {
|
||||
pub language: TrackLanguage,
|
||||
pub is_default: bool,
|
||||
pub title: String,
|
||||
/// Fator de escala temporal (correção de drift). 1.0 = sem correção.
|
||||
pub drift_scale: f64,
|
||||
}
|
||||
|
||||
/// Formulário para adicionar uma faixa de áudio externa.
|
||||
@@ -33,7 +35,7 @@ impl AddAudioTrackForm {
|
||||
}
|
||||
|
||||
/// Renderiza o formulário. Retorna `Some(request)` ao confirmar.
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui) -> Option<AddAudioTrackRequest> {
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui, mkvmerge_available: bool) -> Option<AddAudioTrackRequest> {
|
||||
let mut result = None;
|
||||
|
||||
ui.group(|ui| {
|
||||
@@ -51,7 +53,7 @@ impl AddAudioTrackForm {
|
||||
}
|
||||
});
|
||||
|
||||
self.offset_field.ui(ui, "Atraso:");
|
||||
self.offset_field.ui_with_drift(ui, "Atraso:", mkvmerge_available);
|
||||
self.language_field.ui(ui);
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
@@ -82,12 +84,14 @@ impl AddAudioTrackForm {
|
||||
self.offset_field.parse(),
|
||||
self.language_field.parse(),
|
||||
) {
|
||||
let drift_scale = self.offset_field.parse_drift();
|
||||
result = Some(AddAudioTrackRequest {
|
||||
path,
|
||||
offset,
|
||||
language,
|
||||
is_default: self.is_default,
|
||||
title: self.title_input.trim().to_string(),
|
||||
drift_scale,
|
||||
});
|
||||
// Reset form
|
||||
self.selected_path = None;
|
||||
|
||||
Reference in New Issue
Block a user