@@ -12,6 +12,7 @@ use std::{
1212 time:: { Duration , SystemTime } ,
1313} ;
1414use video_editor:: {
15+ media:: media_type:: MediaType ,
1516 project:: {
1617 project:: { ProjectPreviewConfig , Resolution as ProjectPreviewResolution } ,
1718 recent:: RecentFile ,
@@ -56,7 +57,6 @@ impl From<Manager> for UIVideoEditorTracksManager {
5657impl From < Track > for UIVideoEditorTrack {
5758 fn from ( track : Track ) -> Self {
5859 match track {
59- // TODO: 获取截图
6060 Track :: Video ( inner) => UIVideoEditorTrack {
6161 name : if inner. name . is_empty ( ) {
6262 "V" . to_string ( ) . into ( )
@@ -263,6 +263,18 @@ impl From<UIVideoEditorPreviewConfig> for ProjectPreviewConfig {
263263 }
264264}
265265
266+ impl From < MediaType > for UIVideoEditorTrackType {
267+ fn from ( media_type : MediaType ) -> UIVideoEditorTrackType {
268+ match media_type {
269+ MediaType :: Video => UIVideoEditorTrackType :: Video ,
270+ MediaType :: Audio => UIVideoEditorTrackType :: Audio ,
271+ MediaType :: Image => UIVideoEditorTrackType :: Overlay ,
272+ MediaType :: Subtitle => UIVideoEditorTrackType :: Subtitle ,
273+ MediaType :: Text => UIVideoEditorTrackType :: Overlay ,
274+ }
275+ }
276+ }
277+
266278pub fn segment_left_screenshot ( seg : & Segment ) -> slint:: Image {
267279 seg. first_frame_image ( )
268280 . ok ( )
@@ -291,10 +303,6 @@ pub fn segment_right_screenshot(seg: &Segment) -> slint::Image {
291303 . unwrap_or_default ( )
292304}
293305
294- fn millis_to_duration ( millis : i32 ) -> Duration {
295- Duration :: from_millis ( millis as u64 )
296- }
297-
298306fn duration_to_millis ( duration : Duration ) -> i32 {
299307 duration. as_millis ( ) as i32
300308}
0 commit comments