idk attempt to add ffmpeg?

This commit is contained in:
Chris Cochrun 2023-03-30 15:31:43 -05:00
parent 469837ca8e
commit 609d2af90b
4 changed files with 210 additions and 31 deletions

158
Cargo.lock generated
View file

@ -8,6 +8,26 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bindgen"
version = "0.64.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4"
dependencies = [
"bitflags",
"cexpr",
"clang-sys",
"lazy_static",
"lazycell",
"peeking_take_while",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
"syn",
]
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.3.2" version = "1.3.2"
@ -23,6 +43,15 @@ dependencies = [
"jobserver", "jobserver",
] ]
[[package]]
name = "cexpr"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
dependencies = [
"nom",
]
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.0" version = "1.0.0"
@ -38,6 +67,17 @@ dependencies = [
"once_cell", "once_cell",
] ]
[[package]]
name = "clang-sys"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f"
dependencies = [
"glob",
"libc",
"libloading",
]
[[package]] [[package]]
name = "codespan-reporting" name = "codespan-reporting"
version = "0.11.1" version = "0.11.1"
@ -236,6 +276,31 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
[[package]]
name = "ffmpeg-sys-the-third"
version = "1.1.1+ffmpeg-6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94a4b2e9c02074c0ee85661b23b3ac849bad6afc554b503c183975f5e2e0d3de"
dependencies = [
"bindgen",
"cc",
"libc",
"num_cpus",
"pkg-config",
"vcpkg",
]
[[package]]
name = "ffmpeg-the-third"
version = "1.2.2+ffmpeg-6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "301c55f432cce71d0cc5266e8e70e69cc7a865f8aa8785c44cb56c3935a13715"
dependencies = [
"bitflags",
"ffmpeg-sys-the-third",
"libc",
]
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.8" version = "0.2.8"
@ -247,12 +312,27 @@ dependencies = [
"wasi", "wasi",
] ]
[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.12.3" version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.9.2" version = "1.9.2"
@ -287,12 +367,34 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "lazycell"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.138" version = "0.2.138"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
[[package]]
name = "libloading"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
dependencies = [
"cfg-if",
"winapi",
]
[[package]] [[package]]
name = "libre-presenter" name = "libre-presenter"
version = "0.1.0" version = "0.1.0"
@ -304,6 +406,7 @@ dependencies = [
"cxx-qt-build", "cxx-qt-build",
"cxx-qt-lib", "cxx-qt-lib",
"dirs", "dirs",
"ffmpeg-the-third",
"serde", "serde",
"serde_derive", "serde_derive",
] ]
@ -345,12 +448,34 @@ dependencies = [
"minimal-lexical", "minimal-lexical",
] ]
[[package]]
name = "num_cpus"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
dependencies = [
"hermit-abi",
"libc",
]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.16.0" version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "pkg-config"
version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.47" version = "1.0.47"
@ -399,6 +524,27 @@ dependencies = [
"thiserror", "thiserror",
] ]
[[package]]
name = "regex"
version = "1.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.12" version = "1.0.12"
@ -440,6 +586,12 @@ dependencies = [
"yaml-rust", "yaml-rust",
] ]
[[package]]
name = "shlex"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.105" version = "1.0.105"
@ -498,6 +650,12 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]] [[package]]
name = "versions" name = "versions"
version = "4.1.0" version = "4.1.0"

View file

@ -22,6 +22,7 @@ cxx-qt = "0.5.0"
cxx-qt-lib = "0.5.0" cxx-qt-lib = "0.5.0"
# home = "0.5.4" # home = "0.5.4"
dirs = "5.0.0" dirs = "5.0.0"
ffmpeg-the-third = "1.2.2"
# cxx-qt-build generates C++ code from the `#[cxx_qt::bridge]` module # cxx-qt-build generates C++ code from the `#[cxx_qt::bridge]` module
# and compiles it together with the Rust static library # and compiles it together with the Rust static library

View file

@ -266,7 +266,7 @@ FocusScope {
cacheBuffer: 800 cacheBuffer: 800
reuseItems: true reuseItems: true
clip: true clip: true
model: SlideModel model: SlideMod
delegate: Presenter.PreviewSlideListDelegate { showVidBG: false } delegate: Presenter.PreviewSlideListDelegate { showVidBG: false }
Kirigami.WheelHandler { Kirigami.WheelHandler {

View file

@ -105,6 +105,16 @@ mod slide_model {
// } // }
// } // }
#[qinvokable]
pub fn video_thumbnail(
mut self: Pin<&mut Self>,
video: QString,
service_item_id: i32,
index: i32,
) -> QString {
QString::default()
}
#[qinvokable] #[qinvokable]
pub fn clear(mut self: Pin<&mut Self>) { pub fn clear(mut self: Pin<&mut Self>) {
unsafe { unsafe {
@ -396,46 +406,56 @@ mod slide_model {
if !idx.is_valid() { if !idx.is_valid() {
return qvariantmap; return qvariantmap;
} }
let rn = self.as_ref().role_names();
let rn_iter = rn.iter();
if let Some(slide) = self.rust().slides.get(index as usize) { if let Some(slide) = self.rust().slides.get(index as usize) {
qvariantmap.insert(QString::from("text"), QVariant::from(&slide.text)); for i in rn_iter {
qvariantmap.insert(QString::from("type"), QVariant::from(&slide.ty)); qvariantmap.insert(
qvariantmap.insert(QString::from("audio"), QVariant::from(&slide.audio)); QString::from(&i.1.to_string()),
qvariantmap.insert( self.as_ref().data(&idx, *i.0),
QString::from("imageBackground"), );
QVariant::from(&slide.image_background), }
); // qvariantmap.insert(QString::from("text"), QVariant::from(&slide.text));
qvariantmap.insert( // qvariantmap.insert(QString::from("type"), QVariant::from(&slide.ty));
QString::from("videoBackground"), // qvariantmap.insert(QString::from("audio"), QVariant::from(&slide.audio));
QVariant::from(&slide.video_background), // qvariantmap.insert(
); // QString::from("imageBackground"),
qvariantmap.insert(QString::from("font"), QVariant::from(&slide.font)); // QVariant::from(&slide.image_background),
qvariantmap.insert(QString::from("fontSize"), QVariant::from(&slide.font_size)); // );
qvariantmap.insert( // qvariantmap.insert(
QString::from("horizontalTextAlignment"), // QString::from("videoBackground"),
QVariant::from(&slide.htext_alignment), // QVariant::from(&slide.video_background),
); // );
qvariantmap.insert( // qvariantmap.insert(QString::from("font"), QVariant::from(&slide.font));
QString::from("verticalTextAlignment"), // qvariantmap.insert(QString::from("fontSize"), QVariant::from(&slide.font_size));
QVariant::from(&slide.vtext_alignment), // qvariantmap.insert(
); // QString::from("horizontalTextAlignment"),
qvariantmap.insert( // QVariant::from(&slide.htext_alignment),
QString::from("serviceItemId"), // );
QVariant::from(&slide.service_item_id), // qvariantmap.insert(
); // QString::from("verticalTextAlignment"),
qvariantmap.insert(QString::from("loop"), QVariant::from(&slide.looping)); // QVariant::from(&slide.vtext_alignment),
qvariantmap.insert(QString::from("active"), QVariant::from(&slide.active)); // );
qvariantmap.insert(QString::from("selected"), QVariant::from(&slide.selected)); // qvariantmap.insert(
// QString::from("serviceItemId"),
// QVariant::from(&slide.service_item_id),
// );
// qvariantmap.insert(QString::from("loop"), QVariant::from(&slide.looping));
// qvariantmap.insert(QString::from("active"), QVariant::from(&slide.active));
// qvariantmap.insert(QString::from("selected"), QVariant::from(&slide.selected));
}; };
qvariantmap qvariantmap
} }
#[qinvokable] #[qinvokable]
pub fn activate(mut self: Pin<&mut Self>, index: i32) -> bool { pub fn activate(mut self: Pin<&mut Self>, index: i32) -> bool {
for i in self.as_ref().rust().slides.iter() { for i in self.as_mut().slides_mut().iter_mut() {
println!("idk"); println!("slide is deactivating {:?}", i);
i.active = false;
} }
if let Some(slide) = self.as_mut().slides_mut().get_mut(index as usize) { if let Some(slide) = self.as_mut().slides_mut().get_mut(index as usize) {
slide.active = true; slide.active = true;
println!("slide is activating {:?}", slide);
true true
} else { } else {
false false