Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SAT>IP Client: Add RTSP port detection based on the UPC string (TVhea…
…dend specific server)
  • Loading branch information
perexg committed Mar 11, 2015
1 parent da6eb2c commit a87aae0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
16 changes: 14 additions & 2 deletions src/input/mpegts/satip/satip.c
Expand Up @@ -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
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions src/input/mpegts/satip/satip_frontend.c
Expand Up @@ -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;
Expand Down Expand Up @@ -1367,7 +1368,8 @@ satip_frontend_input_thread ( void *aux )
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);
Expand Down
1 change: 1 addition & 0 deletions src/input/mpegts/satip/satip_private.h
Expand Up @@ -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
Expand Down

0 comments on commit a87aae0

Please sign in to comment.