static uint16_t stream_id;
static char *rtsp_ip = NULL;
static char *rtsp_nat_ip = NULL;
+static char *rtp_src_ip = NULL;
static int rtsp_port = -1;
static int rtsp_nat_port = -1;
static int rtsp_descramble = 1;
!rs->rtp_udp_bound) {
if (udp_bind_double(&rs->udp_rtp, &rs->udp_rtcp,
LS_SATIPS, "rtsp", "rtcp",
- rtsp_ip, 0, NULL,
+ (rtp_src_ip != NULL && rtp_src_ip[0] != '\0') ? rtp_src_ip : rtsp_ip, 0, NULL,
4*1024, 4*1024,
RTP_BUFSIZE, RTCP_BUFSIZE)) {
errcode = HTTP_STATUS_INTERNAL;
*/
void satip_server_rtsp_init
(const char *bindaddr, int port, int descramble, int rewrite_pmt, int muxcnf,
- const char *nat_ip, int nat_port)
+ const char *rtp_src, const char *nat_ip, int nat_port)
{
static tcp_server_ops_t ops = {
.start = rtsp_serve,
rtsp_descramble = descramble;
rtsp_rewrite_pmt = rewrite_pmt;
rtsp_muxcnf = muxcnf;
+ s = rtp_src_ip;
+ rtp_src_ip = rtp_src ? strdup(rtp_src) : NULL;
+ free(s);
s = rtsp_nat_ip;
rtsp_nat_ip = nat_ip ? strdup(nat_ip) : NULL;
free(s);
rtsp_port = -1;
rtsp_nat_port = -1;
free(rtsp_ip);
+ free(rtp_src_ip);
free(rtsp_nat_ip);
- rtsp_ip = rtsp_nat_ip = NULL;
+ rtsp_ip = rtp_src_ip = rtsp_nat_ip = NULL;
satip_rtp_done();
pthread_mutex_unlock(&global_lock);
}
.opts = PO_EXPERT,
.group = 2,
},
+ {
+ .type = PT_STR,
+ .id = "satip_rtp_src_ip",
+ .name = N_("RTP Local bind IP address"),
+ .desc = N_("Bind RTP source address of the outgoing RTP packets "
+ "to specific local IP address "
+ "(empty = same IP as the listening RTSP; "
+ "0.0.0.0 = IP in network of default gateway; "
+ "or write here a valid local IP address)."),
+ .off = offsetof(struct satip_server_conf, satip_rtp_src_ip),
+ .opts = PO_EXPERT,
+ .group = 2,
+ },
struct sockaddr_storage http;
char http_ip[128];
int descramble, rewrite_pmt, muxcnf;
- char *nat_ip;
+ char *nat_ip, *rtp_src_ip;
int nat_port;
if (satip_server_rtsp_port <= 0)
muxcnf = satip_server_conf.satip_muxcnf;
nat_ip = strdup(satip_server_conf.satip_nat_ip ?: "");
nat_port = satip_server_conf.satip_nat_rtsp ?: satip_server_rtsp_port;
+ rtp_src_ip = strdup(satip_server_conf.satip_rtp_src_ip ?: "");
if (announce)
pthread_mutex_unlock(&global_lock);
pthread_mutex_lock(&satip_server_reinit);
- satip_server_rtsp_init(http_server_ip, satip_server_rtsp_port, descramble, rewrite_pmt, muxcnf, nat_ip, nat_port);
+ satip_server_rtsp_init(http_server_ip, satip_server_rtsp_port, descramble, rewrite_pmt, muxcnf, rtp_src_ip, nat_ip, nat_port);
satip_server_info(prefix, descramble, muxcnf);
if (announce)
pthread_mutex_lock(&global_lock);
free(nat_ip);
+ free(rtp_src_ip);
}
/*
char *satip_nat_ip;
int satip_nat_rtsp;
int satip_nat_name_force;
+ char *satip_rtp_src_ip;
};
extern struct satip_server_conf satip_server_conf;
void satip_server_rtsp_init(const char *bindaddr, int port,
int descramble, int rewrite_pmt, int muxcnf,
+ const char *rtp_src,
const char *nat_ip, int nat_port);
void satip_server_rtsp_register(void);
void satip_server_rtsp_done(void);