tauri_plugin_libmpv/
models.rs

1use indexmap::IndexMap;
2use serde::{Deserialize, Serialize};
3use std::ffi::{c_char, c_void};
4use tauri::{AppHandle, Runtime};
5
6use crate::wrapper::MpvHandle;
7
8#[derive(Debug, Clone, Copy)]
9pub struct MpvInstance {
10    pub handle: *mut MpvHandle,
11    pub event_userdata: *mut c_void,
12}
13
14unsafe impl Send for MpvInstance {}
15unsafe impl Sync for MpvInstance {}
16
17#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
18#[serde(rename_all = "camelCase")]
19pub struct MpvConfig {
20    #[serde(default)]
21    pub initial_options: IndexMap<String, serde_json::Value>,
22    #[serde(default)]
23    pub observed_properties: IndexMap<String, String>,
24}
25
26#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
27pub struct VideoMarginRatio {
28    pub left: Option<f64>,
29    pub right: Option<f64>,
30    pub top: Option<f64>,
31    pub bottom: Option<f64>,
32}
33
34#[derive(Debug, Clone)]
35pub struct EventUserData<R: Runtime> {
36    pub app: AppHandle<R>,
37    pub free_fn: unsafe extern "C" fn(*mut c_char),
38    pub window_label: String,
39}
40
41#[derive(Debug, Serialize, Deserialize)]
42pub struct FfiResponse {
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub data: Option<serde_json::Value>,
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub error: Option<String>,
47}