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 {}