some basics of video times - unfinished
This commit is contained in:
parent
0a895e1f04
commit
70040c5149
3 changed files with 23 additions and 17 deletions
|
@ -62,12 +62,13 @@ Item {
|
|||
Component.onCompleted: mpvLoadingTimer.start()
|
||||
onFileLoaded: {
|
||||
/* showPassiveNotification(videoSource + " has been loaded"); */
|
||||
if (itemType == "song")
|
||||
if (itemType == "song") {
|
||||
mpv.setProperty("loop", "inf");
|
||||
else if (vidLoop)
|
||||
} else if (vidLoop) {
|
||||
mpv.setProperty("loop", "inf");
|
||||
else
|
||||
} else {
|
||||
mpv.setProperty("loop", "no");
|
||||
}
|
||||
/* showPassiveNotification(mpv.getProperty("loop")); */
|
||||
mpv.setProperty("sid", "no");
|
||||
|
||||
|
@ -88,6 +89,7 @@ Item {
|
|||
interval: 100
|
||||
onTriggered: {
|
||||
/* showPassiveNotification("YIPPEEE!") */
|
||||
mpv.stop();
|
||||
if (vidStartTime > 0 && vidStartTime < vidEndTime) {
|
||||
/* mpv.seek(vidStartTime); */
|
||||
let start = "+" + vidStartTime;
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::process::Command;
|
|||
use std::str;
|
||||
use tracing::debug;
|
||||
|
||||
pub fn bg_from_video(video: &Path) -> PathBuf {
|
||||
pub async fn bg_from_video(video: &Path) -> PathBuf {
|
||||
let video = PathBuf::from(video);
|
||||
debug!(?video);
|
||||
let mut data_dir = dirs::data_local_dir().unwrap();
|
||||
|
|
|
@ -318,25 +318,29 @@ impl slide_model::SlideModel {
|
|||
vector_roles
|
||||
.append(self.get_role(SlideRoles::VideoThumbnail));
|
||||
|
||||
let model_index =
|
||||
&self.index(index, 0, &QModelIndex::default());
|
||||
let thread = self.qt_thread();
|
||||
let model_index = &self.as_ref().index(index, 0, &QModelIndex::default());
|
||||
if let Some(slide) =
|
||||
self.as_mut().rust_mut().slides.get_mut(index as usize)
|
||||
{
|
||||
if !slide.video_background.is_empty() {
|
||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let path =
|
||||
PathBuf::from(slide.video_background.to_string());
|
||||
runtime.spawn(async move {
|
||||
let video = ffmpeg::bg_from_video(&path).await;
|
||||
let video = QString::from(
|
||||
ffmpeg::bg_from_video(&path).to_str().unwrap(),
|
||||
)
|
||||
.insert(0, &QString::from("file://"))
|
||||
.to_owned();
|
||||
video.to_str().unwrap()
|
||||
).insert(0, &QString::from("file://")).to_owned();
|
||||
slide.video_thumbnail = video;
|
||||
self.as_mut().data_changed(
|
||||
thread.queue(move |mut slide|
|
||||
slide.as_mut().data_changed(
|
||||
model_index,
|
||||
model_index,
|
||||
&vector_roles,
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue