static char *rtsp_ip = NULL;
static char *rtsp_nat_ip = NULL;
static int rtsp_port = -1;
+static int rtsp_nat_port = -1;
static int rtsp_descramble = 1;
static int rtsp_rewrite_pmt = 0;
static int rtsp_muxcnf = MUXCNF_AUTO;
rtsp_check_urlbase(char *u)
{
char *p, *s;
+ int t;
if (*u == '/' || strncmp(u, "stream=", 7) == 0)
return u;
*p = '\0';
if ((s = strchr(u, ':')) != NULL) {
*s = '\0';
- if (atoi(s + 1) != rtsp_port)
- return NULL;
+ t = atoi(s + 1);
+ if (t != rtsp_port) {
+ if (rtsp_nat_port <= 0 || t != rtsp_nat_port)
+ return NULL;
+ }
} else {
#if 0 /* VLC is broken */
if (rtsp_port != 554)
*/
void satip_server_rtsp_init
(const char *bindaddr, int port, int descramble, int rewrite_pmt, int muxcnf,
- const char *nat_ip)
+ const char *nat_ip, int nat_port)
{
static tcp_server_ops_t ops = {
.start = rtsp_serve,
s = rtsp_nat_ip;
rtsp_nat_ip = nat_ip ? strdup(nat_ip) : NULL;
free(s);
+ rtsp_nat_port = nat_port;
if (!rtsp_server)
rtsp_server = tcp_server_create(LS_SATIPS, "SAT>IP RTSP", bindaddr, port, &ops, NULL);
if (reg)
pthread_mutex_lock(&global_lock);
rtsp_server = NULL;
rtsp_port = -1;
+ rtsp_nat_port = -1;
free(rtsp_ip);
free(rtsp_nat_ip);
rtsp_ip = rtsp_nat_ip = NULL;
.opts = PO_EXPERT,
.group = 1,
},
+ {
+ .type = PT_INT,
+ .id = "satip_nat_rtsp",
+ .name = N_("External RTSP port (NAT)"),
+ .desc = N_("Enter external PORT if behind Forwarding redirection."
+ "(0 = use the same local port)."),
+ .off = offsetof(struct satip_server_conf, satip_nat_rtsp),
+ .opts = PO_EXPERT,
+ .group = 1,
+ },
{
.type = PT_BOOL,
.id = "satip_nom3u",
char http_ip[128];
int descramble, rewrite_pmt, muxcnf;
char *nat_ip;
+ int nat_port;
if (satip_server_rtsp_port <= 0)
return;
rewrite_pmt = satip_server_conf.satip_rewrite_pmt;
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;
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);
+ satip_server_rtsp_init(http_server_ip, satip_server_rtsp_port, descramble, rewrite_pmt, muxcnf, nat_ip, nat_port);
satip_server_info(prefix, descramble, muxcnf);
if (announce)
int satip_atsc_t;
int satip_atsc_c;
char *satip_nat_ip;
+ int satip_nat_rtsp;
};
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 *nat_ip);
+ const char *nat_ip, int nat_port);
void satip_server_rtsp_register(void);
void satip_server_rtsp_done(void);