summaryrefslogtreecommitdiffstats
path: root/stream/librtsp/rtsp_rtp.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream/librtsp/rtsp_rtp.c')
-rw-r--r--stream/librtsp/rtsp_rtp.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/stream/librtsp/rtsp_rtp.c b/stream/librtsp/rtsp_rtp.c
index 66c7be4a36..37400e62d1 100644
--- a/stream/librtsp/rtsp_rtp.c
+++ b/stream/librtsp/rtsp_rtp.c
@@ -57,7 +57,7 @@
#define RTSP_NPT_NOW "npt=now-"
#define RTSP_MEDIA_CONTAINER_MPEG_TS "33"
#define RTSP_TRANSPORT_REQUEST "Transport: RTP/AVP;%s;%s%i-%i;mode=\"PLAY\""
-
+
#define RTSP_TRANSPORT_MULTICAST "multicast"
#define RTSP_TRANSPORT_UNICAST "unicast"
@@ -82,7 +82,7 @@ rtcp_send_rr (rtsp_t *s, struct rtp_rtsp_session_t *st)
{
if (st->rtcp_socket == -1)
return;
-
+
/* send RTCP RR every RTCP_SEND_FREQUENCY packets
* FIXME : NOT CORRECT, HARDCODED, BUT MAKES SOME SERVERS HAPPY
* not rfc compliant
@@ -108,14 +108,14 @@ static struct rtp_rtsp_session_t *
rtp_session_new (void)
{
struct rtp_rtsp_session_t *st = NULL;
-
+
st = malloc (sizeof (struct rtp_rtsp_session_t));
-
+
st->rtp_socket = -1;
st->rtcp_socket = -1;
st->control_url = NULL;
st->count = 0;
-
+
return st;
}
@@ -153,7 +153,7 @@ parse_port (const char *line, const char *param,
char *parse1;
char *parse2;
char *parse3;
-
+
char *line_copy = strdup (line);
parse1 = strstr (line_copy, param);
@@ -161,14 +161,14 @@ parse_port (const char *line, const char *param,
if (parse1)
{
parse2 = strstr (parse1, "-");
-
+
if (parse2)
{
parse3 = strstr (parse2, ";");
-
+
if (parse3)
parse3[0] = 0;
-
+
parse2[0] = 0;
}
else
@@ -182,12 +182,12 @@ parse_port (const char *line, const char *param,
free (line_copy);
return 0;
}
-
+
*rtp_port = atoi (parse1 + strlen (param));
*rtcp_port = atoi (parse2 + 1);
free (line_copy);
-
+
return 1;
}
@@ -200,21 +200,21 @@ parse_destination (const char *line)
char *dest = NULL;
char *line_copy = strdup (line);
int len;
-
+
parse1 = strstr (line_copy, RTSP_SETUP_DESTINATION);
if (!parse1)
{
free (line_copy);
return NULL;
}
-
+
parse2 = strstr (parse1, ";");
if (!parse2)
{
free (line_copy);
return NULL;
}
-
+
len = strlen (parse1) - strlen (parse2)
- strlen (RTSP_SETUP_DESTINATION) + 1;
dest = (char *) malloc (len + 1);
@@ -230,7 +230,7 @@ rtcp_connect (int client_port, int server_port, const char* server_hostname)
struct sockaddr_in sin;
struct hostent *hp;
int s;
-
+
if (client_port <= 1023)
return -1;
@@ -249,7 +249,7 @@ rtcp_connect (int client_port, int server_port, const char* server_hostname)
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons (client_port);
-
+
if (bind (s, (struct sockaddr *) &sin, sizeof (sin)))
{
#if !HAVE_WINSOCK2_H
@@ -262,7 +262,7 @@ rtcp_connect (int client_port, int server_port, const char* server_hostname)
return -1;
}
}
-
+
sin.sin_family = AF_INET;
memcpy (&(sin.sin_addr.s_addr), hp->h_addr, sizeof (hp->h_addr));
sin.sin_port = htons (server_port);
@@ -328,7 +328,7 @@ rtp_connect (char *hostname, int port)
return -1;
}
}
-
+
/* datagram socket */
if (bind (s, (struct sockaddr *) &sin, sizeof (sin)))
{
@@ -346,10 +346,10 @@ rtp_connect (char *hostname, int port)
tv.tv_sec = 1; /* 1 second timeout */
tv.tv_usec = 0;
-
+
FD_ZERO (&set);
FD_SET (s, &set);
-
+
err = select (s + 1, &set, NULL, NULL, &tv);
if (err < 0)
{
@@ -363,7 +363,7 @@ rtp_connect (char *hostname, int port)
close (s);
return -1;
}
-
+
err_len = sizeof (err);
getsockopt (s, SOL_SOCKET, SO_ERROR, &err, (socklen_t *) &err_len);
if (err)
@@ -372,7 +372,7 @@ rtp_connect (char *hostname, int port)
close (s);
return -1;
}
-
+
return s;
}
@@ -383,7 +383,7 @@ is_multicast_address (char *addr)
if (!addr)
return -1;
-
+
sin.sin_family = AF_INET;
#if HAVE_INET_PTON
@@ -393,7 +393,7 @@ is_multicast_address (char *addr)
#elif HAVE_WINSOCK2_H
sin.sin_addr.s_addr = htonl (INADDR_ANY);
#endif
-
+
if ((ntohl (sin.sin_addr.s_addr) >> 28) == 0xe)
return 1;
@@ -416,7 +416,7 @@ rtp_setup_and_play (rtsp_t *rtsp_session)
int statut;
int content_length = 0;
int is_multicast = 0;
-
+
fsdp_description_t *dsc = NULL;
fsdp_error_t result;
@@ -451,7 +451,7 @@ rtp_setup_and_play (rtsp_t *rtsp_session)
return NULL;
}
sdp[content_length] = 0;
-
+
/* 3. parse SDP message */
dsc = fsdp_description_new ();
result = fsdp_parse (sdp, dsc);
@@ -490,7 +490,7 @@ rtp_setup_and_play (rtsp_t *rtsp_session)
}
/* 6. parse the `m=<media> <port> <transport> <fmt list>' line */
-
+
/* check for an A/V media */
if (fsdp_get_media_type (med_dsc) != FSDP_MEDIA_VIDEO &&
fsdp_get_media_type (med_dsc) != FSDP_MEDIA_AUDIO)
@@ -498,7 +498,7 @@ rtp_setup_and_play (rtsp_t *rtsp_session)
fsdp_description_delete (dsc);
return NULL;
}
-
+
/* only RTP/AVP transport method is supported right now */
if (fsdp_get_media_transport_protocol (med_dsc) != FSDP_TP_RTP_AVP)
{
@@ -535,7 +535,7 @@ rtp_setup_and_play (rtsp_t *rtsp_session)
/* RTCP port generally is RTP port + 1 */
client_rtcp_port = client_rtp_port + 1;
-
+
mp_msg (MSGT_OPEN, MSGL_V,
"RTP Port from SDP appears to be: %d\n", client_rtp_port);
mp_msg (MSGT_OPEN, MSGL_V,
@@ -573,7 +573,7 @@ rtp_setup_and_play (rtsp_t *rtsp_session)
/* no control for media: try global one instead */
server_addr = strdup (fsdp_get_global_conn_address (dsc));
}
-
+
if (!server_addr)
{
fsdp_description_delete (dsc);
@@ -611,7 +611,7 @@ rtp_setup_and_play (rtsp_t *rtsp_session)
is_multicast ? RTSP_MULTICAST_PORT : RTSP_UNICAST_CLIENT_PORT,
client_rtp_port, client_rtcp_port);
mp_msg (MSGT_OPEN, MSGL_V, "RTSP Transport: %s\n", temp_buf);
-
+
rtsp_unschedule_field (rtsp_session, RTSP_SESSION);
rtsp_schedule_field (rtsp_session, temp_buf);
@@ -622,7 +622,7 @@ rtp_setup_and_play (rtsp_t *rtsp_session)
else /* relative URL */
statut = rtsp_request_setup (rtsp_session,
NULL, rtp_session->control_url);
-
+
if (statut < 200 || statut > 299)
{
free (server_addr);