feat: ffprobe for stream checking, drop overlay using webview

This commit is contained in:
2025-07-13 13:59:40 -05:00
parent 7fcb3e3f7c
commit 2e03281a79
9 changed files with 182 additions and 249 deletions

11
src-tauri/Cargo.lock generated
View File

@@ -343,6 +343,7 @@ checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
name = "byte-me"
version = "0.1.0"
dependencies = [
"ffprobe",
"serde",
"serde_json",
"tauri",
@@ -938,6 +939,16 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "ffprobe"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ffef835e1f9ac151db5bb2adbb95c9dfe1f315f987f011dd89cd655b4e9a52c"
dependencies = [
"serde",
"serde_json",
]
[[package]]
name = "field-offset"
version = "0.3.6"

View File

@@ -22,4 +22,5 @@ tauri = { version = "2", features = [] }
tauri-plugin-opener = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
ffprobe = "0.4.0"

View File

@@ -1,14 +1,34 @@
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
use std::path::Path;
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
fn has_streams(paths: Vec<String>) -> Result<Vec<bool>, String> {
let mut results = Vec::with_capacity(paths.len());
for path_str in paths {
let path = Path::new(&path_str);
if !path.is_file() {
results.push(false);
continue;
}
match ffprobe::ffprobe(&path_str) {
Ok(info) => {
dbg!(info);
results.push(true);
},
Err(err) => {
eprintln!("Could not analyze file with ffprobe: {:?}", err);
results.push(false);
}
}
}
Ok(results)
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.invoke_handler(tauri::generate_handler![greet])
.invoke_handler(tauri::generate_handler![has_streams])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}