mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-09 13:29:59 -05:00
prefix by order macros with PA_
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1884 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
668340099c
commit
c6b43bf119
8 changed files with 96 additions and 93 deletions
|
|
@ -36,56 +36,59 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_BYTESWAP_H
|
#ifdef HAVE_BYTESWAP_H
|
||||||
#define INT16_SWAP(x) ((int16_t) bswap_16((uint16_t) x))
|
#define PA_INT16_SWAP(x) ((int16_t) bswap_16((uint16_t) x))
|
||||||
#define UINT16_SWAP(x) ((uint16_t) bswap_16((uint16_t) x))
|
#define PA_UINT16_SWAP(x) ((uint16_t) bswap_16((uint16_t) x))
|
||||||
#define INT32_SWAP(x) ((int32_t) bswap_32((uint32_t) x))
|
#define PA_INT32_SWAP(x) ((int32_t) bswap_32((uint32_t) x))
|
||||||
#define UINT32_SWAP(x) ((uint32_t) bswap_32((uint32_t) x))
|
#define PA_UINT32_SWAP(x) ((uint32_t) bswap_32((uint32_t) x))
|
||||||
#else
|
#else
|
||||||
#define INT16_SWAP(x) ( (int16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) )
|
#define PA_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 PA_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 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 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_UINT32_SWAP(x) ( (uint32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAYBE_INT32_SWAP(c,x) ((c) ? INT32_SWAP(x) : x)
|
#define PA_MAYBE_INT16_SWAP(c,x) ((c) ? PA_INT32_SWAP(x) : x)
|
||||||
#define MAYBE_UINT32_SWAP(c,x) ((c) ? UINT32_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
|
#ifdef WORDS_BIGENDIAN
|
||||||
#define INT16_FROM_LE(x) INT16_SWAP(x)
|
#define PA_INT16_FROM_LE(x) PA_INT16_SWAP(x)
|
||||||
#define INT16_FROM_BE(x) ((int16_t)(x))
|
#define PA_INT16_FROM_BE(x) ((int16_t)(x))
|
||||||
|
|
||||||
#define INT16_TO_LE(x) INT16_SWAP(x)
|
#define PA_INT16_TO_LE(x) PA_INT16_SWAP(x)
|
||||||
#define INT16_TO_BE(x) ((int16_t)(x))
|
#define PA_INT16_TO_BE(x) ((int16_t)(x))
|
||||||
|
|
||||||
#define UINT16_FROM_LE(x) UINT16_SWAP(x)
|
#define PA_UINT16_FROM_LE(x) PA_UINT16_SWAP(x)
|
||||||
#define UINT16_FROM_BE(x) ((uint16_t)(x))
|
#define PA_UINT16_FROM_BE(x) ((uint16_t)(x))
|
||||||
|
|
||||||
#define INT32_FROM_LE(x) INT32_SWAP(x)
|
#define PA_INT32_FROM_LE(x) PA_INT32_SWAP(x)
|
||||||
#define INT32_FROM_BE(x) ((int32_t)(x))
|
#define PA_INT32_FROM_BE(x) ((int32_t)(x))
|
||||||
|
|
||||||
#define UINT32_FROM_LE(x) UINT32_SWAP(x)
|
#define PA_UINT32_FROM_LE(x) PA_UINT32_SWAP(x)
|
||||||
#define UINT32_FROM_BE(x) ((uint32_t)(x))
|
#define PA_UINT32_FROM_BE(x) ((uint32_t)(x))
|
||||||
|
|
||||||
#define UINT32_TO_LE(x) UINT32_SWAP(x)
|
#define PA_UINT32_TO_LE(x) PA_UINT32_SWAP(x)
|
||||||
#define UINT32_TO_BE(x) ((uint32_t)(x))
|
#define PA_UINT32_TO_BE(x) ((uint32_t)(x))
|
||||||
#else
|
#else
|
||||||
#define INT16_FROM_LE(x) ((int16_t)(x))
|
#define PA_INT16_FROM_LE(x) ((int16_t)(x))
|
||||||
#define INT16_FROM_BE(x) INT16_SWAP(x)
|
#define PA_INT16_FROM_BE(x) PA_INT16_SWAP(x)
|
||||||
|
|
||||||
#define INT16_TO_LE(x) ((int16_t)(x))
|
#define PA_INT16_TO_LE(x) ((int16_t)(x))
|
||||||
#define INT16_TO_BE(x) INT16_SWAP(x)
|
#define PA_INT16_TO_BE(x) PA_INT16_SWAP(x)
|
||||||
|
|
||||||
#define UINT16_FROM_LE(x) ((uint16_t)(x))
|
#define PA_UINT16_FROM_LE(x) ((uint16_t)(x))
|
||||||
#define UINT16_FROM_BE(x) UINT16_SWAP(x)
|
#define PA_UINT16_FROM_BE(x) PA_UINT16_SWAP(x)
|
||||||
|
|
||||||
#define INT32_FROM_LE(x) ((int32_t)(x))
|
#define PA_INT32_FROM_LE(x) ((int32_t)(x))
|
||||||
#define INT32_FROM_BE(x) INT32_SWAP(x)
|
#define PA_INT32_FROM_BE(x) PA_INT32_SWAP(x)
|
||||||
|
|
||||||
#define UINT32_FROM_LE(x) ((uint32_t)(x))
|
#define PA_UINT32_FROM_LE(x) ((uint32_t)(x))
|
||||||
#define UINT32_FROM_BE(x) UINT32_SWAP(x)
|
#define PA_UINT32_FROM_BE(x) PA_UINT32_SWAP(x)
|
||||||
|
|
||||||
#define UINT32_TO_LE(x) ((uint32_t)(x))
|
#define PA_UINT32_TO_LE(x) ((uint32_t)(x))
|
||||||
#define UINT32_TO_BE(x) UINT32_SWAP(x)
|
#define PA_UINT32_TO_BE(x) PA_UINT32_SWAP(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ typedef int esd_client_state_t;
|
||||||
/* the endian key is transferred in binary, if it's read into int, */
|
/* the endian key is transferred in binary, if it's read into int, */
|
||||||
/* and matches ESD_ENDIAN_KEY (ENDN), then the endianness of the */
|
/* and matches ESD_ENDIAN_KEY (ENDN), then the endianness of the */
|
||||||
/* server and the client match; if it's SWAP_ENDIAN_KEY, swap data */
|
/* 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
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@
|
||||||
|
|
||||||
typedef struct connection {
|
typedef struct connection {
|
||||||
pa_msgobject parent;
|
pa_msgobject parent;
|
||||||
|
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
int dead;
|
int dead;
|
||||||
pa_protocol_esound *protocol;
|
pa_protocol_esound *protocol;
|
||||||
|
|
@ -125,7 +125,7 @@ struct pa_protocol_esound {
|
||||||
int public;
|
int public;
|
||||||
pa_socket_server *server;
|
pa_socket_server *server;
|
||||||
pa_idxset *connections;
|
pa_idxset *connections;
|
||||||
|
|
||||||
char *sink_name, *source_name;
|
char *sink_name, *source_name;
|
||||||
unsigned n_player;
|
unsigned n_player;
|
||||||
uint8_t esd_key[ESD_KEY_LEN];
|
uint8_t esd_key[ESD_KEY_LEN];
|
||||||
|
|
@ -227,7 +227,7 @@ static void connection_unlink(connection *c) {
|
||||||
pa_client_free(c->client);
|
pa_client_free(c->client);
|
||||||
c->client = NULL;
|
c->client = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->state == ESD_STREAMING_DATA)
|
if (c->state == ESD_STREAMING_DATA)
|
||||||
c->protocol->n_player--;
|
c->protocol->n_player--;
|
||||||
|
|
||||||
|
|
@ -254,7 +254,7 @@ static void connection_unlink(connection *c) {
|
||||||
static void connection_free(pa_object *obj) {
|
static void connection_free(pa_object *obj) {
|
||||||
connection *c = CONNECTION(obj);
|
connection *c = CONNECTION(obj);
|
||||||
pa_assert(c);
|
pa_assert(c);
|
||||||
|
|
||||||
if (c->input_memblockq)
|
if (c->input_memblockq)
|
||||||
pa_memblockq_free(c->input_memblockq);
|
pa_memblockq_free(c->input_memblockq);
|
||||||
if (c->output_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));
|
pa_assert(length == (sizeof(int32_t)*2+ESD_NAME_MAX));
|
||||||
|
|
||||||
memcpy(&format, data, 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);
|
data = (const char*) data + sizeof(int32_t);
|
||||||
|
|
||||||
memcpy(&rate, 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);
|
data = (const char*) data + sizeof(int32_t);
|
||||||
|
|
||||||
ss.rate = rate;
|
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_atomic_store(&c->playback.missing, pa_memblockq_missing(c->input_memblockq));
|
||||||
|
|
||||||
pa_sink_input_put(c->sink_input);
|
pa_sink_input_put(c->sink_input);
|
||||||
|
|
||||||
return 0;
|
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));
|
pa_assert(length == (sizeof(int32_t)*2+ESD_NAME_MAX));
|
||||||
|
|
||||||
memcpy(&format, data, 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);
|
data = (const char*) data + sizeof(int32_t);
|
||||||
|
|
||||||
memcpy(&rate, 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);
|
data = (const char*) data + sizeof(int32_t);
|
||||||
|
|
||||||
ss.rate = rate;
|
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 = (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));
|
connection_write(c, &latency, sizeof(int32_t));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -582,9 +582,9 @@ static int esd_proto_server_info(connection *c, PA_GCC_UNUSED esd_proto_t reques
|
||||||
|
|
||||||
response = 0;
|
response = 0;
|
||||||
connection_write(c, &response, sizeof(int32_t));
|
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));
|
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));
|
connection_write(c, &format, sizeof(int32_t));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -631,7 +631,7 @@ static int esd_proto_all_info(connection *c, esd_proto_t request, const void *da
|
||||||
}
|
}
|
||||||
|
|
||||||
/* id */
|
/* 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));
|
connection_write(c, &id, sizeof(int32_t));
|
||||||
|
|
||||||
/* name */
|
/* 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);
|
connection_write(c, name, ESD_NAME_MAX);
|
||||||
|
|
||||||
/* rate */
|
/* 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));
|
connection_write(c, &rate, sizeof(int32_t));
|
||||||
|
|
||||||
/* left */
|
/* 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));
|
connection_write(c, &lvolume, sizeof(int32_t));
|
||||||
|
|
||||||
/*right*/
|
/*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));
|
connection_write(c, &rvolume, sizeof(int32_t));
|
||||||
|
|
||||||
/*format*/
|
/*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));
|
connection_write(c, &format, sizeof(int32_t));
|
||||||
|
|
||||||
t -= k;
|
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);
|
pa_assert(t >= s*2);
|
||||||
|
|
||||||
/* id */
|
/* 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));
|
connection_write(c, &id, sizeof(int32_t));
|
||||||
|
|
||||||
/* name */
|
/* 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);
|
connection_write(c, name, ESD_NAME_MAX);
|
||||||
|
|
||||||
/* rate */
|
/* 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));
|
connection_write(c, &rate, sizeof(int32_t));
|
||||||
|
|
||||||
/* left */
|
/* 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));
|
connection_write(c, &lvolume, sizeof(int32_t));
|
||||||
|
|
||||||
/*right*/
|
/*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));
|
connection_write(c, &rvolume, sizeof(int32_t));
|
||||||
|
|
||||||
/*format*/
|
/*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));
|
connection_write(c, &format, sizeof(int32_t));
|
||||||
|
|
||||||
/*length*/
|
/*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));
|
connection_write(c, &len, sizeof(int32_t));
|
||||||
|
|
||||||
t -= s;
|
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);
|
pa_assert(length == sizeof(int32_t)*3);
|
||||||
|
|
||||||
memcpy(&idx, data, sizeof(uint32_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;
|
||||||
data = (const char*)data + sizeof(uint32_t);
|
data = (const char*)data + sizeof(uint32_t);
|
||||||
|
|
||||||
memcpy(&lvolume, 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);
|
data = (const char*)data + sizeof(uint32_t);
|
||||||
|
|
||||||
memcpy(&rvolume, 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);
|
data = (const char*)data + sizeof(uint32_t);
|
||||||
|
|
||||||
if ((conn = pa_idxset_get_by_index(c->protocol->connections, idx)) && conn->sink_input) {
|
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)));
|
pa_assert(length == (ESD_NAME_MAX+3*sizeof(int32_t)));
|
||||||
|
|
||||||
memcpy(&format, data, 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);
|
data = (const char*)data + sizeof(int32_t);
|
||||||
|
|
||||||
memcpy(&rate, 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);
|
data = (const char*)data + sizeof(int32_t);
|
||||||
|
|
||||||
ss.rate = rate;
|
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.");
|
CHECK_VALIDITY(pa_sample_spec_valid(&ss), "Invalid sample specification.");
|
||||||
|
|
||||||
memcpy(&sc_length, data, sizeof(int32_t));
|
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);
|
data = (const char*)data + sizeof(int32_t);
|
||||||
|
|
||||||
CHECK_VALIDITY(sc_length <= MAX_CACHE_SAMPLE_SIZE, "Sample too large (%d bytes).", (int)sc_length);
|
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));
|
pa_assert(length == sizeof(int32_t));
|
||||||
|
|
||||||
memcpy(&idx, data, sizeof(uint32_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;
|
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) {
|
static void client_kill_cb(pa_client *c) {
|
||||||
pa_assert(c);
|
pa_assert(c);
|
||||||
|
|
||||||
connection_unlink(CONNECTION(c->userdata));
|
connection_unlink(CONNECTION(c->userdata));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -907,7 +907,7 @@ static int do_read(connection *c) {
|
||||||
if ((c->read_data_length+= r) >= sizeof(c->request)) {
|
if ((c->read_data_length+= r) >= sizeof(c->request)) {
|
||||||
struct proto_handler *handler;
|
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) {
|
if (c->request < ESD_PROTO_CONNECT || c->request > ESD_PROTO_MAX) {
|
||||||
pa_log("recieved invalid request.");
|
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 ((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)
|
if (errno == EINTR || errno == EAGAIN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pa_log_debug("read(): %s", r < 0 ? pa_cstrerror(errno) : "EOF");
|
pa_log_debug("read(): %s", r < 0 ? pa_cstrerror(errno) : "EOF");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -976,11 +976,11 @@ static int do_read(connection *c) {
|
||||||
p = pa_memblock_acquire(c->scache.memchunk.memblock);
|
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);
|
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);
|
pa_memblock_release(c->scache.memchunk.memblock);
|
||||||
|
|
||||||
if (r <= 0) {
|
if (r <= 0) {
|
||||||
if (errno == EINTR || errno == EAGAIN)
|
if (errno == EINTR || errno == EAGAIN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pa_log_debug("read(): %s", r < 0 ? pa_cstrerror(errno) : "EOF");
|
pa_log_debug("read(): %s", r < 0 ? pa_cstrerror(errno) : "EOF");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -1038,9 +1038,9 @@ static int do_read(connection *c) {
|
||||||
p = pa_memblock_acquire(c->playback.current_memblock);
|
p = pa_memblock_acquire(c->playback.current_memblock);
|
||||||
r = pa_iochannel_read(c->io, (uint8_t*) p+c->playback.memblock_index, l);
|
r = pa_iochannel_read(c->io, (uint8_t*) p+c->playback.memblock_index, l);
|
||||||
pa_memblock_release(c->playback.current_memblock);
|
pa_memblock_release(c->playback.current_memblock);
|
||||||
|
|
||||||
if (r <= 0) {
|
if (r <= 0) {
|
||||||
|
|
||||||
if (errno == EINTR || errno == EAGAIN)
|
if (errno == EINTR || errno == EAGAIN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -1074,7 +1074,7 @@ static int do_write(connection *c) {
|
||||||
|
|
||||||
if (errno == EINTR || errno == EAGAIN)
|
if (errno == EINTR || errno == EAGAIN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pa_log("write(): %s", pa_cstrerror(errno));
|
pa_log("write(): %s", pa_cstrerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -1098,12 +1098,12 @@ static int do_write(connection *c) {
|
||||||
pa_memblock_release(chunk.memblock);
|
pa_memblock_release(chunk.memblock);
|
||||||
|
|
||||||
pa_memblock_unref(chunk.memblock);
|
pa_memblock_unref(chunk.memblock);
|
||||||
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
|
||||||
if (errno == EINTR || errno == EAGAIN)
|
if (errno == EINTR || errno == EAGAIN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pa_log("write(): %s", pa_cstrerror(errno));
|
pa_log("write(): %s", pa_cstrerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -1178,7 +1178,7 @@ static int connection_process_msg(pa_msgobject *o, int code, void*userdata, int6
|
||||||
case CONNECTION_MESSAGE_REQUEST_DATA:
|
case CONNECTION_MESSAGE_REQUEST_DATA:
|
||||||
do_work(c);
|
do_work(c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONNECTION_MESSAGE_POST_DATA:
|
case CONNECTION_MESSAGE_POST_DATA:
|
||||||
/* pa_log("got data %u", chunk->length); */
|
/* pa_log("got data %u", chunk->length); */
|
||||||
pa_memblockq_push_align(c->output_memblockq, chunk);
|
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_memblockq_push_align(c->input_memblockq, chunk);
|
||||||
|
|
||||||
/* pa_log("got data, %u", pa_memblockq_get_length(c->input_memblockq)); */
|
/* pa_log("got data, %u", pa_memblockq_get_length(c->input_memblockq)); */
|
||||||
|
|
||||||
return 0;
|
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) {
|
static int sink_input_peek_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk) {
|
||||||
connection*c;
|
connection*c;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
pa_assert(i);
|
pa_assert(i);
|
||||||
c = CONNECTION(i->userdata);
|
c = CONNECTION(i->userdata);
|
||||||
connection_assert_ref(c);
|
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) {
|
static void auth_timeout(pa_mainloop_api*m, pa_time_event *e, const struct timeval *tv, void *userdata) {
|
||||||
connection *c = CONNECTION(userdata);
|
connection *c = CONNECTION(userdata);
|
||||||
|
|
||||||
pa_assert(m);
|
pa_assert(m);
|
||||||
pa_assert(tv);
|
pa_assert(tv);
|
||||||
connection_assert_ref(c);
|
connection_assert_ref(c);
|
||||||
|
|
@ -1328,7 +1328,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
|
||||||
connection *c;
|
connection *c;
|
||||||
pa_protocol_esound *p = userdata;
|
pa_protocol_esound *p = userdata;
|
||||||
char cname[256], pname[128];
|
char cname[256], pname[128];
|
||||||
|
|
||||||
pa_assert(s);
|
pa_assert(s);
|
||||||
pa_assert(io);
|
pa_assert(io);
|
||||||
pa_assert(p);
|
pa_assert(p);
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ size_t pa_mix(
|
||||||
if (cvolume == PA_VOLUME_MUTED)
|
if (cvolume == PA_VOLUME_MUTED)
|
||||||
v = 0;
|
v = 0;
|
||||||
else {
|
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)
|
if (cvolume != PA_VOLUME_NORM)
|
||||||
v = (int32_t) (v * pa_sw_volume_to_linear(cvolume));
|
v = (int32_t) (v * pa_sw_volume_to_linear(cvolume));
|
||||||
|
|
@ -223,7 +223,7 @@ size_t pa_mix(
|
||||||
sum = CLAMP(sum, -0x8000, 0x7FFF);
|
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);
|
data = (uint8_t*) data + sizeof(int16_t);
|
||||||
|
|
||||||
if (++channel >= spec->channels)
|
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--) {
|
for (channel = 0, d = (int16_t*) ((uint8_t*) ptr + c->index), n = c->length/sizeof(int16_t); n > 0; d++, n--) {
|
||||||
int32_t t;
|
int32_t t;
|
||||||
|
|
||||||
t = (int32_t)(INT16_SWAP(*d));
|
t = (int32_t)(PA_INT16_SWAP(*d));
|
||||||
t = (t * linear[channel]) / 0x10000;
|
t = (t * linear[channel]) / 0x10000;
|
||||||
t = CLAMP(t, -0x8000, 0x7FFF);
|
t = CLAMP(t, -0x8000, 0x7FFF);
|
||||||
*d = INT16_SWAP((int16_t) t);
|
*d = PA_INT16_SWAP((int16_t) t);
|
||||||
|
|
||||||
if (++channel >= spec->channels)
|
if (++channel >= spec->channels)
|
||||||
channel = 0;
|
channel = 0;
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
#include "endianmacros.h"
|
#include "endianmacros.h"
|
||||||
|
|
||||||
#define INT16_FROM INT16_FROM_BE
|
#define INT16_FROM PA_INT16_FROM_BE
|
||||||
#define INT16_TO INT16_TO_BE
|
#define INT16_TO PA_INT16_TO_BE
|
||||||
|
|
||||||
#define pa_sconv_s16le_to_float32ne pa_sconv_s16be_to_float32ne
|
#define pa_sconv_s16le_to_float32ne pa_sconv_s16be_to_float32ne
|
||||||
#define pa_sconv_s16le_from_float32ne pa_sconv_s16be_from_float32ne
|
#define pa_sconv_s16le_from_float32ne pa_sconv_s16be_from_float32ne
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,11 @@
|
||||||
#include "sconv-s16le.h"
|
#include "sconv-s16le.h"
|
||||||
|
|
||||||
#ifndef INT16_FROM
|
#ifndef INT16_FROM
|
||||||
#define INT16_FROM INT16_FROM_LE
|
#define INT16_FROM PA_INT16_FROM_LE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef INT16_TO
|
#ifndef INT16_TO
|
||||||
#define INT16_TO INT16_TO_LE
|
#define INT16_TO PA_INT16_TO_LE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SWAP_WORDS
|
#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++);
|
int16_t s = *(a++);
|
||||||
float k = ((float) INT16_FROM(s))/0x7FFF;
|
float k = ((float) INT16_FROM(s))/0x7FFF;
|
||||||
uint32_t *j = (uint32_t*) &k;
|
uint32_t *j = (uint32_t*) &k;
|
||||||
*j = UINT32_SWAP(*j);
|
*j = PA_UINT32_SWAP(*j);
|
||||||
*(b++) = k;
|
*(b++) = k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -116,7 +116,7 @@ void pa_sconv_s16le_from_float32re(unsigned n, const float *a, int16_t *b) {
|
||||||
int16_t s;
|
int16_t s;
|
||||||
float v = *(a++);
|
float v = *(a++);
|
||||||
uint32_t *j = (uint32_t*) &v;
|
uint32_t *j = (uint32_t*) &v;
|
||||||
*j = UINT32_SWAP(*j);
|
*j = PA_UINT32_SWAP(*j);
|
||||||
v = CLAMP(v, -1, 1);
|
v = CLAMP(v, -1, 1);
|
||||||
s = (int16_t) (v * 0x7FFF);
|
s = (int16_t) (v * 0x7FFF);
|
||||||
*(b++) = INT16_TO(s);
|
*(b++) = INT16_TO(s);
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ static void float32re_to_float32ne(unsigned n, const float *a, float *b) {
|
||||||
pa_assert(b);
|
pa_assert(b);
|
||||||
|
|
||||||
for (; n > 0; n--, a++, 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 */
|
/* s16 */
|
||||||
|
|
@ -111,7 +111,7 @@ static void s16re_to_s16ne(unsigned n, const int16_t *a, int16_t *b) {
|
||||||
pa_assert(b);
|
pa_assert(b);
|
||||||
|
|
||||||
for (; n > 0; n--, a++, b++)
|
for (; n > 0; n--, a++, b++)
|
||||||
*b = UINT16_SWAP(*a);
|
*b = PA_UINT16_SWAP(*a);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ulaw */
|
/* ulaw */
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
static float swap_float(float a) {
|
static float swap_float(float a) {
|
||||||
uint32_t *b = (uint32_t*) &a;
|
uint32_t *b = (uint32_t*) &a;
|
||||||
*b = UINT32_SWAP(*b);
|
*b = PA_UINT32_SWAP(*b);
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue