]> code.delx.au - pulseaudio/commitdiff
prefix by order macros with PA_
authorLennart Poettering <lennart@poettering.net>
Sat, 22 Sep 2007 01:16:14 +0000 (01:16 +0000)
committerLennart Poettering <lennart@poettering.net>
Sat, 22 Sep 2007 01:16:14 +0000 (01:16 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1884 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/pulsecore/endianmacros.h
src/pulsecore/esound.h
src/pulsecore/protocol-esound.c
src/pulsecore/sample-util.c
src/pulsecore/sconv-s16be.c
src/pulsecore/sconv-s16le.c
src/pulsecore/sconv.c
src/tests/resampler-test.c

index e2801c10bec0603524934479380d8936b13d7863..8f7cfade31f34de9d91d17df418b68eeebe66d62 100644 (file)
 #endif
 
 #ifdef HAVE_BYTESWAP_H
-#define INT16_SWAP(x) ((int16_t) bswap_16((uint16_t) x))
-#define UINT16_SWAP(x) ((uint16_t) bswap_16((uint16_t) x))
-#define INT32_SWAP(x) ((int32_t) bswap_32((uint32_t) x))
-#define UINT32_SWAP(x) ((uint32_t) bswap_32((uint32_t) x))
+#define PA_INT16_SWAP(x) ((int16_t) bswap_16((uint16_t) x))
+#define PA_UINT16_SWAP(x) ((uint16_t) bswap_16((uint16_t) x))
+#define PA_INT32_SWAP(x) ((int32_t) bswap_32((uint32_t) x))
+#define PA_UINT32_SWAP(x) ((uint32_t) bswap_32((uint32_t) x))
 #else
-#define INT16_SWAP(x) ( (int16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) )
-#define UINT16_SWAP(x) ( (uint16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) )
-#define INT32_SWAP(x) ( (int32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) )
-#define UINT32_SWAP(x) ( (uint32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) )
+#define PA_INT16_SWAP(x) ( (int16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) )
+#define PA_UINT16_SWAP(x) ( (uint16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) )
+#define PA_INT32_SWAP(x) ( (int32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) )
+#define PA_UINT32_SWAP(x) ( (uint32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) )
 #endif
 
-#define MAYBE_INT32_SWAP(c,x) ((c) ? INT32_SWAP(x) : x)
-#define MAYBE_UINT32_SWAP(c,x) ((c) ? UINT32_SWAP(x) : x)
+#define PA_MAYBE_INT16_SWAP(c,x) ((c) ? PA_INT32_SWAP(x) : x)
+#define PA_MAYBE_UINT16_SWAP(c,x) ((c) ? PA_UINT32_SWAP(x) : x)
+
+#define PA_MAYBE_INT32_SWAP(c,x) ((c) ? PA_INT32_SWAP(x) : x)
+#define PA_MAYBE_UINT32_SWAP(c,x) ((c) ? PA_UINT32_SWAP(x) : x)
 
 #ifdef WORDS_BIGENDIAN
- #define INT16_FROM_LE(x) INT16_SWAP(x)
- #define INT16_FROM_BE(x) ((int16_t)(x))
+ #define PA_INT16_FROM_LE(x) PA_INT16_SWAP(x)
+ #define PA_INT16_FROM_BE(x) ((int16_t)(x))
 
- #define INT16_TO_LE(x) INT16_SWAP(x)
- #define INT16_TO_BE(x) ((int16_t)(x))
+ #define PA_INT16_TO_LE(x) PA_INT16_SWAP(x)
+ #define PA_INT16_TO_BE(x) ((int16_t)(x))
 
- #define UINT16_FROM_LE(x) UINT16_SWAP(x)
- #define UINT16_FROM_BE(x) ((uint16_t)(x))
+ #define PA_UINT16_FROM_LE(x) PA_UINT16_SWAP(x)
+ #define PA_UINT16_FROM_BE(x) ((uint16_t)(x))
 
- #define INT32_FROM_LE(x) INT32_SWAP(x)
- #define INT32_FROM_BE(x) ((int32_t)(x))
+ #define PA_INT32_FROM_LE(x) PA_INT32_SWAP(x)
+ #define PA_INT32_FROM_BE(x) ((int32_t)(x))
 
- #define UINT32_FROM_LE(x) UINT32_SWAP(x)
- #define UINT32_FROM_BE(x) ((uint32_t)(x))
+ #define PA_UINT32_FROM_LE(x) PA_UINT32_SWAP(x)
+ #define PA_UINT32_FROM_BE(x) ((uint32_t)(x))
 
- #define UINT32_TO_LE(x) UINT32_SWAP(x)
- #define UINT32_TO_BE(x) ((uint32_t)(x))
+ #define PA_UINT32_TO_LE(x) PA_UINT32_SWAP(x)
+ #define PA_UINT32_TO_BE(x) ((uint32_t)(x))
 #else
- #define INT16_FROM_LE(x) ((int16_t)(x))
- #define INT16_FROM_BE(x) INT16_SWAP(x)
+ #define PA_INT16_FROM_LE(x) ((int16_t)(x))
+ #define PA_INT16_FROM_BE(x) PA_INT16_SWAP(x)
 
- #define INT16_TO_LE(x) ((int16_t)(x))
- #define INT16_TO_BE(x) INT16_SWAP(x)
+ #define PA_INT16_TO_LE(x) ((int16_t)(x))
+ #define PA_INT16_TO_BE(x) PA_INT16_SWAP(x)
 
- #define UINT16_FROM_LE(x) ((uint16_t)(x))
- #define UINT16_FROM_BE(x) UINT16_SWAP(x)
+ #define PA_UINT16_FROM_LE(x) ((uint16_t)(x))
+ #define PA_UINT16_FROM_BE(x) PA_UINT16_SWAP(x)
 
- #define INT32_FROM_LE(x) ((int32_t)(x))
- #define INT32_FROM_BE(x) INT32_SWAP(x)
+ #define PA_INT32_FROM_LE(x) ((int32_t)(x))
+ #define PA_INT32_FROM_BE(x) PA_INT32_SWAP(x)
 
- #define UINT32_FROM_LE(x) ((uint32_t)(x))
- #define UINT32_FROM_BE(x) UINT32_SWAP(x)
+ #define PA_UINT32_FROM_LE(x) ((uint32_t)(x))
+ #define PA_UINT32_FROM_BE(x) PA_UINT32_SWAP(x)
 
- #define UINT32_TO_LE(x) ((uint32_t)(x))
- #define UINT32_TO_BE(x) UINT32_SWAP(x)
+ #define PA_UINT32_TO_LE(x) ((uint32_t)(x))
+ #define PA_UINT32_TO_BE(x) PA_UINT32_SWAP(x)
 #endif
 
 #endif
index 3778a535f608e062ad8530b421f74b85c6fe3578..ea6a566505b1c8cddfd7125c96b82eacb625e799 100644 (file)
@@ -205,7 +205,7 @@ typedef int esd_client_state_t;
 /* the endian key is transferred in binary, if it's read into int, */
 /* and matches ESD_ENDIAN_KEY (ENDN), then the endianness of the */
 /* server and the client match; if it's SWAP_ENDIAN_KEY, swap data */
-#define ESD_SWAP_ENDIAN_KEY (UINT32_SWAP(ESD_ENDIAN_KEY))
+#define ESD_SWAP_ENDIAN_KEY (PA_UINT32_SWAP(ESD_ENDIAN_KEY))
 
 
 #endif
index b69436346b2a9a8c4e11780e90fc41d97af8614a..adefaf98f248f1583ba4c5beba4310f535849397 100644 (file)
@@ -80,7 +80,7 @@
 
 typedef struct connection {
     pa_msgobject parent;
-    
+
     uint32_t index;
     int dead;
     pa_protocol_esound *protocol;
@@ -125,7 +125,7 @@ struct pa_protocol_esound {
     int public;
     pa_socket_server *server;
     pa_idxset *connections;
-    
+
     char *sink_name, *source_name;
     unsigned n_player;
     uint8_t esd_key[ESD_KEY_LEN];
@@ -227,7 +227,7 @@ static void connection_unlink(connection *c) {
         pa_client_free(c->client);
         c->client = NULL;
     }
-    
+
     if (c->state == ESD_STREAMING_DATA)
         c->protocol->n_player--;
 
@@ -254,7 +254,7 @@ static void connection_unlink(connection *c) {
 static void connection_free(pa_object *obj) {
     connection *c = CONNECTION(obj);
     pa_assert(c);
-    
+
     if (c->input_memblockq)
         pa_memblockq_free(c->input_memblockq);
     if (c->output_memblockq)
@@ -381,11 +381,11 @@ static int esd_proto_stream_play(connection *c, PA_GCC_UNUSED esd_proto_t reques
     pa_assert(length == (sizeof(int32_t)*2+ESD_NAME_MAX));
 
     memcpy(&format, data, sizeof(int32_t));
-    format = MAYBE_INT32_SWAP(c->swap_byte_order, format);
+    format = PA_MAYBE_INT32_SWAP(c->swap_byte_order, format);
     data = (const char*) data + sizeof(int32_t);
 
     memcpy(&rate, data, sizeof(int32_t));
-    rate = MAYBE_INT32_SWAP(c->swap_byte_order, rate);
+    rate = PA_MAYBE_INT32_SWAP(c->swap_byte_order, rate);
     data = (const char*) data + sizeof(int32_t);
 
     ss.rate = rate;
@@ -445,7 +445,7 @@ static int esd_proto_stream_play(connection *c, PA_GCC_UNUSED esd_proto_t reques
     pa_atomic_store(&c->playback.missing, pa_memblockq_missing(c->input_memblockq));
 
     pa_sink_input_put(c->sink_input);
-    
+
     return 0;
 }
 
@@ -462,11 +462,11 @@ static int esd_proto_stream_record(connection *c, esd_proto_t request, const voi
     pa_assert(length == (sizeof(int32_t)*2+ESD_NAME_MAX));
 
     memcpy(&format, data, sizeof(int32_t));
-    format = MAYBE_INT32_SWAP(c->swap_byte_order, format);
+    format = PA_MAYBE_INT32_SWAP(c->swap_byte_order, format);
     data = (const char*) data + sizeof(int32_t);
 
     memcpy(&rate, data, sizeof(int32_t));
-    rate = MAYBE_INT32_SWAP(c->swap_byte_order, rate);
+    rate = PA_MAYBE_INT32_SWAP(c->swap_byte_order, rate);
     data = (const char*) data + sizeof(int32_t);
 
     ss.rate = rate;
@@ -559,7 +559,7 @@ static int esd_proto_get_latency(connection *c, PA_GCC_UNUSED esd_proto_t reques
         latency = (int) ((usec*44100)/1000000);
     }
 
-    latency = MAYBE_INT32_SWAP(c->swap_byte_order, latency);
+    latency = PA_MAYBE_INT32_SWAP(c->swap_byte_order, latency);
     connection_write(c, &latency, sizeof(int32_t));
     return 0;
 }
@@ -582,9 +582,9 @@ static int esd_proto_server_info(connection *c, PA_GCC_UNUSED esd_proto_t reques
 
     response = 0;
     connection_write(c, &response, sizeof(int32_t));
-    rate = MAYBE_INT32_SWAP(c->swap_byte_order, rate);
+    rate = PA_MAYBE_INT32_SWAP(c->swap_byte_order, rate);
     connection_write(c, &rate, sizeof(int32_t));
-    format = MAYBE_INT32_SWAP(c->swap_byte_order, format);
+    format = PA_MAYBE_INT32_SWAP(c->swap_byte_order, format);
     connection_write(c, &format, sizeof(int32_t));
 
     return 0;
@@ -631,7 +631,7 @@ static int esd_proto_all_info(connection *c, esd_proto_t request, const void *da
         }
 
         /* id */
-        id = MAYBE_INT32_SWAP(c->swap_byte_order, (int32_t) (conn->index+1));
+        id = PA_MAYBE_INT32_SWAP(c->swap_byte_order, (int32_t) (conn->index+1));
         connection_write(c, &id, sizeof(int32_t));
 
         /* name */
@@ -643,19 +643,19 @@ static int esd_proto_all_info(connection *c, esd_proto_t request, const void *da
         connection_write(c, name, ESD_NAME_MAX);
 
         /* rate */
-        rate = MAYBE_INT32_SWAP(c->swap_byte_order, rate);
+        rate = PA_MAYBE_INT32_SWAP(c->swap_byte_order, rate);
         connection_write(c, &rate, sizeof(int32_t));
 
         /* left */
-        lvolume = MAYBE_INT32_SWAP(c->swap_byte_order, lvolume);
+        lvolume = PA_MAYBE_INT32_SWAP(c->swap_byte_order, lvolume);
         connection_write(c, &lvolume, sizeof(int32_t));
 
         /*right*/
-        rvolume = MAYBE_INT32_SWAP(c->swap_byte_order, rvolume);
+        rvolume = PA_MAYBE_INT32_SWAP(c->swap_byte_order, rvolume);
         connection_write(c, &rvolume, sizeof(int32_t));
 
         /*format*/
-        format = MAYBE_INT32_SWAP(c->swap_byte_order, format);
+        format = PA_MAYBE_INT32_SWAP(c->swap_byte_order, format);
         connection_write(c, &format, sizeof(int32_t));
 
         t -= k;
@@ -677,7 +677,7 @@ static int esd_proto_all_info(connection *c, esd_proto_t request, const void *da
             pa_assert(t >= s*2);
 
             /* id */
-            id = MAYBE_INT32_SWAP(c->swap_byte_order, (int) (ce->index+1));
+            id = PA_MAYBE_INT32_SWAP(c->swap_byte_order, (int) (ce->index+1));
             connection_write(c, &id, sizeof(int32_t));
 
             /* name */
@@ -689,23 +689,23 @@ static int esd_proto_all_info(connection *c, esd_proto_t request, const void *da
             connection_write(c, name, ESD_NAME_MAX);
 
             /* rate */
-            rate = MAYBE_UINT32_SWAP(c->swap_byte_order, ce->sample_spec.rate);
+            rate = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, ce->sample_spec.rate);
             connection_write(c, &rate, sizeof(int32_t));
 
             /* left */
-            lvolume = MAYBE_UINT32_SWAP(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM);
+            lvolume = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM);
             connection_write(c, &lvolume, sizeof(int32_t));
 
             /*right*/
-            rvolume = MAYBE_UINT32_SWAP(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM);
+            rvolume = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM);
             connection_write(c, &rvolume, sizeof(int32_t));
 
             /*format*/
-            format = MAYBE_INT32_SWAP(c->swap_byte_order, format_native2esd(&ce->sample_spec));
+            format = PA_MAYBE_INT32_SWAP(c->swap_byte_order, format_native2esd(&ce->sample_spec));
             connection_write(c, &format, sizeof(int32_t));
 
             /*length*/
-            len = MAYBE_INT32_SWAP(c->swap_byte_order, (int) ce->memchunk.length);
+            len = PA_MAYBE_INT32_SWAP(c->swap_byte_order, (int) ce->memchunk.length);
             connection_write(c, &len, sizeof(int32_t));
 
             t -= s;
@@ -729,15 +729,15 @@ static int esd_proto_stream_pan(connection *c, PA_GCC_UNUSED esd_proto_t request
     pa_assert(length == sizeof(int32_t)*3);
 
     memcpy(&idx, data, sizeof(uint32_t));
-    idx = MAYBE_UINT32_SWAP(c->swap_byte_order, idx) - 1;
+    idx = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, idx) - 1;
     data = (const char*)data + sizeof(uint32_t);
 
     memcpy(&lvolume, data, sizeof(uint32_t));
-    lvolume = MAYBE_UINT32_SWAP(c->swap_byte_order, lvolume);
+    lvolume = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, lvolume);
     data = (const char*)data + sizeof(uint32_t);
 
     memcpy(&rvolume, data, sizeof(uint32_t));
-    rvolume = MAYBE_UINT32_SWAP(c->swap_byte_order, rvolume);
+    rvolume = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, rvolume);
     data = (const char*)data + sizeof(uint32_t);
 
     if ((conn = pa_idxset_get_by_index(c->protocol->connections, idx)) && conn->sink_input) {
@@ -766,11 +766,11 @@ static int esd_proto_sample_cache(connection *c, PA_GCC_UNUSED esd_proto_t reque
     pa_assert(length == (ESD_NAME_MAX+3*sizeof(int32_t)));
 
     memcpy(&format, data, sizeof(int32_t));
-    format = MAYBE_INT32_SWAP(c->swap_byte_order, format);
+    format = PA_MAYBE_INT32_SWAP(c->swap_byte_order, format);
     data = (const char*)data + sizeof(int32_t);
 
     memcpy(&rate, data, sizeof(int32_t));
-    rate = MAYBE_INT32_SWAP(c->swap_byte_order, rate);
+    rate = PA_MAYBE_INT32_SWAP(c->swap_byte_order, rate);
     data = (const char*)data + sizeof(int32_t);
 
     ss.rate = rate;
@@ -779,7 +779,7 @@ static int esd_proto_sample_cache(connection *c, PA_GCC_UNUSED esd_proto_t reque
     CHECK_VALIDITY(pa_sample_spec_valid(&ss), "Invalid sample specification.");
 
     memcpy(&sc_length, data, sizeof(int32_t));
-    sc_length = MAYBE_INT32_SWAP(c->swap_byte_order, sc_length);
+    sc_length = PA_MAYBE_INT32_SWAP(c->swap_byte_order, sc_length);
     data = (const char*)data + sizeof(int32_t);
 
     CHECK_VALIDITY(sc_length <= MAX_CACHE_SAMPLE_SIZE, "Sample too large (%d bytes).", (int)sc_length);
@@ -842,7 +842,7 @@ static int esd_proto_sample_free_or_play(connection *c, esd_proto_t request, con
     pa_assert(length == sizeof(int32_t));
 
     memcpy(&idx, data, sizeof(uint32_t));
-    idx = MAYBE_UINT32_SWAP(c->swap_byte_order, idx) - 1;
+    idx = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, idx) - 1;
 
     ok = 0;
 
@@ -884,7 +884,7 @@ static int esd_proto_standby_or_resume(connection *c, PA_GCC_UNUSED esd_proto_t
 
 static void client_kill_cb(pa_client *c) {
     pa_assert(c);
-    
+
     connection_unlink(CONNECTION(c->userdata));
 }
 
@@ -907,7 +907,7 @@ static int do_read(connection *c) {
         if ((c->read_data_length+= r) >= sizeof(c->request)) {
             struct proto_handler *handler;
 
-            c->request = MAYBE_INT32_SWAP(c->swap_byte_order, c->request);
+            c->request = PA_MAYBE_INT32_SWAP(c->swap_byte_order, c->request);
 
             if (c->request < ESD_PROTO_CONNECT || c->request > ESD_PROTO_MAX) {
                 pa_log("recieved invalid request.");
@@ -950,7 +950,7 @@ static int do_read(connection *c) {
         if ((r = pa_iochannel_read(c->io, (uint8_t*) c->read_data + c->read_data_length, handler->data_length - c->read_data_length)) <= 0) {
             if (errno == EINTR || errno == EAGAIN)
                 return 0;
-            
+
             pa_log_debug("read(): %s", r < 0 ? pa_cstrerror(errno) : "EOF");
             return -1;
         }
@@ -976,11 +976,11 @@ static int do_read(connection *c) {
         p = pa_memblock_acquire(c->scache.memchunk.memblock);
         r = pa_iochannel_read(c->io, (uint8_t*) p+c->scache.memchunk.index, c->scache.memchunk.length-c->scache.memchunk.index);
         pa_memblock_release(c->scache.memchunk.memblock);
-        
+
         if (r <= 0) {
             if (errno == EINTR || errno == EAGAIN)
                 return 0;
-            
+
             pa_log_debug("read(): %s", r < 0 ? pa_cstrerror(errno) : "EOF");
             return -1;
         }
@@ -1038,9 +1038,9 @@ static int do_read(connection *c) {
         p = pa_memblock_acquire(c->playback.current_memblock);
         r = pa_iochannel_read(c->io, (uint8_t*) p+c->playback.memblock_index, l);
         pa_memblock_release(c->playback.current_memblock);
-        
+
         if (r <= 0) {
-            
+
             if (errno == EINTR || errno == EAGAIN)
                 return 0;
 
@@ -1074,7 +1074,7 @@ static int do_write(connection *c) {
 
             if (errno == EINTR || errno == EAGAIN)
                 return 0;
-            
+
             pa_log("write(): %s", pa_cstrerror(errno));
             return -1;
         }
@@ -1098,12 +1098,12 @@ static int do_write(connection *c) {
         pa_memblock_release(chunk.memblock);
 
         pa_memblock_unref(chunk.memblock);
-        
+
         if (r < 0) {
 
             if (errno == EINTR || errno == EAGAIN)
                 return 0;
-        
+
             pa_log("write(): %s", pa_cstrerror(errno));
             return -1;
         }
@@ -1178,7 +1178,7 @@ static int connection_process_msg(pa_msgobject *o, int code, void*userdata, int6
         case CONNECTION_MESSAGE_REQUEST_DATA:
             do_work(c);
             break;
-            
+
         case CONNECTION_MESSAGE_POST_DATA:
 /*             pa_log("got data %u", chunk->length); */
             pa_memblockq_push_align(c->output_memblockq, chunk);
@@ -1213,7 +1213,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
             pa_memblockq_push_align(c->input_memblockq, chunk);
 
 /*             pa_log("got data, %u", pa_memblockq_get_length(c->input_memblockq)); */
-            
+
             return 0;
         }
 
@@ -1240,7 +1240,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
 static int sink_input_peek_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk) {
     connection*c;
     int r;
-    
+
     pa_assert(i);
     c = CONNECTION(i->userdata);
     connection_assert_ref(c);
@@ -1314,7 +1314,7 @@ static pa_usec_t source_output_get_latency_cb(pa_source_output *o) {
 
 static void auth_timeout(pa_mainloop_api*m, pa_time_event *e, const struct timeval *tv, void *userdata) {
     connection *c = CONNECTION(userdata);
-    
+
     pa_assert(m);
     pa_assert(tv);
     connection_assert_ref(c);
@@ -1328,7 +1328,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
     connection *c;
     pa_protocol_esound *p = userdata;
     char cname[256], pname[128];
-    
+
     pa_assert(s);
     pa_assert(io);
     pa_assert(p);
index 248a09b63022ec836243034d331455c8661e9482..bc83ac6fe139d1ae792ded4bf499783a3451529a 100644 (file)
@@ -208,7 +208,7 @@ size_t pa_mix(
                         if (cvolume == PA_VOLUME_MUTED)
                             v = 0;
                         else {
-                            v = INT16_SWAP(*((int16_t*) ((uint8_t*) streams[i].internal + streams[i].chunk.index + d)));
+                            v = PA_INT16_SWAP(*((int16_t*) ((uint8_t*) streams[i].internal + streams[i].chunk.index + d)));
 
                             if (cvolume != PA_VOLUME_NORM)
                                 v = (int32_t) (v * pa_sw_volume_to_linear(cvolume));
@@ -223,7 +223,7 @@ size_t pa_mix(
                     sum = CLAMP(sum, -0x8000, 0x7FFF);
                 }
 
-                *((int16_t*) data) = INT16_SWAP((int16_t) sum);
+                *((int16_t*) data) = PA_INT16_SWAP((int16_t) sum);
                 data = (uint8_t*) data + sizeof(int16_t);
 
                 if (++channel >= spec->channels)
@@ -398,10 +398,10 @@ void pa_volume_memchunk(
             for (channel = 0, d = (int16_t*) ((uint8_t*) ptr + c->index), n = c->length/sizeof(int16_t); n > 0; d++, n--) {
                 int32_t t;
 
-                t = (int32_t)(INT16_SWAP(*d));
+                t = (int32_t)(PA_INT16_SWAP(*d));
                 t = (t * linear[channel]) / 0x10000;
                 t = CLAMP(t, -0x8000, 0x7FFF);
-                *d = INT16_SWAP((int16_t) t);
+                *d = PA_INT16_SWAP((int16_t) t);
 
                 if (++channel >= spec->channels)
                     channel = 0;
index 658b3f5c37f1d1a5c19f0fb2ba07cc3fb0df5aa3..f74d028297a20f412283f57527ed1a353147f868 100644 (file)
@@ -27,8 +27,8 @@
 
 #include "endianmacros.h"
 
-#define INT16_FROM INT16_FROM_BE
-#define INT16_TO INT16_TO_BE
+#define INT16_FROM PA_INT16_FROM_BE
+#define INT16_TO PA_INT16_TO_BE
 
 #define pa_sconv_s16le_to_float32ne pa_sconv_s16be_to_float32ne
 #define pa_sconv_s16le_from_float32ne pa_sconv_s16be_from_float32ne
index 86b3729598c4e9b2a195777e4d29704009ba9930..6925052cffa43218af03fe561ff87509c589be5f 100644 (file)
 #include "sconv-s16le.h"
 
 #ifndef INT16_FROM
-#define INT16_FROM INT16_FROM_LE
+#define INT16_FROM PA_INT16_FROM_LE
 #endif
 
 #ifndef INT16_TO
-#define INT16_TO INT16_TO_LE
+#define INT16_TO PA_INT16_TO_LE
 #endif
 
 #ifndef SWAP_WORDS
@@ -103,7 +103,7 @@ void pa_sconv_s16le_to_float32re(unsigned n, const int16_t *a, float *b) {
         int16_t s = *(a++);
         float k = ((float) INT16_FROM(s))/0x7FFF;
         uint32_t *j = (uint32_t*) &k;
-        *j = UINT32_SWAP(*j);
+        *j = PA_UINT32_SWAP(*j);
         *(b++) = k;
     }
 }
@@ -116,7 +116,7 @@ void pa_sconv_s16le_from_float32re(unsigned n, const float *a, int16_t *b) {
         int16_t s;
         float v = *(a++);
         uint32_t *j = (uint32_t*) &v;
-        *j = UINT32_SWAP(*j);
+        *j = PA_UINT32_SWAP(*j);
         v = CLAMP(v, -1, 1);
         s = (int16_t) (v * 0x7FFF);
         *(b++) = INT16_TO(s);
index 933192b66973e862842dd8b34f08d634bdd32869..7f5da63f0eb7b6775d4db0b2f211986b7a321840 100644 (file)
@@ -94,7 +94,7 @@ static void float32re_to_float32ne(unsigned n, const float *a, float *b) {
     pa_assert(b);
 
     for (; n > 0; n--, a++, b++)
-        *((uint32_t *) b) = UINT32_SWAP(*((uint32_t *) a));
+        *((uint32_t *) b) = PA_UINT32_SWAP(*((uint32_t *) a));
 }
 
 /* s16 */
@@ -111,7 +111,7 @@ static void s16re_to_s16ne(unsigned n, const int16_t *a, int16_t *b) {
     pa_assert(b);
 
     for (; n > 0; n--, a++, b++)
-        *b = UINT16_SWAP(*a);
+        *b = PA_UINT16_SWAP(*a);
 }
 
 /* ulaw */
index e2cf1d8abd72cac63c612ea744b9e7f723e8b182..3b4a73865ad7e1d170654d8e3949e366b9271347 100644 (file)
@@ -38,7 +38,7 @@
 
 static float swap_float(float a) {
     uint32_t *b = (uint32_t*) &a;
-    *b = UINT32_SWAP(*b);
+    *b = PA_UINT32_SWAP(*b);
     return a;
 }