use serde::{Serialize, Deserialize}; use serde_repr::*; use uuid::Uuid; #[derive(Default, Debug, Serialize, Deserialize, Clone)] pub struct WUnit { pub id: Uuid, pub description: WDesc, pub status: EStatus } impl WUnit { pub fn new(id: Uuid, description: WDesc) -> Self { WUnit { id: id, description: description, status: EStatus::Queued } } } #[derive(Default, Debug, Serialize, Deserialize, Clone)] pub struct WDesc { pub file_url: String, pub file_name: String, pub priority: u16, pub length: u32, pub options: EOptions, } impl WDesc { pub fn new(file_url: &str, file_name: &str, priority: Option, length: u32, options: Option) -> Self { WDesc { file_url: file_url.to_string(), file_name: file_name.to_string(), priority: priority.unwrap_or(0), length: length, options: options.unwrap_or(EOptions::default()), } } } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct EOptions { pub ffmpeg: String, pub aomenc: String, pub two_pass: bool } impl Default for EOptions { fn default() -> Self { EOptions{ ffmpeg: String::default(), aomenc: "--lag-in-frames=25 --tile-columns=0 --tile-rows=0 --enable-fwd-kf=1 --bit-depth=10 --cpu-used=3 --cq-level=30 --end-usage=q".to_string(), two_pass: false } } } #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] pub enum EStatus { Queued, Reserved(String), Completed(String), Cancelled, Error(String) } impl Default for EStatus { fn default() -> Self { EStatus::Queued } }