static int
rtsp_start
(http_connection_t *hc, session_t *rs, char *addrbuf,
- int newmux, int setup, int oldstate)
+ int newmux, int cmd, int oldstate)
{
mpegts_network_t *mn, *mn2;
dvb_network_t *ln;
dvb_mux_conf_t dmc;
char buf[384];
int res = HTTP_STATUS_NOT_ALLOWED, qsize = 3000000, created = 0, weight;
- int osetup = setup;
+ int ocmd = cmd;
pthread_mutex_lock(&global_lock);
weight = satip_server_conf.satip_weight;
mpegts_pid_add(&rs->pids, 0, MPS_WEIGHT_RAW);
/* trigger play when first SETUP arrived */
/* retrigger play when new setup arrived */
- if (oldstate != STATE_DESCRIBE || setup) {
- setup = 0;
+ if (oldstate != STATE_DESCRIBE || cmd == RTSP_CMD_SETUP) {
+ cmd = RTSP_CMD_PLAY;
rs->state = STATE_SETUP;
}
} else {
if (rs->used_weight != weight && weight > 0)
subscription_set_weight(rs->subs, rs->used_weight = weight);
}
- if (!setup && rs->state != STATE_PLAY) {
+ if (cmd == RTSP_CMD_PLAY && rs->state != STATE_PLAY) {
if (rs->mux == NULL)
goto endclean;
satip_rtp_queue((void *)(intptr_t)rs->stream,
rs->udp_rtp ? rs->udp_rtp->fd : hc->hc_fd,
rs->udp_rtcp ? rs->udp_rtcp->fd : -1,
rs->frontend, rs->findex, &rs->dmc_tuned,
- &rs->pids, osetup == 0, rs->perm_lock);
+ &rs->pids, ocmd == RTSP_CMD_PLAY, rs->perm_lock);
rs->tcp_data = rs->udp_rtp ? NULL : hc;
if (!rs->pids.all && rs->pids.count == 0)
mpegts_pid_add(&rs->pids, 0, MPS_WEIGHT_RAW);
svc = (mpegts_service_t *)rs->subs->ths_raw_service;
svc->s_update_pids(svc, &rs->pids);
rs->state = STATE_PLAY;
- } else if (osetup == 0) {
+ } else if (ocmd == RTSP_CMD_PLAY) {
satip_rtp_allow_data((void *)(intptr_t)rs->stream);
}
rtsp_manage_descramble(rs);
*
*/
static int
-rtsp_process_play(http_connection_t *hc, int setup)
+rtsp_process_play(http_connection_t *hc, int cmd)
{
session_t *rs;
int errcode = HTTP_STATUS_BAD_REQUEST, valid = 0, oldstate = 0, i, stream;
pthread_mutex_lock(&rtsp_lock);
- errcode = rtsp_parse_cmd(hc, stream, setup, &rs, &valid, &oldstate);
+ errcode = rtsp_parse_cmd(hc, stream, cmd, &rs, &valid, &oldstate);
if (errcode) goto error;
- if (setup && rs->rtp_peer_port != RTSP_TCP_DATA) {
+ if (cmd == RTSP_CMD_SETUP && rs->rtp_peer_port != RTSP_TCP_DATA) {
if (udp_bind_double(&rs->udp_rtp, &rs->udp_rtcp,
LS_SATIPS, "rtsp", "rtcp",
rtsp_ip, 0, NULL,
}
}
- if ((errcode = rtsp_start(hc, rs, hc->hc_peer_ipstr, valid, setup, oldstate)) != 0)
+ if ((errcode = rtsp_start(hc, rs, hc->hc_peer_ipstr, valid, cmd, oldstate)) != 0)
goto error;
- if (setup) {
+ if (cmd == RTSP_CMD_SETUP) {
snprintf(buf, sizeof(buf), "%s;timeout=%d", rs->session, RTSP_TIMEOUT);
http_arg_set(&args, "Session", buf);
i = rs->rtp_peer_port;
return rtsp_process_describe(hc);
case RTSP_CMD_SETUP:
case RTSP_CMD_PLAY:
- return rtsp_process_play(hc, hc->hc_cmd == RTSP_CMD_SETUP);
+ return rtsp_process_play(hc, hc->hc_cmd);
case RTSP_CMD_TEARDOWN:
return rtsp_process_teardown(hc);
default: