|
| 1 | +use crate::slint_generatedAppWindow::{ |
| 2 | + AppWindow, VideoEditorFilter as UIVideoEditorFilter, |
| 3 | + VideoEditorTrackType as UIVideoEditorTrackType, |
| 4 | +}; |
| 5 | +use derivative::Derivative; |
| 6 | +use pmacro::SlintFromConvert; |
| 7 | +use serde::{Deserialize, Serialize}; |
| 8 | +use slint::Model; |
| 9 | + |
| 10 | +crate::impl_slint_enum_serde!(UIVideoEditorTrackType, Audio, Video, Subtitle, Overlay); |
| 11 | + |
| 12 | +#[derive(Serialize, Deserialize, Debug, Clone, Derivative, SlintFromConvert)] |
| 13 | +#[derivative(Default)] |
| 14 | +#[from("UIVideoEditorFilter")] |
| 15 | +#[serde(default)] |
| 16 | +pub struct VideoEditorFilter { |
| 17 | + name: String, |
| 18 | + |
| 19 | + #[vec(from = "filters")] |
| 20 | + filters: Vec<String>, |
| 21 | +} |
| 22 | + |
| 23 | +// TODO: |
| 24 | +// pub struct VideoEditorTrackSegment { |
| 25 | +// hiding: bool, |
| 26 | +// duration: i32, // ms |
| 27 | +// timeline_offset: i32, // ms |
| 28 | +// source_offset: i32, // ms |
| 29 | +// |
| 30 | +// video_filters: [VideoEditorFilter], |
| 31 | +// audio_filters: [VideoEditorFilter], |
| 32 | +// subtitle_filters: [VideoEditorFilter], |
| 33 | +// overlay_filters: [VideoEditorFilter], |
| 34 | +// |
| 35 | +// left_screenshot: image, |
| 36 | +// right_screenshot: image, |
| 37 | +// preview_audio_channels: i32, |
| 38 | +// preview_audio_samples: [f32], // 只用于预览,可能经过重采样和平均化 |
| 39 | +// |
| 40 | +// filters: [SegmentFilter], // 每个segment拥有的滤镜 |
| 41 | +// } |
| 42 | +// |
| 43 | +// pub struct VideoEditorTrack { |
| 44 | +// locked: bool, |
| 45 | +// hiding: bool, |
| 46 | +// muted: bool, |
| 47 | +// name: String, |
| 48 | +// duration: i32, // ms |
| 49 | +// ty: VideoEditorTrackType, |
| 50 | +// segments: [VideoEditorTrackSegment], |
| 51 | +// } |
| 52 | +// |
| 53 | +// pub struct VideoEditorTracksManager { |
| 54 | +// duration: i32, // ms |
| 55 | +// tracks: [VideoEditorTrack], |
| 56 | +// } |
| 57 | +// |
| 58 | +// pub struct VideoEditorUIState { |
| 59 | +// enabled_link_track: bool, |
| 60 | +// enabled_link_all_tracks: bool, |
| 61 | +// enabled_snap_track_segments: bool, |
| 62 | +// tracks_height: String, |
| 63 | +// left_panel_width: String, |
| 64 | +// right_panel_width: String, |
| 65 | +// tracks_zoom_level: String, |
| 66 | +// preview_volumn: f32, |
| 67 | +// } |
| 68 | +// |
| 69 | +// pub struct VideoEditorPreviewConfig { |
| 70 | +// fps: Fps, |
| 71 | +// resolution: Resolution, |
| 72 | +// channels: AudioChannels, |
| 73 | +// sample_rate: AudioSampleRate, |
| 74 | +// } |
| 75 | +// |
| 76 | +// pub struct VideoEditorNewProjectConfig { |
| 77 | +// name: String, |
| 78 | +// preview_config: VideoEditorPreviewConfig, |
| 79 | +// } |
| 80 | +// |
| 81 | +// pub struct SelectedTrackIndex { |
| 82 | +// index: i32, |
| 83 | +// modifiers: KeyboardModifiers, |
| 84 | +// } |
| 85 | +// |
| 86 | +// pub struct SelectedSegmentIndex { |
| 87 | +// index: i32, |
| 88 | +// track_index: i32, |
| 89 | +// modifiers: KeyboardModifiers, |
| 90 | +// } |
| 91 | +// |
| 92 | +// pub struct VideoEditorPlaylistItem { |
| 93 | +// file_path: String, |
| 94 | +// name: String, |
| 95 | +// media_type: MediaType, |
| 96 | +// duration: String, |
| 97 | +// file_size: String, |
| 98 | +// thumbnail: image, |
| 99 | +// } |
| 100 | +// |
| 101 | +// pub struct VideoEditorExportQueueItem { |
| 102 | +// name: String, |
| 103 | +// media_type: MediaType, |
| 104 | +// progress: f32, |
| 105 | +// is_cancelled: bool, |
| 106 | +// } |
| 107 | +// |
| 108 | +// pub struct VideoEditorExportVideoConfig { |
| 109 | +// fps: Fps, |
| 110 | +// resolution: Resolution, |
| 111 | +// channels: AudioChannels, |
| 112 | +// sample_rate: AudioSampleRate, |
| 113 | +// } |
| 114 | +// |
| 115 | +// pub struct VideoEditorExportAudioConfig { |
| 116 | +// format: AudioFormat, |
| 117 | +// channels: AudioChannels, |
| 118 | +// sample_rate: AudioSampleRate, |
| 119 | +// } |
| 120 | +// |
| 121 | +// pub struct VideoEditorVolume { |
| 122 | +// left: f32, |
| 123 | +// right: f32, |
| 124 | +// } |
| 125 | +// pub enum SubtitleType { |
| 126 | +// Srt, |
| 127 | +// Vtt, |
| 128 | +// Ass, |
| 129 | +// } |
| 130 | +// |
| 131 | +// pub struct VideoEditorSubtitle { |
| 132 | +// start_timestamp: String, |
| 133 | +// end_timestamp: String, |
| 134 | +// subtitle: String, |
| 135 | +// } |
| 136 | +// |
| 137 | +// pub struct RecentEntry { |
| 138 | +// name: String, |
| 139 | +// path: String, |
| 140 | +// modify_at: String, |
| 141 | +// } |
0 commit comments