Files
clipbin-desktop/crates/clipbin-core/src/settings.rs
T
harry eb364d25e2
Rust checks / checks (push) Successful in 3m35s
chore: scaffold Rust workspace and native GPUI shell
2026-10-08 12:19:45 +02:00

55 lines
1.5 KiB
Rust

use std::{fmt, time::Duration};
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub enum VideoCodec {
#[default]
H264,
Hevc,
Av1,
}
impl fmt::Display for VideoCodec {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(match self {
Self::H264 => "H.264",
Self::Hevc => "HEVC",
Self::Av1 => "AV1",
})
}
}
/// In-memory defaults from SPEC.md. Persistence and editing come with the recorder.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Settings {
pub width: u32,
pub height: u32,
pub frames_per_second: u32,
pub codec: VideoCodec,
pub system_audio_enabled: bool,
pub microphone_enabled: bool,
pub start_on_login: bool,
pub clip_duration: Duration,
pub bookmark_before: Duration,
pub bookmark_after: Duration,
/// Protected bookmarks and exported clips are excluded from this limit.
pub unprotected_session_limit_bytes: u64,
}
impl Default for Settings {
fn default() -> Self {
Self {
width: 1920,
height: 1080,
frames_per_second: 60,
codec: VideoCodec::H264,
system_audio_enabled: true,
microphone_enabled: false,
start_on_login: true,
clip_duration: Duration::from_secs(120),
bookmark_before: Duration::from_secs(120),
bookmark_after: Duration::from_secs(30),
unprotected_session_limit_bytes: 50_000_000_000,
}
}
}