AV1Master/src/workunit.rs

82 lines
1.6 KiB
Rust
Raw Normal View History

2020-03-25 02:14:49 +01:00
use std::path::PathBuf;
2020-03-25 22:30:22 +01:00
use serde::{Serialize, Deserialize};
2020-03-25 02:14:49 +01:00
2020-03-25 22:30:22 +01:00
#[derive(Default, Debug, Serialize, Deserialize)]
2020-03-25 02:14:49 +01:00
pub struct WUnit {
file_name: PathBuf,
priority: u16,
length: u32,
options: EOptions,
status: EStatus
}
2020-03-25 22:30:22 +01:00
#[derive(Debug, Serialize, Deserialize)]
2020-03-25 02:14:49 +01:00
struct EOptions {
mode: EMode,
resolution: Resolution,
color_depth: EColorDepth,
enable_fwd_keyframe: bool,
kf_min_dist: Option<u16>,
kf_max_dist: Option<u16>,
two_pass: bool,
speed: u8
}
impl Default for EOptions {
fn default() -> Self {
EOptions{
mode: EMode::default(),
resolution: Resolution::default(),
color_depth: EColorDepth::default(),
enable_fwd_keyframe: true,
kf_min_dist: Option::default(),
kf_max_dist: Option::default(),
two_pass: false,
speed: 3
}
}
}
2020-03-25 22:30:22 +01:00
#[derive(Debug, Serialize, Deserialize)]
2020-03-25 02:14:49 +01:00
enum EMode {
// Quality (CRF), Constrained Quality, Variable Bitrate, Constant Bitrate
Q(u8),
CQ(u8),
VBR(u32),
CBR(u32)
}
impl Default for EMode {
fn default() -> Self {
EMode::Q(30)
}
}
2020-03-25 22:30:22 +01:00
#[derive(Default, Debug, Serialize, Deserialize)]
2020-03-25 02:14:49 +01:00
struct Resolution {
width: Option<u16>,
height: Option<u16>
}
2020-03-25 22:30:22 +01:00
#[derive(Debug, Serialize, Deserialize)]
2020-03-25 02:14:49 +01:00
enum EColorDepth {
Eight = 8,
Ten = 10,
Twelve = 12
}
impl Default for EColorDepth {
fn default() -> Self {
EColorDepth::Ten
}
}
2020-03-25 22:30:22 +01:00
#[derive(Debug, Serialize, Deserialize)]
2020-03-25 02:14:49 +01:00
enum EStatus {
Queued,
Reserved,
Completed
}
impl Default for EStatus {
fn default() -> Self {
EStatus::Queued
}
}