Mercurial > libavformat.hg
comparison rtsp.c @ 5894:51c410f2251b libavformat
Reassemble the RTSP URL before replacing hostname with the numerical IP
author | mstorsjo |
---|---|
date | Thu, 25 Mar 2010 22:21:09 +0000 |
parents | 046e46b938d5 |
children | 09a6916ecbf6 |
comparison
equal
deleted
inserted
replaced
5893:046e46b938d5 | 5894:51c410f2251b |
---|---|
1503 err = AVERROR(EINVAL); | 1503 err = AVERROR(EINVAL); |
1504 goto fail; | 1504 goto fail; |
1505 } | 1505 } |
1506 } | 1506 } |
1507 | 1507 |
1508 /* Construct the URI used in request; this is similar to s->filename, | |
1509 * but with authentication credentials removed and RTSP specific options | |
1510 * stripped out. */ | |
1511 ff_url_join(rt->control_uri, sizeof(rt->control_uri), "rtsp", NULL, | |
1512 host, port, "%s", path); | |
1513 | |
1508 /* open the tcp connexion */ | 1514 /* open the tcp connexion */ |
1509 ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL); | 1515 ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL); |
1510 if (url_open(&rtsp_hd, tcpname, URL_RDWR) < 0) { | 1516 if (url_open(&rtsp_hd, tcpname, URL_RDWR) < 0) { |
1511 err = AVERROR(EIO); | 1517 err = AVERROR(EIO); |
1512 goto fail; | 1518 goto fail; |
1518 if (!getpeername(tcp_fd, (struct sockaddr*) &peer, &peer_len)) { | 1524 if (!getpeername(tcp_fd, (struct sockaddr*) &peer, &peer_len)) { |
1519 getnameinfo((struct sockaddr*) &peer, peer_len, host, sizeof(host), | 1525 getnameinfo((struct sockaddr*) &peer, peer_len, host, sizeof(host), |
1520 NULL, 0, NI_NUMERICHOST); | 1526 NULL, 0, NI_NUMERICHOST); |
1521 } | 1527 } |
1522 | 1528 |
1523 /* Construct the URI used in request; this is similar to s->filename, | |
1524 * but with authentication credentials removed and RTSP specific options | |
1525 * stripped out. */ | |
1526 ff_url_join(rt->control_uri, sizeof(rt->control_uri), "rtsp", NULL, | |
1527 host, port, "%s", path); | |
1528 /* request options supported by the server; this also detects server | 1529 /* request options supported by the server; this also detects server |
1529 * type */ | 1530 * type */ |
1530 for (rt->server_type = RTSP_SERVER_RTP;;) { | 1531 for (rt->server_type = RTSP_SERVER_RTP;;) { |
1531 cmd[0] = 0; | 1532 cmd[0] = 0; |
1532 if (rt->server_type == RTSP_SERVER_REAL) | 1533 if (rt->server_type == RTSP_SERVER_REAL) |