...
|
...
|
@@ -1589,10 +1589,13 @@ void ff_rtsp_close_connections(AVFormatContext *s)
|
1589
|
1589
|
int ff_rtsp_connect(AVFormatContext *s)
|
1590
|
1590
|
{
|
1591
|
1591
|
RTSPState *rt = s->priv_data;
|
1592
|
|
- char host[1024], path[1024], tcpname[1024], cmd[2048], auth[128];
|
|
1592
|
+ char proto[128], host[1024], path[1024];
|
|
1593
|
+ char tcpname[1024], cmd[2048], auth[128];
|
|
1594
|
+ const char *lower_rtsp_proto = "tcp";
|
1593
|
1595
|
int port, err, tcp_fd;
|
1594
|
1596
|
RTSPMessageHeader reply1 = {0}, *reply = &reply1;
|
1595
|
1597
|
int lower_transport_mask = 0;
|
|
1598
|
+ int default_port = RTSP_DEFAULT_PORT;
|
1596
|
1599
|
char real_challenge[64] = "";
|
1597
|
1600
|
struct sockaddr_storage peer;
|
1598
|
1601
|
socklen_t peer_len = sizeof(peer);
|
...
|
...
|
@@ -1619,15 +1622,23 @@ int ff_rtsp_connect(AVFormatContext *s)
|
1619
|
1619
|
rt->lower_transport_mask &= (1 << RTSP_LOWER_TRANSPORT_NB) - 1;
|
1620
|
1620
|
|
1621
|
1621
|
redirect:
|
1622
|
|
- lower_transport_mask = rt->lower_transport_mask;
|
1623
|
1622
|
/* extract hostname and port */
|
1624
|
|
- av_url_split(NULL, 0, auth, sizeof(auth),
|
|
1623
|
+ av_url_split(proto, sizeof(proto), auth, sizeof(auth),
|
1625
|
1624
|
host, sizeof(host), &port, path, sizeof(path), s->filename);
|
|
1625
|
+
|
|
1626
|
+ if (!strcmp(proto, "rtsps")) {
|
|
1627
|
+ lower_rtsp_proto = "tls";
|
|
1628
|
+ default_port = RTSPS_DEFAULT_PORT;
|
|
1629
|
+ rt->lower_transport_mask = 1 << RTSP_LOWER_TRANSPORT_TCP;
|
|
1630
|
+ }
|
|
1631
|
+
|
1626
|
1632
|
if (*auth) {
|
1627
|
1633
|
av_strlcpy(rt->auth, auth, sizeof(rt->auth));
|
1628
|
1634
|
}
|
1629
|
1635
|
if (port < 0)
|
1630
|
|
- port = RTSP_DEFAULT_PORT;
|
|
1636
|
+ port = default_port;
|
|
1637
|
+
|
|
1638
|
+ lower_transport_mask = rt->lower_transport_mask;
|
1631
|
1639
|
|
1632
|
1640
|
if (!lower_transport_mask)
|
1633
|
1641
|
lower_transport_mask = (1 << RTSP_LOWER_TRANSPORT_NB) - 1;
|
...
|
...
|
@@ -1647,7 +1658,7 @@ redirect:
|
1647
|
1647
|
/* Construct the URI used in request; this is similar to s->filename,
|
1648
|
1648
|
* but with authentication credentials removed and RTSP specific options
|
1649
|
1649
|
* stripped out. */
|
1650
|
|
- ff_url_join(rt->control_uri, sizeof(rt->control_uri), "rtsp", NULL,
|
|
1650
|
+ ff_url_join(rt->control_uri, sizeof(rt->control_uri), proto, NULL,
|
1651
|
1651
|
host, port, "%s", path);
|
1652
|
1652
|
|
1653
|
1653
|
if (rt->control_transport == RTSP_MODE_TUNNEL) {
|
...
|
...
|
@@ -1726,7 +1737,8 @@ redirect:
|
1726
|
1726
|
}
|
1727
|
1727
|
} else {
|
1728
|
1728
|
/* open the tcp connection */
|
1729
|
|
- ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL);
|
|
1729
|
+ ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL,
|
|
1730
|
+ host, port, NULL);
|
1730
|
1731
|
if (ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
|
1731
|
1732
|
&s->interrupt_callback, NULL) < 0) {
|
1732
|
1733
|
err = AVERROR(EIO);
|