From: Jaroslav Kysela Date: Sat, 28 Feb 2015 15:41:50 +0000 (+0100) Subject: SAT>IP Client: Add RTSP port detection based on the UPC string (TVheadend specific... X-Git-Tag: v4.1~307 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a87aae0aafa26951fe4a4622d870a582d37c9351;p=thirdparty%2Ftvheadend.git SAT>IP Client: Add RTSP port detection based on the UPC string (TVheadend specific server) --- diff --git a/src/input/mpegts/satip/satip.c b/src/input/mpegts/satip/satip.c index 49d9bfb44..58a4cfc9a 100644 --- a/src/input/mpegts/satip/satip.c +++ b/src/input/mpegts/satip/satip.c @@ -417,6 +417,7 @@ satip_device_create( satip_device_info_t *info ) ASSIGN(presentation); ASSIGN(tunercfg); #undef ASSIGN + sd->sd_info.rtsp_port = info->rtsp_port; /* * device specific hacks @@ -631,12 +632,12 @@ static void satip_discovery_http_closed(http_client_t *hc, int errn) { satip_discovery_t *d = hc->hc_aux; - char *s; + char *s, *p; 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; + const char *cs, *upc; satip_device_info_t info; char errbuf[100]; char *argv[10]; @@ -730,6 +731,17 @@ satip_discovery_http_closed(http_client_t *hc, int errn) if (uuid == NULL || (d->uuid[0] && strcmp(uuid, d->uuid))) goto finish; + info.rtsp_port = 554; + + 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) { + i = atoi(p + 5); + info.rtsp_port = i; + } + } + info.myaddr = strdup(d->myaddr); info.addr = strdup(d->url.host); info.uuid = strdup(uuid); diff --git a/src/input/mpegts/satip/satip_frontend.c b/src/input/mpegts/satip/satip_frontend.c index f36f0d424..eecf0bd24 100644 --- a/src/input/mpegts/satip/satip_frontend.c +++ b/src/input/mpegts/satip/satip_frontend.c @@ -1042,7 +1042,8 @@ satip_frontend_extra_shutdown efd = tvhpoll_create(1); rtsp = http_client_connect(lfe, RTSP_VERSION_1_0, "rstp", - lfe->sf_device->sd_info.addr, 554, + lfe->sf_device->sd_info.addr, + lfe->sf_device->sd_info.rtsp_port, satip_frontend_bindaddr(lfe)); if (rtsp == NULL) goto done; @@ -1367,7 +1368,8 @@ new_tune: i = 0; if (!rtsp) { rtsp = http_client_connect(lfe, RTSP_VERSION_1_0, "rstp", - lfe->sf_device->sd_info.addr, 554, + lfe->sf_device->sd_info.addr, + lfe->sf_device->sd_info.rtsp_port, satip_frontend_bindaddr(lfe)); if (rtsp == NULL) { satip_frontend_tuning_error(lfe, tr); diff --git a/src/input/mpegts/satip/satip_private.h b/src/input/mpegts/satip/satip_private.h index 43cc1ff62..324587bae 100644 --- a/src/input/mpegts/satip/satip_private.h +++ b/src/input/mpegts/satip/satip_private.h @@ -53,6 +53,7 @@ struct satip_device_info char *serialnum; char *presentation; char *tunercfg; /*< XML urn:ses-com:satipX_SATIPCAP contents */ + int rtsp_port; }; struct satip_device