Skip to content

Commit 364f3ad

Browse files
committed
[*] refactor
1 parent bae9cfd commit 364f3ad

File tree

4 files changed

+59
-48
lines changed

4 files changed

+59
-48
lines changed

lib/video-editor/src/export/exporter.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ use super::{
55
use crate::{
66
Error, Result,
77
tracks::{
8-
manager::Manager, subtitle_track::apply_segment_subtitle_filters, track::Track,
9-
unified_mixer::UnifiedFrame,
8+
manager::Manager,
9+
subtitle_track::apply_segment_subtitle_filters,
10+
track::Track,
11+
unified_mixer::{UnifiedFrame, UnifiedMixerConfig},
1012
},
1113
};
1214
use std::{
@@ -33,6 +35,8 @@ struct ExportContext {
3335
output_width: u32,
3436
output_height: u32,
3537
output_fps: f32,
38+
audio_sample_rate: u32,
39+
audio_channels: u16,
3640
video_encoder: Arc<Mutex<Option<Box<dyn VideoEncoder>>>>,
3741
video_stream_index: usize,
3842
audio_stream_index: Option<usize>,
@@ -182,6 +186,8 @@ impl Mp4Exporter {
182186
output_width,
183187
output_height,
184188
output_fps,
189+
audio_sample_rate,
190+
audio_channels,
185191
video_encoder,
186192
video_stream_index,
187193
audio_stream_index,
@@ -208,13 +214,16 @@ impl Mp4Exporter {
208214
let cache_duration = Duration::from_secs(5);
209215
let max_cache_duration = Duration::from_secs(20);
210216

211-
let mixer_iter = self.manager.unified_tracks_mixer_iter(
212-
Duration::ZERO,
213-
cache_duration,
214-
max_cache_duration,
215-
Some(ctx.output_width),
216-
Some(ctx.output_height),
217-
Some(ctx.output_fps),
217+
let mixer_iter = self.manager.unified_tracks_mixer_iter_with_config(
218+
UnifiedMixerConfig::default()
219+
.with_timeline_offset(Duration::ZERO)
220+
.with_cache_duration(cache_duration)
221+
.with_max_cache_duration(max_cache_duration)
222+
.with_output_width(Some(ctx.output_width))
223+
.with_output_height(Some(ctx.output_height))
224+
.with_output_fps(Some(ctx.output_fps))
225+
.with_output_channels(Some(ctx.audio_channels))
226+
.with_output_sample_rate(Some(ctx.audio_sample_rate)),
218227
)?;
219228

220229
let mut frames_processed = 0u64;

todo.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
## 问题
2-
- 联动所有轨道时,移动所有轨道上的segment,非鼠标下控制移动的segment可能为0
32

43
## 待验证
54

65
- 视频轨道分离字幕
76

87
## 待实现功能
9-
8+
- library和playlist的条目预览弹窗

wayshot/ui/panel/desktop/home.slint

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ import { VideoEditor } from "video-editor/video-editor.slint";
88
import { Logic } from "../../logic.slint";
99

1010
export component Home inherits VerticalLayout {
11-
// if Store.current-tab-index == TabIndex.Home: MainPanel {
12-
// height: parent.height;
13-
//
14-
// init => {
15-
// Logic.startup-recorder-init();
16-
// }
17-
// }
18-
//
19-
// if Store.current-tab-index == TabIndex.History: HistoryPanel {
20-
// init => {
21-
// Logic.startup-recorder-init();
22-
// }
23-
// }
24-
//
25-
// if Store.current-tab-index == TabIndex.Player: PlayerPanel {
26-
// height: parent.height;
27-
//
28-
// init => {
29-
// Logic.startup-recorder-init();
30-
// }
31-
// }
11+
if Store.current-tab-index == TabIndex.Home: MainPanel {
12+
height: parent.height;
13+
14+
init => {
15+
Logic.startup-recorder-init();
16+
}
17+
}
18+
19+
if Store.current-tab-index == TabIndex.History: HistoryPanel {
20+
init => {
21+
Logic.startup-recorder-init();
22+
}
23+
}
24+
25+
if Store.current-tab-index == TabIndex.Player: PlayerPanel {
26+
height: parent.height;
27+
28+
init => {
29+
Logic.startup-recorder-init();
30+
}
31+
}
3232

3333
if Store.current-tab-index == TabIndex.VideoEditor: VideoEditor {
3434
height: parent.height;
@@ -38,20 +38,20 @@ export component Home inherits VerticalLayout {
3838
}
3939
}
4040

41-
// if Store.current-tab-index == TabIndex.Transcribe: TranscribePanel {
42-
// height: parent.height;
43-
//
44-
// init => {
45-
// Logic.startup-transcribe-init();
46-
// }
47-
// }
48-
//
49-
// if Store.current-tab-index == TabIndex.ShareScreen: ShareScreenPanel {
50-
// width: parent.width;
51-
// height: parent.height;
52-
//
53-
// init => {
54-
// Logic.startup-share-screen-init();
55-
// }
56-
// }
41+
if Store.current-tab-index == TabIndex.Transcribe: TranscribePanel {
42+
height: parent.height;
43+
44+
init => {
45+
Logic.startup-transcribe-init();
46+
}
47+
}
48+
49+
if Store.current-tab-index == TabIndex.ShareScreen: ShareScreenPanel {
50+
width: parent.width;
51+
height: parent.height;
52+
53+
init => {
54+
Logic.startup-share-screen-init();
55+
}
56+
}
5757
}

wayshot/ui/panel/desktop/transcribe/list-item.slint

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ export component SubtitleListItem inherits Rectangle {
190190

191191
subtitle-vbox := VerticalLayout {
192192
padding: Theme.padding * 2;
193+
padding-top: 0;
193194
spacing: entry.correction-text.is-empty ? 0 : Theme.spacing * 2;
194195

195196
HorizontalLayout {
@@ -202,6 +203,7 @@ export component SubtitleListItem inherits Rectangle {
202203
wrap: word-wrap;
203204
text-color: Theme.primary-text-color;
204205
allow-breaking-text-binding-when-edit: false;
206+
font-size: Theme.default-font-size + 2px;
205207

206208
accepted(text) => {
207209
self.is-edit = false;
@@ -239,6 +241,7 @@ export component SubtitleListItem inherits Rectangle {
239241

240242
Label {
241243
text: entry.correction-text;
244+
font-size: Theme.default-font-size + 2px;
242245
wrap: word-wrap;
243246
}
244247
}

0 commit comments

Comments
 (0)