chore: scaffold Rust workspace and native GPUI shell
Rust checks / checks (push) Successful in 3m35s
Rust checks / checks (push) Successful in 3m35s
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
//! Recorder settings and state shared with the desktop interface.
|
||||
|
||||
mod settings;
|
||||
mod status;
|
||||
|
||||
pub use settings::{Settings, VideoCodec};
|
||||
pub use status::RecordingStatus;
|
||||
@@ -0,0 +1,54 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/// The recorder will own these transitions once capture is implemented.
|
||||
///
|
||||
/// A game being detected or permission being granted is insufficient to enter
|
||||
/// Recording: a usable capture source and successful output must be confirmed.
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq)]
|
||||
pub enum RecordingStatus {
|
||||
#[default]
|
||||
Idle,
|
||||
WaitingForCapture,
|
||||
Starting,
|
||||
Recording,
|
||||
Failed {
|
||||
reason: String,
|
||||
},
|
||||
}
|
||||
|
||||
impl RecordingStatus {
|
||||
pub fn label(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Idle => "Not recording",
|
||||
Self::WaitingForCapture => "Waiting for capture",
|
||||
Self::Starting => "Starting",
|
||||
Self::Recording => "Recording",
|
||||
Self::Failed { .. } => "Recording failed",
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user