tauri_plugin_ffmpeg/
models.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Deserialize, Serialize)]
4#[serde(rename_all = "camelCase")]
5pub struct PingRequest {
6  pub value: Option<String>,
7}
8
9#[derive(Debug, Clone, Default, Deserialize, Serialize)]
10#[serde(rename_all = "camelCase")]
11pub struct PingResponse {
12  pub value: Option<String>,
13}
14
15/// Media type enum
16#[derive(Debug, Clone, Deserialize, Serialize)]
17#[serde(rename_all = "lowercase")]
18pub enum MediaType {
19  Video,
20  Audio,
21}
22
23/// Transcode request
24#[derive(Debug, Clone, Deserialize, Serialize)]
25#[serde(rename_all = "camelCase")]
26pub struct TranscodeRequest {
27  /// Input file path
28  pub input_path: String,
29  /// Output file path
30  pub output_path: String,
31  /// Media type (video or audio)
32  pub media_type: MediaType,
33  /// FFmpeg path (optional, for desktop)
34  pub ffmpeg_path: Option<String>,
35}
36
37/// Transcode result
38#[derive(Debug, Clone, Deserialize, Serialize)]
39#[serde(rename_all = "camelCase")]
40pub struct TranscodeResult {
41  /// Whether the transcode was successful
42  pub success: bool,
43  /// Output file path
44  pub output_path: String,
45  /// Error message if failed
46  pub error: Option<String>,
47}
48
49/// Progress event payload
50#[derive(Debug, Clone, Deserialize, Serialize)]
51#[serde(rename_all = "camelCase")]
52pub struct ProgressPayload {
53  /// Progress percentage (0-100), -1 means error
54  pub progress: i32,
55  /// Current processing time in milliseconds
56  pub current_time_ms: Option<i64>,
57  /// Total duration in milliseconds
58  pub total_duration_ms: Option<i64>,
59}