diff stream/librtsp/rtsp.c @ 29263:0f1b5b68af32

whitespace cosmetics: Remove all trailing whitespace.
author diego
date Wed, 13 May 2009 02:58:57 +0000
parents c884d17bd005
children b01f807eb183
line wrap: on
line diff
--- a/stream/librtsp/rtsp.c	Tue May 12 19:25:35 2009 +0000
+++ b/stream/librtsp/rtsp.c	Wed May 13 02:58:57 2009 +0000
@@ -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 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 @@
  * 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 @@
 #ifdef LOG
   mp_msg(MSGT_OPEN, MSGL_INFO, "librtsp: << '%s'\n", string);
 #endif
-  
+
 
   free(buffer);
   return string;
@@ -163,7 +163,7 @@
 /*
  * 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 @@
   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 @@
 
   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 @@
 
   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_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 @@
 /*
  * 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 @@
   char **answer_ptr=s->answers;
   int code;
   int ans_count = 0;
-  
+
   answer=rtsp_get(s);
   if (!answer)
     return 0;
@@ -271,13 +271,13 @@
   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 @@
     *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 @@
 
 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 @@
   }
   rtsp_send_request(s,RTSP_METHOD_DESCRIBE,buf);
   free(buf);
-  
+
   return rtsp_get_answers(s);
 }
 
@@ -388,12 +388,12 @@
     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 @@
   }
   rtsp_send_request(s,RTSP_METHOD_SET_PARAMETER,buf);
   free(buf);
-  
+
   return rtsp_get_answers(s);
 }
 
@@ -420,7 +420,7 @@
 
   char *buf;
   int ret;
-  
+
   if (what) {
     buf=strdup(what);
   } else
@@ -430,7 +430,7 @@
   }
   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_teardown(rtsp_t *s, const char *what) {
 
   char *buf;
-  
+
   if (what)
     buf = strdup (what);
   else
@@ -474,7 +474,7 @@
     {
       char *rest=rtsp_get(s);
       if (!rest)
-        return -1;      
+        return -1;
 
       seq=-1;
       do {
@@ -540,10 +540,10 @@
   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 **answer;
   char *ptr;
-  
+
   if (!s->answers) return NULL;
   answer=s->answers;
 
@@ -652,7 +652,7 @@
   }
   return NULL;
 }
-  
+
 /*
  * schedules a field for transmission
  */
@@ -660,7 +660,7 @@
 void rtsp_schedule_field(rtsp_t *s, const char *string) {
 
   int i=0;
-  
+
   if (!string) return;
 
   while(s->scheduled[i]) {
@@ -670,13 +670,13 @@
 }
 
 /*
- * 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_all(rtsp_t *s) {
 
   char **ptr;
-  
+
   if (!s->scheduled) return;
   ptr=s->scheduled;
 
@@ -716,7 +716,7 @@
 void rtsp_free_answers(rtsp_t *s) {
 
   char **answer;
-  
+
   if (!s->answers) return;
   answer=s->answers;