aboutsummaryrefslogtreecommitdiffhomepage
path: root/stream/librtsp
diff options
context:
space:
mode:
authorGravatar diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-05-13 02:58:57 +0000
committerGravatar diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-05-13 02:58:57 +0000
commit6e9cbdc10448203e7c8b2de41447442fcc9f7bae (patch)
tree0ed465592509105fdbeab27fc12ddbb2e3590aa5 /stream/librtsp
parenteafe5b7517bbf408ae1ffc936a3abe2313c3b334 (diff)
whitespace cosmetics: Remove all trailing whitespace.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream/librtsp')
-rw-r--r--stream/librtsp/rtsp.c88
-rw-r--r--stream/librtsp/rtsp.h4
-rw-r--r--stream/librtsp/rtsp_rtp.c64
-rw-r--r--stream/librtsp/rtsp_session.c18
4 files changed, 87 insertions, 87 deletions
diff --git a/stream/librtsp/rtsp.c b/stream/librtsp/rtsp.c
index 8012174d99..53ed233c53 100644
--- a/stream/librtsp/rtsp.c
+++ b/stream/librtsp/rtsp.c
@@ -59,12 +59,12 @@
/*
* network utilities
*/
-
+
static int write_stream(int s, const char *buf, int len) {
int total, timeout;
total = 0; timeout = 30;
- while (total < len){
+ while (total < len){
int n;
n = send (s, &buf[total], len - total, 0);
@@ -87,37 +87,37 @@ static int write_stream(int s, const char *buf, int len) {
}
static ssize_t read_stream(int fd, void *buf, size_t count) {
-
+
ssize_t ret, total;
total = 0;
while (total < count) {
-
+
ret=recv (fd, ((uint8_t*)buf)+total, count-total, 0);
if (ret<0) {
if(errno == EAGAIN) {
fd_set rset;
struct timeval timeout;
-
+
FD_ZERO (&rset);
FD_SET (fd, &rset);
-
+
timeout.tv_sec = 30;
timeout.tv_usec = 0;
-
+
if (select (fd+1, &rset, NULL, NULL, &timeout) <= 0) {
return -1;
}
continue;
}
-
+
mp_msg(MSGT_OPEN, MSGL_ERR, "rtsp: read error.\n");
return ret;
} else
total += ret;
-
+
/* end of stream */
if (!ret) break;
}
@@ -129,7 +129,7 @@ static ssize_t read_stream(int fd, void *buf, size_t count) {
* rtsp_get gets a line from stream
* and returns a null terminated string.
*/
-
+
static char *rtsp_get(rtsp_t *s) {
int n=1;
@@ -154,7 +154,7 @@ static char *rtsp_get(rtsp_t *s) {
#ifdef LOG
mp_msg(MSGT_OPEN, MSGL_INFO, "librtsp: << '%s'\n", string);
#endif
-
+
free(buffer);
return string;
@@ -163,7 +163,7 @@ static char *rtsp_get(rtsp_t *s) {
/*
* rtsp_put puts a line on stream
*/
-
+
static void rtsp_put(rtsp_t *s, const char *string) {
int len=strlen(string);
@@ -178,7 +178,7 @@ static void rtsp_put(rtsp_t *s, const char *string) {
buf[len+1]=0x0a;
write_stream(s->s, buf, len+2);
-
+
#ifdef LOG
mp_msg(MSGT_OPEN, MSGL_INFO, " done.\n");
#endif
@@ -194,7 +194,7 @@ static int rtsp_get_code(const char *string) {
char buf[4];
int code=0;
-
+
if (!strncmp(string, RTSP_PROTOCOL_VERSION, strlen(RTSP_PROTOCOL_VERSION)))
{
memcpy(buf, string+strlen(RTSP_PROTOCOL_VERSION)+1, 3);
@@ -218,9 +218,9 @@ static void rtsp_send_request(rtsp_t *s, const char *type, const char *what) {
char **payload=s->scheduled;
char *buf;
-
+
buf = malloc(strlen(type)+strlen(what)+strlen(RTSP_PROTOCOL_VERSION)+3);
-
+
sprintf(buf,"%s %s %s",type, what, RTSP_PROTOCOL_VERSION);
rtsp_put(s,buf);
free(buf);
@@ -240,10 +240,10 @@ static void rtsp_send_request(rtsp_t *s, const char *type, const char *what) {
static void rtsp_schedule_standard(rtsp_t *s) {
char tmp[17];
-
+
snprintf(tmp, 17, "CSeq: %u", s->cseq);
rtsp_schedule_field(s, tmp);
-
+
if (s->session) {
char *buf;
buf = malloc(strlen(s->session)+15);
@@ -255,7 +255,7 @@ static void rtsp_schedule_standard(rtsp_t *s) {
/*
* get the answers, if server responses with something != 200, return NULL
*/
-
+
static int rtsp_get_answers(rtsp_t *s) {
char *answer=NULL;
@@ -263,7 +263,7 @@ static int rtsp_get_answers(rtsp_t *s) {
char **answer_ptr=s->answers;
int code;
int ans_count = 0;
-
+
answer=rtsp_get(s);
if (!answer)
return 0;
@@ -271,13 +271,13 @@ static int rtsp_get_answers(rtsp_t *s) {
free(answer);
rtsp_free_answers(s);
-
+
do { /* while we get answer lines */
-
+
answer=rtsp_get(s);
if (!answer)
return 0;
-
+
if (!strncasecmp(answer,"CSeq:",5)) {
sscanf(answer,"%*s %u",&answer_seq);
if (s->cseq != answer_seq) {
@@ -315,12 +315,12 @@ static int rtsp_get_answers(rtsp_t *s) {
*answer_ptr=answer;
answer_ptr++;
} while ((strlen(answer)!=0) && (++ans_count < MAX_FIELDS));
-
+
s->cseq++;
-
+
*answer_ptr=NULL;
rtsp_schedule_standard(s);
-
+
return code;
}
@@ -330,7 +330,7 @@ static int rtsp_get_answers(rtsp_t *s) {
int rtsp_send_ok(rtsp_t *s) {
char cseq[16];
-
+
rtsp_put(s, "RTSP/1.0 200 OK");
sprintf(cseq,"CSeq: %u", s->cseq);
rtsp_put(s, cseq);
@@ -373,7 +373,7 @@ int rtsp_request_describe(rtsp_t *s, const char *what) {
}
rtsp_send_request(s,RTSP_METHOD_DESCRIBE,buf);
free(buf);
-
+
return rtsp_get_answers(s);
}
@@ -388,12 +388,12 @@ int rtsp_request_setup(rtsp_t *s, const char *what, char *control) {
int len = strlen (s->host) + strlen (s->path) + 16;
if (control)
len += strlen (control) + 1;
-
+
buf = malloc (len);
sprintf (buf, "rtsp://%s:%i/%s%s%s", s->host, s->port, s->path,
control ? "/" : "", control ? control : "");
}
-
+
rtsp_send_request (s, RTSP_METHOD_SETUP, buf);
free (buf);
return rtsp_get_answers (s);
@@ -412,7 +412,7 @@ int rtsp_request_setparameter(rtsp_t *s, const char *what) {
}
rtsp_send_request(s,RTSP_METHOD_SET_PARAMETER,buf);
free(buf);
-
+
return rtsp_get_answers(s);
}
@@ -420,7 +420,7 @@ int rtsp_request_play(rtsp_t *s, const char *what) {
char *buf;
int ret;
-
+
if (what) {
buf=strdup(what);
} else
@@ -430,7 +430,7 @@ int rtsp_request_play(rtsp_t *s, const char *what) {
}
rtsp_send_request(s,RTSP_METHOD_PLAY,buf);
free(buf);
-
+
ret = rtsp_get_answers (s);
if (ret == RTSP_STATUS_OK)
s->server_state = RTSP_PLAYING;
@@ -441,7 +441,7 @@ int rtsp_request_play(rtsp_t *s, const char *what) {
int rtsp_request_teardown(rtsp_t *s, const char *what) {
char *buf;
-
+
if (what)
buf = strdup (what);
else
@@ -474,7 +474,7 @@ int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) {
{
char *rest=rtsp_get(s);
if (!rest)
- return -1;
+ return -1;
seq=-1;
do {
@@ -540,10 +540,10 @@ rtsp_t *rtsp_connect(int fd, char* mrl, char *path, char *host, int port, char *
s->server=NULL;
s->server_state=0;
s->server_caps=0;
-
+
s->cseq=0;
s->session=NULL;
-
+
if (user_agent)
s->user_agent=strdup(user_agent);
else
@@ -587,7 +587,7 @@ char *rtsp_search_answers(rtsp_t *s, const char *tag) {
char **answer;
char *ptr;
-
+
if (!s->answers) return NULL;
answer=s->answers;
@@ -652,7 +652,7 @@ char *rtsp_get_param(rtsp_t *s, const char *p) {
}
return NULL;
}
-
+
/*
* schedules a field for transmission
*/
@@ -660,7 +660,7 @@ char *rtsp_get_param(rtsp_t *s, const char *p) {
void rtsp_schedule_field(rtsp_t *s, const char *string) {
int i=0;
-
+
if (!string) return;
while(s->scheduled[i]) {
@@ -670,13 +670,13 @@ void rtsp_schedule_field(rtsp_t *s, const char *string) {
}
/*
- * removes the first scheduled field which prefix matches string.
+ * removes the first scheduled field which prefix matches string.
*/
void rtsp_unschedule_field(rtsp_t *s, const char *string) {
char **ptr=s->scheduled;
-
+
if (!string) return;
while(*ptr) {
@@ -699,7 +699,7 @@ void rtsp_unschedule_field(rtsp_t *s, const char *string) {
void rtsp_unschedule_all(rtsp_t *s) {
char **ptr;
-
+
if (!s->scheduled) return;
ptr=s->scheduled;
@@ -716,7 +716,7 @@ void rtsp_unschedule_all(rtsp_t *s) {
void rtsp_free_answers(rtsp_t *s) {
char **answer;
-
+
if (!s->answers) return;
answer=s->answers;
diff --git a/stream/librtsp/rtsp.h b/stream/librtsp/rtsp.h
index efca1f7779..5252f8de22 100644
--- a/stream/librtsp/rtsp.h
+++ b/stream/librtsp/rtsp.h
@@ -28,7 +28,7 @@
* 2006, Benjamin Zores and Vincent Mussard
* fixed a lot of RFC compliance issues.
*/
-
+
#ifndef MPLAYER_RTSP_H
#define MPLAYER_RTSP_H
@@ -65,7 +65,7 @@ struct rtsp_s {
char *server;
unsigned int server_state;
uint32_t server_caps;
-
+
unsigned int cseq;
char *session;
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);
diff --git a/stream/librtsp/rtsp_session.c b/stream/librtsp/rtsp_session.c
index c196e5305d..8b87d7fb41 100644
--- a/stream/librtsp/rtsp_session.c
+++ b/stream/librtsp/rtsp_session.c
@@ -77,7 +77,7 @@ struct rtsp_session_s {
};
/*
- * closes an rtsp connection
+ * closes an rtsp connection
*/
static void rtsp_close(rtsp_t *s) {
@@ -96,7 +96,7 @@ static void rtsp_close(rtsp_t *s) {
if (s->user_agent) free(s->user_agent);
rtsp_free_answers(s);
rtsp_unschedule_all(s);
- free(s);
+ free(s);
}
//rtsp_session_t *rtsp_session_start(char *mrl) {
@@ -112,7 +112,7 @@ rtsp_session_t *rtsp_session_start(int fd, char **mrl, char *path, char *host,
rtsp_session->s = NULL;
rtsp_session->real_session = NULL;
rtsp_session->rtp_session = NULL;
-
+
//connect:
*redir = 0;
@@ -164,7 +164,7 @@ rtsp_session_t *rtsp_session_start(int fd, char **mrl, char *path, char *host,
return NULL;
}
}
-
+
rtsp_session->real_session = init_real_rtsp_session ();
if(!strncmp(h->streams[0]->mime_type, "application/vnd.rn-rmadriver", h->streams[0]->mime_type_size) ||
!strncmp(h->streams[0]->mime_type, "application/smil", h->streams[0]->mime_type_size)) {
@@ -239,12 +239,12 @@ rtsp_session_t *rtsp_session_start(int fd, char **mrl, char *path, char *host,
}
}
free(server);
-
+
return rtsp_session;
}
int rtsp_session_read (rtsp_session_t *this, char *data, int len) {
-
+
if (this->real_session) {
int to_copy=len;
char *dest=data;
@@ -257,7 +257,7 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) {
if (len < 0) return 0;
if (this->real_session->recv_size < 0) return -1;
while (to_copy > fill) {
-
+
memcpy(dest, source, fill);
to_copy -= fill;
dest += fill;
@@ -278,7 +278,7 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) {
return len-to_copy;
}
}
-
+
memcpy(dest, source, to_copy);
this->real_session->recv_read += to_copy;
@@ -298,7 +298,7 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) {
if (l == 0)
rtsp_session_end (this);
-
+
return l;
}