The gate minor "field docs on the mirrored bridge structs" was answered with `#![allow(missing_docs)]` on `bridge` and `studio_bridge`, and the crate's comment said 400 or so fields. The two modules have 559 pub fields; 210 carried a comment of the .slint files and 349 (288 and 61) had none there. Each of those is described now, from the code that fills it (the producers in the view model and in voelin-ui, the settings keys' own documentation, the gateway protocol's types), and the allow is gone: `#![warn(missing_docs)]` holds for the whole crate and clippy -D warnings fails on a field without a comment (checked by deleting one). docs/ui.md and lib.rs give the real numbers. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
257 lines
7.8 KiB
Rust
257 lines
7.8 KiB
Rust
//! The Stream Studio's structs: the plain counterparts of
|
||
//! `crates/voelin-ui/ui/studio-bridge.slint`, as [`crate::bridge`] has those of
|
||
//! `bridge.slint`. As there, every field is documented.
|
||
|
||
use std::sync::Arc;
|
||
|
||
use crate::image::ImageRef;
|
||
|
||
/// A scene of the studio.
|
||
#[derive(Clone, Debug, Default, PartialEq)]
|
||
pub struct StudioScene {
|
||
/// The scene's id.
|
||
pub id: i32,
|
||
/// The scene's name.
|
||
pub name: Arc<str>,
|
||
/// Its sources, front first: "Screen + Camera + Text".
|
||
pub detail: Arc<str>,
|
||
/// Composited now (the live scene).
|
||
pub live: bool,
|
||
/// The kind of its front-most source (for the icon).
|
||
pub kind: Arc<str>,
|
||
}
|
||
|
||
/// A source of the live scene, front first.
|
||
#[derive(Clone, Debug, Default, PartialEq)]
|
||
pub struct StudioSource {
|
||
/// The source's id in its scene.
|
||
pub id: i32,
|
||
/// The source's name.
|
||
pub name: Arc<str>,
|
||
/// screen, window, portal, camera, image, text, colour, pattern
|
||
pub kind: Arc<str>,
|
||
/// It is shown in the output.
|
||
pub visible: bool,
|
||
/// It cannot be moved, resized or cropped.
|
||
pub locked: bool,
|
||
/// keep, blur, image, colour
|
||
pub background: Arc<str>,
|
||
/// Why it shows nothing ("" while it works).
|
||
pub error: Arc<str>,
|
||
/// "1920×1080 · 60 fps"
|
||
pub info: Arc<str>,
|
||
/// At the front or the back (cannot move further).
|
||
pub front: bool,
|
||
/// At the back; it cannot move further.
|
||
pub back: bool,
|
||
}
|
||
|
||
/// An audio source of the stream (`stream.audio_sources`).
|
||
#[derive(Clone, Debug, Default, PartialEq)]
|
||
pub struct StudioAudio {
|
||
/// The source's name.
|
||
pub name: Arc<str>,
|
||
/// "Elgato Wave:3", the application...
|
||
pub detail: Arc<str>,
|
||
/// microphone, desktop, app, window, tone
|
||
pub kind: Arc<str>,
|
||
/// Its gain in dB.
|
||
pub gain_db: f32,
|
||
/// It is muted in the mix.
|
||
pub muted: bool,
|
||
/// The meter in dBFS, after the gain.
|
||
pub level: f32,
|
||
/// Why it captures nothing.
|
||
pub error: Arc<str>,
|
||
}
|
||
|
||
/// A simulcast layer (`stream.layers`) as typed: any numbers.
|
||
#[derive(Clone, Debug, Default, PartialEq)]
|
||
pub struct StudioLayer {
|
||
/// "1280x720"; empty: `scale` of the output.
|
||
pub size: Arc<str>,
|
||
/// The factor on the output's size when `size` is empty.
|
||
pub scale: Arc<str>,
|
||
/// Frame-rate cap; empty: the output's.
|
||
pub fps: Arc<str>,
|
||
/// kbit/s.
|
||
pub bitrate: Arc<str>,
|
||
/// kbit/s a viewer needs for this layer.
|
||
pub min_bitrate: Arc<str>,
|
||
}
|
||
|
||
/// A viewer of the studio's stream.
|
||
#[derive(Clone, Debug, Default, PartialEq)]
|
||
pub struct StudioViewer {
|
||
/// The viewer's client id.
|
||
pub client: i32,
|
||
/// The viewer's name.
|
||
pub name: Arc<str>,
|
||
/// requested, connecting, connected
|
||
pub state: Arc<str>,
|
||
}
|
||
|
||
/// An entry of a picker (screens, windows, cameras, audio sources).
|
||
#[derive(Clone, Debug, Default, PartialEq)]
|
||
pub struct StudioPick {
|
||
/// The entry's name.
|
||
pub name: Arc<str>,
|
||
/// The line under the name.
|
||
pub detail: Arc<str>,
|
||
/// For the icon: monitor, window, portal, camera, microphone, desktop, app, tone
|
||
pub kind: Arc<str>,
|
||
/// The application's own icon (audio), if it has one.
|
||
pub icon: ImageRef,
|
||
/// Already mixed in (audio): picking it again takes it out.
|
||
pub selected: bool,
|
||
}
|
||
|
||
/// The header, the preview's badges and the bottom bar.
|
||
#[derive(Clone, Debug, Default, PartialEq)]
|
||
pub struct StudioStatus {
|
||
/// The engine runs (preview, mixer, replay buffer).
|
||
pub running: bool,
|
||
/// "Chill Zone • Starfall Community"; empty without a destination.
|
||
pub destination: Arc<str>,
|
||
/// 0: not live, 1: poor, 2: fair, 3: good, 4: excellent.
|
||
pub quality: i32,
|
||
/// The words for `quality`.
|
||
pub quality_text: Arc<str>,
|
||
/// "1080p • 60 FPS • 8,250 kbps"
|
||
pub format: Arc<str>,
|
||
/// The numbers behind it, for the info button.
|
||
pub details: Arc<str>,
|
||
/// The stream is live.
|
||
pub live: bool,
|
||
/// Going live: waiting for the server.
|
||
pub starting: bool,
|
||
/// "00:12:34"
|
||
pub elapsed: Arc<str>,
|
||
/// How many watch the stream.
|
||
pub viewers: i32,
|
||
/// How many viewers the stream has, those who only asked included.
|
||
pub participants: i32,
|
||
/// Go Live is possible.
|
||
pub can_go_live: bool,
|
||
/// Why Go Live is off, or what goes wrong.
|
||
pub hint: Arc<str>,
|
||
/// A recording runs.
|
||
pub recording: bool,
|
||
/// How long the recording runs: "00:12:34".
|
||
pub recorded: Arc<str>,
|
||
/// The replay buffer's window (0: off) and what it holds now.
|
||
pub replay_seconds: i32,
|
||
/// What the replay buffer holds now: "30 s".
|
||
pub replay_held: Arc<str>,
|
||
/// The output's width in pixels.
|
||
pub output_width: i32,
|
||
/// The output's height in pixels.
|
||
pub output_height: i32,
|
||
/// The output's frame rate.
|
||
pub fps: i32,
|
||
/// The studio is in a window of its own.
|
||
pub detached: bool,
|
||
/// A window of its own is possible (not on Android).
|
||
pub can_detach: bool,
|
||
/// The live scene shows a screen, a camera, a window (the phone's cards).
|
||
pub screen_shown: bool,
|
||
/// The live scene shows a camera.
|
||
pub camera_shown: bool,
|
||
/// The live scene shows a window.
|
||
pub window_shown: bool,
|
||
}
|
||
|
||
/// The stream settings panel (`studio.stream`, `stream.bitrate_kbps`).
|
||
#[derive(Clone, Debug, Default, PartialEq)]
|
||
pub struct StudioForm {
|
||
/// Index into the destinations offered (channels to stream to); -1: none.
|
||
pub destination: i32,
|
||
/// The stream's title.
|
||
pub title: Arc<str>,
|
||
/// Game or category: it follows the title in the stream's name.
|
||
pub game: Arc<str>,
|
||
/// Sent to the channel's chat when the stream goes live.
|
||
pub message: Arc<str>,
|
||
/// The viewers are an overlay in the live scene.
|
||
pub show_viewers: bool,
|
||
/// The stream chat's last lines are an overlay.
|
||
pub show_chat: bool,
|
||
/// The title and the game are an overlay.
|
||
pub show_now_playing: bool,
|
||
/// The stream carries the mixer's sources; off: none.
|
||
pub audio: bool,
|
||
/// kbit/s of the stream without layers, as typed.
|
||
pub bitrate: Arc<str>,
|
||
}
|
||
|
||
/// The source properties dialog (also for adding text, colour and image
|
||
/// sources: `id` -1). Numbers as typed.
|
||
#[derive(Clone, Debug, Default, PartialEq)]
|
||
pub struct StudioSourceForm {
|
||
/// The source's id; -1: a new one.
|
||
pub id: i32,
|
||
/// The source's name.
|
||
pub name: Arc<str>,
|
||
/// screen, window, portal, camera, image, text, colour or pattern.
|
||
pub kind: Arc<str>,
|
||
/// The left edge in output pixels.
|
||
pub x: Arc<str>,
|
||
/// The top edge in output pixels.
|
||
pub y: Arc<str>,
|
||
/// Empty: the source's own size times `scale`.
|
||
pub width: Arc<str>,
|
||
/// As `width`, for the height.
|
||
pub height: Arc<str>,
|
||
/// The factor on the source's own size, where `width` or `height` is empty.
|
||
pub scale: Arc<str>,
|
||
/// contain, cover, stretch
|
||
pub fit: Arc<str>,
|
||
/// Pixels cut off the source's left edge.
|
||
pub crop_left: Arc<str>,
|
||
/// Pixels cut off its top edge.
|
||
pub crop_top: Arc<str>,
|
||
/// Pixels cut off its right edge.
|
||
pub crop_right: Arc<str>,
|
||
/// Pixels cut off its bottom edge.
|
||
pub crop_bottom: Arc<str>,
|
||
/// Percent.
|
||
pub opacity: f32,
|
||
/// It cannot be moved, resized or cropped.
|
||
pub locked: bool,
|
||
/// It is shown in the output.
|
||
pub visible: bool,
|
||
/// keep, blur, image, colour
|
||
pub background: Arc<str>,
|
||
/// Blur radius in percent of the picture's height.
|
||
pub blur: Arc<str>,
|
||
/// The picture behind the source, for the background `image`.
|
||
pub background_path: Arc<str>,
|
||
/// The colour behind the source, for the background `colour`.
|
||
pub background_colour: Arc<str>,
|
||
/// Text, colour ("#rrggbb" or "#rrggbbaa") and image sources.
|
||
pub text: Arc<str>,
|
||
/// The text's size in pixels.
|
||
pub text_size: Arc<str>,
|
||
/// The text's or the colour source's colour.
|
||
pub colour: Arc<str>,
|
||
/// The image source's file.
|
||
pub path: Arc<str>,
|
||
/// The camera picture is mirrored.
|
||
pub mirror: bool,
|
||
}
|
||
|
||
/// The studio settings dialog (`studio.*` keys and the preview).
|
||
#[derive(Clone, Debug, Default, PartialEq)]
|
||
pub struct StudioSettingsForm {
|
||
/// Seconds the replay buffer keeps; 0: off.
|
||
pub replay_seconds: Arc<str>,
|
||
/// MiB of the replay buffer kept in memory.
|
||
pub replay_memory: Arc<str>,
|
||
/// The folder of recordings and clips; empty: the default.
|
||
pub recording_dir: Arc<str>,
|
||
/// The preview's width in pixels.
|
||
pub preview_width: Arc<str>,
|
||
/// The preview's frame rate.
|
||
pub preview_fps: Arc<str>,
|
||
}
|