Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SAT>IP: handle SRCS pass (for DVB-S) in server and client
  • Loading branch information
perexg committed Mar 11, 2015
1 parent a87aae0 commit 1c9b527
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
9 changes: 8 additions & 1 deletion src/input/mpegts/satip/satip.c
Expand Up @@ -418,6 +418,7 @@ satip_device_create( satip_device_info_t *info )
ASSIGN(tunercfg);
#undef ASSIGN
sd->sd_info.rtsp_port = info->rtsp_port;
sd->sd_info.srcs = info->srcs;

/*
* device specific hacks
Expand Down Expand Up @@ -732,13 +733,19 @@ satip_discovery_http_closed(http_client_t *hc, int errn)
goto finish;

info.rtsp_port = 554;
info.srcs = 4;

upc = htsmsg_xml_get_cdata_str(device, "UPC");
if (upc && (s = strstr(upc, "{{{")) != NULL &&
strcmp(s + strlen(s) - 3, "}}}") == 0) {
if ((p = strstr(s, "RTSP:")) != NULL) {
if ((i = atoi(p + 5)) > 0 && i < 65535)
info.rtsp_port = i;
}
if ((p = strstr(s, "SRCS:")) != NULL) {
i = atoi(p + 5);
info.rtsp_port = i;
if ((i = atoi(p + 5)) > 0 && i < 128)
info.srcs = i;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/input/mpegts/satip/satip_frontend.c
Expand Up @@ -1716,7 +1716,7 @@ satip_frontend_create
char id[16], lname[256];
satip_frontend_t *lfe;
uint32_t master = 0;
int i, def_positions = 4;
int i, def_positions = sd->sd_info.srcs;

/* Override type */
snprintf(id, sizeof(id), "override #%d", num);
Expand Down
1 change: 1 addition & 0 deletions src/input/mpegts/satip/satip_private.h
Expand Up @@ -54,6 +54,7 @@ struct satip_device_info
char *presentation;
char *tunercfg; /*< XML urn:ses-com:satipX_SATIPCAP contents */
int rtsp_port;
int srcs;
};

struct satip_device
Expand Down
6 changes: 5 additions & 1 deletion src/satip/rtsp.c
Expand Up @@ -35,6 +35,7 @@ typedef struct session {
int stream;
int frontend;
int findex;
int src;
uint32_t nsession;
char session[9];
dvb_mux_conf_t dmc;
Expand Down Expand Up @@ -294,7 +295,7 @@ rtsp_start(http_connection_t *hc, session_t *rs, char *addrbuf)
LIST_FOREACH(mn, &mpegts_network_all, mn_global_link) {
ln = (dvb_network_t *)mn;
if (ln->ln_type == rs->dmc.dmc_fe_type &&
mn->mn_satip_source == rs->findex)
mn->mn_satip_source == rs->src)
break;
}
if (mn) {
Expand Down Expand Up @@ -650,6 +651,8 @@ rtsp_process_play(http_connection_t *hc, int setup)
mtype = mtype_to_tvh(hc);
if (mtype == DVB_MOD_NONE) goto error;

src = 1;

if (msys == DVB_SYS_DVBS || msys == DVB_SYS_DVBS2) {

src = atoi(http_arg_get_remove(&hc->hc_req_args, "src"));
Expand Down Expand Up @@ -746,6 +749,7 @@ rtsp_process_play(http_connection_t *hc, int setup)
if (stream_id == 0)
stream_id++;
rs->stream = stream_id % 0x7fff;
rs->src = src;

memset(&rs->udp_rtp, 0, sizeof(rs->udp_rtp));
memset(&rs->udp_rtcp, 0, sizeof(rs->udp_rtcp));
Expand Down
12 changes: 8 additions & 4 deletions src/satip/server.c
Expand Up @@ -104,7 +104,7 @@ satip_server_http_xml(http_connection_t *hc)
char *devicelist = NULL;
htsbuf_queue_t q;
mpegts_network_t *mn;
int dvbt = 0, dvbs = 0, dvbc = 0, delim = 0, i;
int dvbt = 0, dvbs = 0, dvbc = 0, srcs = 0, delim = 0, i;

htsbuf_queue_init(&q, 0);

Expand All @@ -114,9 +114,11 @@ satip_server_http_xml(http_connection_t *hc)
continue;
if (idnode_is_instance(&mn->mn_id, &dvb_network_dvbt_class))
dvbt++;
else if (idnode_is_instance(&mn->mn_id, &dvb_network_dvbs_class))
else if (idnode_is_instance(&mn->mn_id, &dvb_network_dvbs_class)) {
dvbs++;
else if (idnode_is_instance(&mn->mn_id, &dvb_network_dvbc_class))
if (srcs < mn->mn_satip_source)
srcs = mn->mn_satip_source;
} else if (idnode_is_instance(&mn->mn_id, &dvb_network_dvbc_class))
dvbc++;
}
if (dvbt && (i = config_get_int("satip_dvbt", 0)) > 0) {
Expand All @@ -138,6 +140,8 @@ satip_server_http_xml(http_connection_t *hc)
dvbc = 0;
}
pthread_mutex_unlock(&global_lock);
if (!dvbs)
srcs = 0;

devicelist = htsbuf_to_string(&q);
htsbuf_queue_flush(&q);
Expand All @@ -151,7 +155,7 @@ satip_server_http_xml(http_connection_t *hc)
snprintf(buf, sizeof(buf), MSG,
tvheadend_version, tvheadend_version,
satip_server_uuid, tvheadend_version,
satip_server_rtsp_port, dvbs,
satip_server_rtsp_port, srcs,
http_server_ip, http_server_port,
http_server_ip, http_server_port,
http_server_ip, http_server_port,
Expand Down

0 comments on commit 1c9b527

Please sign in to comment.