-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(whipinto/whepfrom): use cargo bin
- Loading branch information
Showing
9 changed files
with
155 additions
and
116 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use clap::{ArgAction, Parser}; | ||
use tracing::Level; | ||
|
||
const SCHEME_RTSP_SERVER: &str = "rtsp-listen"; | ||
|
||
#[derive(Parser)] | ||
#[command(author, version, about, long_about = None)] | ||
struct Args { | ||
/// Verbose mode [default: "warn", -v "info", -vv "debug", -vvv "trace"] | ||
#[arg(short = 'v', action = ArgAction::Count, default_value_t = 0)] | ||
verbose: u8, | ||
/// rtsp://[username]:[password]@[ip]:[port]/[stream] Or <stream.sdp> | ||
#[arg(short, long, default_value_t = format!("{}://0.0.0.0:8555", SCHEME_RTSP_SERVER))] | ||
output: String, | ||
/// Set Listener address | ||
#[arg(long)] | ||
host: Option<String>, | ||
/// The WHEP server endpoint to POST SDP offer to. e.g.: https://example.com/whep/777 | ||
#[arg(short, long)] | ||
whep: String, | ||
/// Authentication token to use, will be sent in the HTTP Header as 'Bearer ' | ||
#[arg(short, long)] | ||
token: Option<String>, | ||
/// Run a command as childprocess | ||
#[arg(long)] | ||
command: Option<String>, | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let args = Args::parse(); | ||
|
||
utils::set_log(format!( | ||
"whepfrom={},webrtc=error", | ||
match args.verbose { | ||
0 => Level::WARN, | ||
1 => Level::INFO, | ||
2 => Level::DEBUG, | ||
_ => Level::TRACE, | ||
} | ||
)); | ||
|
||
whepfrom::whepfrom( | ||
args.output.clone(), | ||
args.host.clone(), | ||
args.whep.clone(), | ||
args.token.clone(), | ||
args.command.clone(), | ||
) | ||
.await | ||
.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use clap::{ArgAction, Parser}; | ||
use tracing::Level; | ||
|
||
const SCHEME_RTSP_SERVER: &str = "rtsp-listen"; | ||
|
||
#[derive(Parser)] | ||
#[command(author, version, about, long_about = None)] | ||
struct Args { | ||
/// Verbose mode [default: "warn", -v "info", -vv "debug", -vvv "trace"] | ||
#[arg(short = 'v', action = ArgAction::Count, default_value_t = 0)] | ||
verbose: u8, | ||
/// rtsp://[username]:[password]@[ip]:[port]/[stream] Or <stream.sdp> | ||
#[arg(short, long, default_value_t = format!("{}://0.0.0.0:8554", SCHEME_RTSP_SERVER))] | ||
input: String, | ||
/// Set Listener address | ||
#[arg(long)] | ||
host: Option<String>, | ||
/// The WHIP server endpoint to POST SDP offer to. e.g.: https://example.com/whip/777 | ||
#[arg(short, long)] | ||
whip: String, | ||
/// Authentication token to use, will be sent in the HTTP Header as 'Bearer ' | ||
#[arg(short, long)] | ||
token: Option<String>, | ||
/// Run a command as childprocess | ||
#[arg(long)] | ||
command: Option<String>, | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let args = Args::parse(); | ||
|
||
utils::set_log(format!( | ||
"whipinto={},webrtc=error", | ||
match args.verbose { | ||
0 => Level::WARN, | ||
1 => Level::INFO, | ||
2 => Level::DEBUG, | ||
_ => Level::TRACE, | ||
} | ||
)); | ||
|
||
whipinto::whipinto( | ||
args.input.clone(), | ||
args.host.clone(), | ||
args.whip.clone(), | ||
args.token.clone(), | ||
args.command.clone(), | ||
) | ||
.await | ||
.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.