[pulseaudio-commits] r2362 - in /branches/coling: airtunes/src/modules/rtp/rtsp.c raop_play/pulsified/raop_client.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sat May 3 18:01:53 PDT 2008


Author: coling
Date: Sun May  4 03:01:52 2008
New Revision: 2362

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2362&root=pulseaudio&view=rev
Log:
Convert the return values to fit with the rest of pulse 0 == success, < 0 == failure

Modified:
    branches/coling/airtunes/src/modules/rtp/rtsp.c
    branches/coling/raop_play/pulsified/raop_client.c

Modified: branches/coling/airtunes/src/modules/rtp/rtsp.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/coling/airtunes/src/modules/rtp/rtsp.c?rev=2362&root=pulseaudio&r1=2361&r2=2362&view=diff
==============================================================================
--- branches/coling/airtunes/src/modules/rtp/rtsp.c (original)
+++ branches/coling/airtunes/src/modules/rtp/rtsp.c Sun May  4 03:01:52 2008
@@ -129,7 +129,7 @@
     pa_assert(c->url);
 
     if (!cmd)
-        return 0;
+        return -1;
 
     buf = pa_strbuf_new();
     pa_strbuf_printf(buf, "%s %s RTSP/1.0\r\nCSeq: %d\r\n", cmd, c->url, ++c->cseq);
@@ -169,12 +169,12 @@
 
     /* Do we expect a response? */
     if (!expect_response)
-        return 1;
+        return 0;
 
     timeout = 5000;
     if (pa_read_line(c->io, response, sizeof(response), timeout) <= 0) {
         /*ERRMSG("%s: request failed\n",__func__);*/
-        return 0;
+        return -1;
     }
 
     delimiters[0] = ' ';
@@ -185,7 +185,7 @@
     if (!token || strcmp(token, "200")) {
         pa_xfree(token);
         /*ERRMSG("%s: request failed, error %s\n",__func__,token);*/
-        return 0;
+        return -1;
     }
     pa_xfree(token);
 
@@ -197,7 +197,7 @@
             /* Reduce timeout for future requests */
             timeout = 1000;
         }
-        return 1;
+        return 0;
     }
 
     /* TODO: Move header reading into the headerlist. */
@@ -225,7 +225,7 @@
         delimpos = strstr(response, ":");
         if (!delimpos) {
             /*ERRMSG("%s: Request failed, bad header\n",__func__);*/
-            return 0;
+            return -1;
         }
 
         if (strlen(delimpos) > 1) {
@@ -252,7 +252,7 @@
     }
     pa_strbuf_free(buf);
 
-    return 1;
+    return 0;
 }
 
 
@@ -333,11 +333,11 @@
 
     if (!(c->sc = pa_socket_client_new_string(mainloop, hostname, port))) {
         pa_log("failed to connect to server '%s:%d'", hostname, port);
-        return 0;
+        return -1;
     }
 
     pa_socket_client_set_callback(c->sc, on_connection, c);
-    return 1;
+    return 0;
 }
 
 
@@ -366,7 +366,7 @@
 int pa_rtsp_announce(pa_rtsp_context *c, const char* sdp) {
     pa_assert(c);
     if (!sdp)
-        return 0;
+        return -1;
 
     return pa_rtsp_exec(c, "ANNOUNCE", "application/sdp", sdp, 1, NULL, NULL);
 }
@@ -386,10 +386,10 @@
     rheaders = pa_headerlist_new();
     pa_headerlist_puts(headers, "Transport", "RTP/AVP/TCP;unicast;interleaved=0-1;mode=record");
 
-    if (!pa_rtsp_exec(c, "SETUP", NULL, NULL, 1, headers, &rheaders)) {
+    if (pa_rtsp_exec(c, "SETUP", NULL, NULL, 1, headers, &rheaders)) {
         pa_headerlist_free(headers);
         pa_headerlist_free(rheaders);
-        return 0;
+        return -1;
     }
     pa_headerlist_free(headers);
 
@@ -398,7 +398,7 @@
 
     if (!c->session || !c->transport) {
         pa_headerlist_free(rheaders);
-        return 0;
+        return -1;
     }
 
     /* Now parse out the server port component of the response. */
@@ -419,11 +419,11 @@
     if (0 == c->port) {
         /* Error no server_port in response */
         pa_headerlist_free(rheaders);
-        return 0;
+        return -1;
     }
 
     *response_headers = rheaders;
-    return 1;
+    return 0;
 }
 
 
@@ -434,7 +434,7 @@
     pa_assert(c);
     if (!c->session) {
         /* No seesion in progres */
-        return 0;
+        return -1;
     }
 
     headers = pa_headerlist_new();
@@ -457,7 +457,7 @@
 int pa_rtsp_setparameter(pa_rtsp_context *c, const char* param) {
     pa_assert(c);
     if (!param)
-        return 0;
+        return -1;
 
     return pa_rtsp_exec(c, "SET_PARAMETER", "text/parameters", param, 1, NULL, NULL);
 }

Modified: branches/coling/raop_play/pulsified/raop_client.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/coling/raop_play/pulsified/raop_client.c?rev=2362&root=pulseaudio&r1=2361&r2=2362&view=diff
==============================================================================
--- branches/coling/raop_play/pulsified/raop_client.c (original)
+++ branches/coling/raop_play/pulsified/raop_client.c Sun May  4 03:01:52 2008
@@ -329,7 +329,7 @@
   if(!(raopcld->rtsp=pa_rtsp_context_new("iTunes/4.6 (Macintosh; U; PPC Mac OS X 10.3)"))) goto erexit;
   //if(rtspcl_set_useragent(raopcld->rtspcl,"iTunes/4.6 (Macintosh; U; PPC Mac OS X 10.3)")) goto erexit;
   if(pa_headerlist_puts(raopcld->rtsp->headers, "Client-Instance", sci)) goto erexit;
-  if(!pa_rtsp_connect(raopcld->rtsp, mainloop_api, host, destport)) goto erexit;
+  if(pa_rtsp_connect(raopcld->rtsp, mainloop_api, host, destport)) goto erexit;
   /* We call the mainloop in blocking mode here to allow the connection to be established.
      Yes, this is totally hacky and requires an internal knowledge of how the aobve pa_rtsp_connect
      works, but this is only a hacked up test so I'll let it slide just this once ;) */
@@ -358,9 +358,9 @@
             sid, pa_rtsp_localip(raopcld->rtsp), host, key, iv);
   remove_char_from_string(sac,'=');
   if(pa_headerlist_puts(raopcld->rtsp->headers, "Apple-Challenge", sac)) goto erexit;
-  if(!pa_rtsp_announce(raopcld->rtsp, sdp)) goto erexit;
+  if(pa_rtsp_announce(raopcld->rtsp, sdp)) goto erexit;
   if(pa_headerlist_remove(raopcld->rtsp->headers, "Apple-Challenge")) goto erexit;
-  if(!pa_rtsp_setup(raopcld->rtsp, &setup_kd)) goto erexit;
+  if(pa_rtsp_setup(raopcld->rtsp, &setup_kd)) goto erexit;
   if(!(aj=pa_xstrdup(pa_headerlist_gets(setup_kd,"Audio-Jack-Status")))) {
     ERRMSG("%s: Audio-Jack-Status is missing\n",__func__);
     goto erexit;
@@ -381,7 +381,7 @@
     token=strtok(NULL,delimiters);
   }
 
-  if(!pa_rtsp_record(raopcld->rtsp)) goto erexit;
+  if(pa_rtsp_record(raopcld->rtsp)) goto erexit;
 
   // keep host address and port information
   if(realloc_memory((void**)&raopcld->addr,strlen(host)+1,__func__)) goto erexit;
@@ -395,7 +395,7 @@
   if(sac) free(sac);
   if(key) free(key);
   if(iv) free(iv);
-        if (setup_kd)
+  if (setup_kd)
     pa_headerlist_free(setup_kd);
   return rval;
 
@@ -416,16 +416,16 @@
   if(!raopcld->rtsp) return -1;
   raopcld->volume=VOLUME_MIN+(VOLUME_MAX-VOLUME_MIN)*vol/100;
   sprintf(a, "volume: %d.000000\r\n", raopcld->volume);
-  if (pa_rtsp_setparameter(raopcld->rtsp,a)) return 0;
-        return -1;
+  if (pa_rtsp_setparameter(raopcld->rtsp,a)) return -1;
+  return 0;
 }
 
 int raopcl_flush_stream(raopcl_t *p)
 {
   raopcl_data_t *raopcld=(raopcl_data_t *)p;
   if(!p) return -1;
-        if (pa_rtsp_flush(raopcld->rtsp)) return 0;
-  return -1;
+  if (pa_rtsp_flush(raopcld->rtsp)) return -1;
+  return 0;
 }
 
 int raopcl_set_pause(raopcl_t *p, pause_state_t pause)




More information about the pulseaudio-commits mailing list