From 22faabe30c07598d0c3aeaed3b861d8f94e6ac0f Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 3 Oct 2014 00:35:36 +0200 Subject: reflector works now --- src/options.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/options.c') diff --git a/src/options.c b/src/options.c index e6101aa..7d03d1d 100644 --- a/src/options.c +++ b/src/options.c @@ -81,6 +81,8 @@ static void options_defaults(options_t* opt) opt->rtp_port_base_ = 5000; opt->rtp_addr_local_ = NULL; opt->rtp_port_base_local_ = 5000; + opt->rtp_host_reflector_ = NULL; + opt->rtp_port_base_reflector_ = 6000; opt->auto_client_ = TRUE; opt->timeout_ = 30; opt->keepalive_int_ = 10; @@ -165,6 +167,10 @@ static GOptionGroup* options_get_rtp_group(options_t* opt) "local address to bind to", "ADDRESS" }, { "rtp-port-base-local", 'O', 0, G_OPTION_ARG_INT, &opt->rtp_port_base_local_, "base number for local ports to bind to", "PORT" }, + { "rtp-host-reflector", 0, 0, G_OPTION_ARG_STRING, &opt->rtp_host_reflector_, + "remote host where incoming RTP packets should be reflected to - receiver mode only!", "HOST" }, + { "rtp-port-base-reflector", 0, 0, G_OPTION_ARG_INT, &opt->rtp_port_base_reflector_, + "base number for ports where incoming RTP packets should be reflected to - receiver mode only!", "PORT" }, { "no-auto-client", 'c', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &opt->auto_client_, "disable auto-detection for clients (aka. ignore incoming keepalives) - sender mode only!", NULL }, { "timeout", 't', 0, G_OPTION_ARG_INT, &opt->timeout_, @@ -294,7 +300,8 @@ int options_parse(options_t* opt, int argc, char* argv[]) static int options_parse_post(options_t* opt) { if(opt->rtp_port_base_ < 1 || opt->rtp_port_base_ > 65535 || - opt->rtp_port_base_local_ < 1 || opt->rtp_port_base_local_ > 65535) { + opt->rtp_port_base_local_ < 1 || opt->rtp_port_base_local_ > 65535 || + opt->rtp_port_base_reflector_ < 1 || opt->rtp_port_base_reflector_ > 65535) { printf("ERROR: Failed to initialize: rtp port is invalid\n"); return -2; } @@ -321,6 +328,11 @@ static int options_parse_post(options_t* opt) " not what you intended - please check your configuration.\n\n"); } + if(opt->mode_ == SENDER && opt->rtp_host_reflector_) { + printf("WARNING: The mode of operation is set to sender and the RTP packet reflector has a remote\n" \ + " host configured. Mind that in sender mode the reflector will not be used!\n\n"); + } + if(opt->debug_) { opt->daemonize_ = 0; g_strfreev(opt->log_targets_); @@ -368,6 +380,7 @@ void options_clear(options_t* opt) g_free(opt->audio_dec_); g_free(opt->rtp_host_); g_free(opt->rtp_addr_local_); + g_free(opt->rtp_host_reflector_); g_free(opt->preview_videosink_); g_free(opt->video_enc_rec_); g_free(opt->audio_enc_rec_); @@ -433,6 +446,8 @@ void options_print(options_t* opt) printf(" rtp_port_base: %d\n", opt->rtp_port_base_); printf(" rtp_addr_local: >>%s<<\n", opt->rtp_addr_local_); printf(" rtp_port_base_local: %d\n", opt->rtp_port_base_local_); + printf(" rtp_host_reflector: >>%s<<\n", opt->rtp_host_reflector_); + printf(" rtp_port_base_reflector: %d\n", opt->rtp_port_base_reflector_); printf(" auto_client: %s\n", opt->auto_client_ ? "true" : "false"); printf(" timeout: %d\n", opt->timeout_); printf(" keepalive_int: %d\n", opt->keepalive_int_); -- cgit v1.2.3