From 30ab8142ddfea4a3d8d66c94b3147006b2d793a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Thu, 21 May 2020 12:42:44 -0300 Subject: [PATCH] helper: Add check if rtsp is enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- src/helper.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/helper.rs b/src/helper.rs index 14b21e78..e11b851d 100644 --- a/src/helper.rs +++ b/src/helper.rs @@ -56,15 +56,18 @@ Example of valid arguments: ); if cfg!(feature = "gst") { - matches = matches.arg( - clap::Arg::with_name("pipeline") - .long("pipeline") - .value_name("GSTREAMER_PIPELINE") - .help("Gstreamer pipeline that ends with a sink type.") - .takes_value(true) - .conflicts_with_all(&["pipeline-rtsp", "port"]) - .default_value("videotestsrc ! video/x-raw,width=640,height=480 ! videoconvert ! x264enc ! rtph264pay ! udpsink host=0.0.0.0 port=5600"), - ) + let mut arg = clap::Arg::with_name("pipeline") + .long("pipeline") + .value_name("GSTREAMER_PIPELINE") + .help("Gstreamer pipeline that ends with a sink type.") + .takes_value(true) + .conflicts_with_all(&["pipeline-rtsp", "port"]); + + if !cfg!(feature = "rtsp") { + arg = arg.default_value("videotestsrc ! video/x-raw,width=640,height=480 ! videoconvert ! x264enc ! rtph264pay ! udpsink host=0.0.0.0 port=5600"); + } + // Needs: https://github.com/clap-rs/clap/issues/1406 + matches = matches.arg(arg); } if cfg!(feature = "rtsp") {