diff --git a/src/input/mpegts/satip/satip.c b/src/input/mpegts/satip/satip.c index 663d0128..2f7dedd9 100644 --- a/src/input/mpegts/satip/satip.c +++ b/src/input/mpegts/satip/satip.c @@ -633,12 +633,12 @@ static void satip_discovery_http_closed(http_client_t *hc, int errn) { satip_discovery_t *d = hc->hc_aux; - char *s, *p; + char *s; htsmsg_t *xml = NULL, *tags, *root, *device; const char *friendlyname, *manufacturer, *manufacturerURL, *modeldesc; const char *modelname, *modelnum, *serialnum; const char *presentation, *tunercfg, *udn, *uuid; - const char *cs, *upc; + const char *cs, *arg; satip_device_info_t info; char errbuf[100]; char *argv[10]; @@ -735,18 +735,17 @@ satip_discovery_http_closed(http_client_t *hc, int errn) 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); - if ((i = atoi(p + 5)) > 0 && i < 128) - info.srcs = i; - } + arg = http_arg_get(&hc->hc_args, "X-SATIP-RTSP-Port"); + if (arg) { + i = atoi(arg); + if (i > 0 && i < 65535) + info.rtsp_port = i; + } + arg = http_arg_get(&hc->hc_args, "X-SATIP-Sources"); + if (arg) { + i = atoi(arg); + if (i > 0 && i < 128) + info.srcs = i; } info.myaddr = strdup(d->myaddr); diff --git a/src/satip/server.c b/src/satip/server.c index e0778e9d..59b3fb4b 100644 --- a/src/satip/server.c +++ b/src/satip/server.c @@ -55,7 +55,7 @@ satip_server_http_xml(http_connection_t *hc) 11\n\ \n\ urn:ses-com:device:SatIPServer:1\n\ -TVHeadend\n\ +TVHeadend%s\n\ TVHeadend Team\n\ http://tvheadend.org\n\ TVHeadend %s\n\ @@ -64,7 +64,7 @@ satip_server_http_xml(http_connection_t *hc) http://tvheadend.org\n\ 123456\n\ uuid:%s\n\ -TVHeadend %s {{{RTSP:%d;SRCS:%d}}}\n\ +TVHeadend %s\n\ \n\ \n\ image/png\n\ @@ -100,11 +100,12 @@ satip_server_http_xml(http_connection_t *hc) \n\ \n" - char buf[sizeof(MSG) + 1024]; + char buf[sizeof(MSG) + 1024], buf2[16]; char *devicelist = NULL; htsbuf_queue_t q; mpegts_network_t *mn; int dvbt = 0, dvbs = 0, dvbc = 0, srcs = 0, delim = 0, i; + http_arg_list_t args; htsbuf_queue_init(&q, 0); @@ -152,10 +153,13 @@ satip_server_http_xml(http_connection_t *hc) buf, dvbt + dvbs + dvbc ? "tuner settings - global config" : "network assignment"); } + buf2[0] = '\0'; + if (satip_server_rtsp_port != 554) + snprintf(buf2, sizeof(buf2), ":%d", satip_server_rtsp_port); + snprintf(buf, sizeof(buf), MSG, - tvheadend_version, + buf2, tvheadend_version, satip_server_uuid, tvheadend_version, - satip_server_rtsp_port, srcs, http_server_ip, http_server_port, http_server_ip, http_server_port, http_server_ip, http_server_port, @@ -165,7 +169,16 @@ satip_server_http_xml(http_connection_t *hc) free(devicelist); - http_send_header(hc, 200, "text/xml", strlen(buf), 0, NULL, 10, 0, NULL, NULL); + http_arg_init(&args); + snprintf(buf2, sizeof(buf2), "%d", satip_server_rtsp_port); + http_arg_set(&args, "X-SATIP-RTSP-Port", buf2); + if (srcs) { + snprintf(buf2, sizeof(buf2), "%d", srcs); + http_arg_set(&args, "X-SATIP-Sources", buf2); + } + http_send_header(hc, 200, "text/xml", strlen(buf), 0, NULL, 10, 0, NULL, &args); + http_arg_flush(&args); + tvh_write(hc->hc_fd, buf, strlen(buf)); return 0;