{
slave_subscription_t *sub;
+ if (rs->run) {
+ satip_rtp_close((void *)(intptr_t)rs->stream);
+ rs->run = 0;
+ }
if (rs->subs) {
while ((sub = LIST_FIRST(&rs->slaves)) != NULL)
rtsp_slave_remove(rs, (mpegts_service_t *)rs->subs->ths_service,
static int
rtsp_validate_service(mpegts_service_t *s)
{
+ int av = 0, enc = 0;
elementary_stream_t *st;
pthread_mutex_lock(&s->s_stream_mutex);
pthread_mutex_unlock(&s->s_stream_mutex);
return 0;
}
- TAILQ_FOREACH(st, &s->s_components, es_link)
+ TAILQ_FOREACH(st, &s->s_components, es_link) {
+ if (st->es_type == SCT_CA)
+ enc = 1;
if (st->es_pid > 0 &&
(SCT_ISVIDEO(st->es_type) || SCT_ISAUDIO(st->es_type)))
- break;
+ av = 1;
+ }
pthread_mutex_unlock(&s->s_stream_mutex);
- return st != NULL;
+ return enc && av;
}
/*
*/
static int
rtsp_start
- (http_connection_t *hc, session_t *rs, char *addrbuf, int newmux, int setup)
+ (http_connection_t *hc, session_t *rs, char *addrbuf,
+ int newmux, int setup, int oldrun)
{
mpegts_network_t *mn, *mn2;
dvb_network_t *ln;
}
}
if (mux == NULL && mn2) {
+ dvb_mux_conf_str(&rs->dmc, buf, sizeof(buf));
+ tvhwarn("satips", "%i/%s/%i: create mux %s",
+ rs->frontend, rs->session, rs->stream, buf);
mux = (dvb_mux_t *)
mn2->mn_create_mux(mn2, (void *)(intptr_t)rs->nsession,
MPEGTS_ONID_NONE, MPEGTS_TSID_NONE,
- &rs->dmc, 0);
+ &rs->dmc, 1);
if (mux)
created = 1;
}
if (mux == NULL) {
dvb_mux_conf_str(&rs->dmc, buf, sizeof(buf));
- tvhwarn("satips", "%i: unable to create mux %s", rs->frontend, buf);
+ tvhwarn("satips", "%i/%s/%i: unable to create mux %s",
+ rs->frontend, rs->session, rs->stream, buf);
goto endclean;
}
if (rs->mux == mux)
goto pids;
- if (rs->run)
- satip_rtp_close((void *)(intptr_t)rs->stream);
rtsp_clean(rs);
rs->mux = mux;
rs->mux_created = created;
http_arg_get(&hc->hc_args, "User-Agent"),
NULL);
if (!rs->subs)
- goto endrtp;
- if (rs->run) {
- /* restart streaming */
+ goto endclean;
+ /* retrigger play when new setup arrived */
+ if (oldrun) {
setup = 0;
rs->run = 0;
}
}
if (!setup && !rs->run) {
if (rs->mux == NULL)
- goto endrtp;
+ goto endclean;
satip_rtp_queue((void *)(intptr_t)rs->stream,
rs->subs, &rs->prch.prch_sq,
hc->hc_peer, rs->rtp_peer_port,
pthread_mutex_unlock(&global_lock);
return 0;
-endrtp:
- satip_rtp_close((void *)(intptr_t)rs->stream);
- rs->run = 0;
endclean:
rtsp_clean(rs);
pthread_mutex_unlock(&global_lock);
session_t *rs;
htsbuf_queue_t q;
char buf[96];
- int stream;
+ int stream, first = 1;
htsbuf_queue_init(&q, 0);
if (TAILQ_FIRST(&hc->hc_req_args))
goto error;
- if (hc->hc_session) {
- pthread_mutex_lock(&rtsp_lock);
- TAILQ_FOREACH(rs, &rtsp_sessions, link)
- if (rs->stream == stream)
- break;
- if (rs) {
- rtsp_describe_header(rs, &q);
- rtsp_describe_session(rs, &q);
+ pthread_mutex_lock(&rtsp_lock);
+ TAILQ_FOREACH(rs, &rtsp_sessions, link) {
+ if (hc->hc_session) {
+ if (strcmp(hc->hc_session, rs->session))
+ continue;
+ if (stream > 0 && rs->stream != stream)
+ continue;
}
- pthread_mutex_unlock(&rtsp_lock);
- if (rs == NULL) {
+ if (first) {
+ rtsp_describe_header(hc->hc_session ? rs : NULL, &q);
+ first = 0;
+ }
+ rtsp_describe_session(rs, &q);
+ }
+ pthread_mutex_unlock(&rtsp_lock);
+
+ if (first) {
+ if (hc->hc_session) {
http_error(hc, HTTP_STATUS_BAD_SESSION);
return 0;
}
- } else {
- pthread_mutex_lock(&rtsp_lock);
rtsp_describe_header(NULL, &q);
- TAILQ_FOREACH(rs, &rtsp_sessions, link)
- rtsp_describe_session(rs, &q);
- pthread_mutex_unlock(&rtsp_lock);
}
+
http_arg_init(&args);
if (hc->hc_session)
http_arg_set(&args, "Session", hc->hc_session);
rtsp_process_play(http_connection_t *hc, int setup)
{
session_t *rs;
- int errcode = HTTP_STATUS_BAD_REQUEST, r, findex = 0, valid;
+ int errcode = HTTP_STATUS_BAD_REQUEST, r, findex = 0, valid, oldrun = 0;
int stream, delsys = DVB_SYS_NONE, msys, fe, src, freq, pol, sr;
int fec, ro, plts, bw, tmode, mtype, gi, plp, t2id, sm, c2tft, ds, specinv;
char *u, *s;
delsys = rtsp_delsys(fe, &findex);
if (delsys == DVB_SYS_NONE)
goto error;
+ } else {
+ delsys = msys;
}
if (setup) {
if (delsys == DVB_SYS_NONE) goto error;
if (msys == DVB_SYS_NONE) goto error;
- if (!fe) goto error;
if (!valid) goto error;
if (!rs)
rs = rtsp_new_session(msys, 0, -1);
else if (stream != rs->stream)
rs = rtsp_new_session(msys, rs->nsession, stream);
- else
+ else {
+ oldrun = rs->run;
rtsp_close_session(rs);
+ }
r = parse_transport(hc);
if (r < 0) {
errcode = HTTP_STATUS_BAD_TRANSFER;
errcode = HTTP_STATUS_METHOD_INVALID;
goto error;
}
- rs->frontend = fe;
+ rs->frontend = fe > 0 ? fe : 1;
rs->rtp_peer_port = r;
dmc = &rs->dmc;
} else {
errcode = HTTP_STATUS_NOT_FOUND;
goto error;
}
+ oldrun = rs->run;
dmc = &rs->dmc;
if (rs->mux == NULL) goto error;
if (!fe) {
mpegts_pid_del_group(&rs->pids, &delpids);
if (addpids.count > 0)
mpegts_pid_add_group(&rs->pids, &addpids);
- if ((r = rtsp_start(hc, rs, addrbuf, valid, setup)) < 0) {
+ if ((r = rtsp_start(hc, rs, addrbuf, valid, setup, oldrun)) < 0) {
errcode = r;
goto error;
}
if (setup)
- tvhdebug("satips", "%i/%s/%d: setup from %s:%d, RTP: %d, RTCP: %d, pids ",
+ tvhdebug("satips", "%i/%s/%d: setup from %s:%d, RTP: %d, RTCP: %d",
rs->frontend, rs->session, rs->stream,
addrbuf, IP_PORT(*hc->hc_peer),
rs->rtp_peer_port, rs->rtp_peer_port + 1);
<manufacturerURL>http://tvheadend.org</manufacturerURL>\n\
<modelDescription>TVHeadend %s</modelDescription>\n\
<modelName>TVHeadend SAT>IP</modelName>\n\
-<modelNumber>1</modelNumber>\n\
-<modelURL>http://tvheadend.org</modelURL>\n\
+<modelNumber>1.0</modelNumber>\n\
+<modelURL></modelURL>\n\
<serialNumber>123456</serialNumber>\n\
<UDN>uuid:%s</UDN>\n\
-<UPC>TVHeadend %s</UPC>\n\
<iconList>\n\
<icon>\n\
<mimetype>image/png</mimetype>\n\
<url>http://%s:%d/static/satip-icon40.png</url>\n\
</icon>\n\
<icon>\n\
-<mimetype>image/jpg</mimetype>\n\
+<mimetype>image/jpeg</mimetype>\n\
<width>40</width>\n\
<height>40</height>\n\
<depth>16</depth>\n\
<url>http://%s:%d/static/satip-icon120.png</url>\n\
</icon>\n\
<icon>\n\
-<mimetype>image/jpg</mimetype>\n\
+<mimetype>image/jpeg</mimetype>\n\
<width>120</width>\n\
<height>120</height>\n\
<depth>16</depth>\n\
</device>\n\
</root>\n"
- char buf[sizeof(MSG) + 1024], buf2[16];
+ char buf[sizeof(MSG) + 1024], buf2[64];
char *devicelist = NULL;
htsbuf_queue_t q;
mpegts_network_t *mn;
} else if (idnode_is_instance(&mn->mn_id, &dvb_network_dvbc_class))
dvbc++;
}
- if (dvbt && (i = config_get_int("satip_dvbt", 0)) > 0) {
- htsbuf_qprintf(&q, "DVBT-%d", i);
- delim++;
- } else {
- dvbt = 0;
- }
if (dvbs && (i = config_get_int("satip_dvbs", 0)) > 0) {
htsbuf_qprintf(&q, "%sDVBS2-%d", delim ? "," : "", i);
delim++;
} else {
dvbs = 0;
}
+ if (dvbt && (i = config_get_int("satip_dvbt", 0)) > 0) {
+ htsbuf_qprintf(&q, "%sDVBT-%d", delim ? "," : "", i);
+ delim++;
+ } else {
+ dvbt = 0;
+ }
if (dvbc && (i = config_get_int("satip_dvbc", 0)) > 0) {
htsbuf_qprintf(&q, "%sDVBC-%d", delim ? "," : "", i);
delim++;
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(buf2, sizeof(buf2), ":%d %s", satip_server_rtsp_port, satip_server_uuid + 26);
+ else
+ snprintf(buf2, sizeof(buf2), " %s", satip_server_uuid + 26);
snprintf(buf, sizeof(buf), MSG,
buf2, tvheadend_version,
- satip_server_uuid, tvheadend_version,
+ satip_server_uuid,
http_server_ip, http_server_port,
http_server_ip, http_server_port,
http_server_ip, http_server_port,
free(devicelist);
http_arg_init(&args);
- snprintf(buf2, sizeof(buf2), "%d", satip_server_rtsp_port);
- http_arg_set(&args, "X-SATIP-RTSP-Port", buf2);
+ if (satip_server_rtsp_port != 554) {
+ 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);
if (http_tokenize(ptr, argv, 2, ':') == 2) {
if (strcmp(argv[0], "ST") == 0)
st = argv[1];
- else if (strcmp(argv[0], "HOST") == 0)
+ else if (strcasecmp(argv[0], "HOST") == 0)
host = argv[1];
- else if (strcmp(argv[0], "MAN") == 0)
+ else if (strcasecmp(argv[0], "MAN") == 0)
man = argv[1];
else if (strcmp(argv[0], "DEVICEID.SES.COM") == 0)
deviceid = argv[1];