Skip to main content

pinray_core/
source.rs

1#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2pub struct SourceId(pub String);
3
4impl SourceId {
5    pub fn new(value: impl Into<String>) -> Self {
6        Self(value.into())
7    }
8}
9
10#[derive(Debug, Clone, PartialEq, Eq)]
11pub struct DisplaySource {
12    pub id: SourceId,
13    pub name: String,
14    pub width: u32,
15    pub height: u32,
16    pub scale_factor_milli: u32,
17    pub is_primary: bool,
18}
19
20#[derive(Debug, Clone, PartialEq, Eq)]
21pub struct WindowSource {
22    pub id: SourceId,
23    pub title: String,
24    pub app_name: Option<String>,
25}
26
27#[derive(Debug, Clone, PartialEq, Eq)]
28pub struct AudioDeviceSource {
29    pub id: SourceId,
30    pub name: String,
31    pub is_default: bool,
32}
33
34#[derive(Debug, Clone, PartialEq, Eq)]
35pub enum CaptureSource {
36    Display(DisplaySource),
37    Window(WindowSource),
38    SystemAudio(AudioDeviceSource),
39    Microphone(AudioDeviceSource),
40}