mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +02:00
✨ feat: Add streaming support (#125)
This adds: - [x] Keyboard and mouse handling on the frontend - [x] Video and audio streaming from the backend to the frontend - [x] Input server that works with Websockets Update - 17/11 - [ ] Master docker container to run this - [ ] Steam runtime - [ ] Entrypoint.sh --------- Co-authored-by: Kristian Ollikainen <14197772+DatCaptainHorse@users.noreply.github.com> Co-authored-by: Kristian Ollikainen <DatCaptainHorse@users.noreply.github.com>
This commit is contained in:
59
packages/server/src/args/app_args.rs
Normal file
59
packages/server/src/args/app_args.rs
Normal file
@@ -0,0 +1,59 @@
|
||||
pub struct AppArgs {
|
||||
/// Verbose output mode
|
||||
pub verbose: bool,
|
||||
/// Debug the pipeline by showing a window on host
|
||||
pub debug_feed: bool,
|
||||
/// Debug the latency by showing time in stream
|
||||
pub debug_latency: bool,
|
||||
|
||||
/// Virtual display resolution
|
||||
pub resolution: (u32, u32),
|
||||
/// Virtual display framerate
|
||||
pub framerate: u32,
|
||||
|
||||
/// Nestri relay url
|
||||
pub relay_url: String,
|
||||
/// Nestri room name/identifier
|
||||
pub room: String,
|
||||
}
|
||||
impl AppArgs {
|
||||
pub fn from_matches(matches: &clap::ArgMatches) -> Self {
|
||||
Self {
|
||||
verbose: matches.get_one::<String>("verbose").unwrap() == "true"
|
||||
|| matches.get_one::<String>("verbose").unwrap() == "1",
|
||||
debug_feed: matches.get_one::<String>("debug-feed").unwrap() == "true"
|
||||
|| matches.get_one::<String>("debug-feed").unwrap() == "1",
|
||||
debug_latency: matches.get_one::<String>("debug-latency").unwrap() == "true"
|
||||
|| matches.get_one::<String>("debug-latency").unwrap() == "1",
|
||||
resolution: {
|
||||
let res = matches.get_one::<String>("resolution").unwrap().clone();
|
||||
let parts: Vec<&str> = res.split('x').collect();
|
||||
(
|
||||
parts[0].parse::<u32>().unwrap(),
|
||||
parts[1].parse::<u32>().unwrap(),
|
||||
)
|
||||
},
|
||||
framerate: matches
|
||||
.get_one::<String>("framerate")
|
||||
.unwrap()
|
||||
.parse::<u32>()
|
||||
.unwrap(),
|
||||
relay_url: matches.get_one::<String>("relay-url").unwrap().clone(),
|
||||
// Generate random room name if not provided
|
||||
room: matches.get_one::<String>("room")
|
||||
.unwrap_or(&rand::random::<u32>().to_string())
|
||||
.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn debug_print(&self) {
|
||||
println!("AppArgs:");
|
||||
println!("> verbose: {}", self.verbose);
|
||||
println!("> debug_feed: {}", self.debug_feed);
|
||||
println!("> debug_latency: {}", self.debug_latency);
|
||||
println!("> resolution: {}x{}", self.resolution.0, self.resolution.1);
|
||||
println!("> framerate: {}", self.framerate);
|
||||
println!("> relay_url: {}", self.relay_url);
|
||||
println!("> room: {}", self.room);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user