1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
use serde::{Deserialize, Serialize};
#[macro_use]
extern crate serde_derive; use std::net::SocketAddr;
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub enum KitProfile {
Local {
video: VideoOutputParams,
audio: AudioOutputParams,
input: Vec<InputProfile>,
},
WebRtc {
video: VideoOutputParams,
audio: AudioOutputParams,
input: Vec<InputProfile>,
signalling_socket: SocketAddr,
connection_id: String,
video_encoder: VideoEncoder,
framerate: (i32, i32),
},
}
impl KitProfile {
pub fn video(&self) -> &VideoOutputParams {
use crate::KitProfile::*;
match self {
Local { ref video, .. } => video,
WebRtc { ref video, .. } => video,
}
}
pub fn video_mut(&mut self) -> &mut VideoOutputParams {
use crate::KitProfile::*;
match self {
Local { ref mut video, .. } => video,
WebRtc { ref mut video, .. } => video,
}
}
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub enum VideoEncoder {
Vp8Enc,
VaapiVp8Enc,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct VideoOutputParams {
pub display: VideoDisplayParams,
pub head_mount: HeadMountParams,
pub render_texture_size: [u32; 2],
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct VideoDisplayParams {
pub width_px: u32,
pub height_px: u32,
pub width_m: f32,
pub height_m: f32,
pub bottom_bezel_offset_m: f32,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct HeadMountParams {
pub screen_lens_distance_m: f32,
pub inter_lens_distance_m: f32,
pub fov_angle_degrees: f32,
pub tray_lens_distance_m: f32,
pub pincushion_distortion_coefficients: Vec<f32>,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub enum InputProfile {
Gyroscope {},
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct AudioOutputParams {}