feat: add mpv sidecar IPC and Tauri commands
Persistent BufReader + request_id matching for correct event handling. Audio-file passed during loadfile for frame-accurate sync. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,27 @@
|
||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
#[tauri::command]
|
||||
fn greet(name: &str) -> String {
|
||||
format!("Hello, {}! You've been greeted from Rust!", name)
|
||||
}
|
||||
mod mpv;
|
||||
mod commands;
|
||||
|
||||
use commands::MpvState;
|
||||
use mpv::Mpv;
|
||||
use std::sync::Mutex;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.invoke_handler(tauri::generate_handler![greet])
|
||||
.manage(MpvState(Mutex::new(Mpv::new())))
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
commands::mpv_start,
|
||||
commands::mpv_stop,
|
||||
commands::mpv_load,
|
||||
commands::mpv_seek,
|
||||
commands::mpv_pause,
|
||||
commands::mpv_resume,
|
||||
commands::mpv_set_loop,
|
||||
commands::mpv_clear_loop,
|
||||
commands::mpv_time_pos,
|
||||
commands::mpv_duration,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user