Fix up according to Coding Style

Only whitespace changes in here
This commit is contained in:
Maarten Bosmans 2011-03-02 12:41:26 +01:00 committed by Colin Guthrie
parent 5715b2af30
commit ecf09f2cd6
60 changed files with 297 additions and 418 deletions

View file

@ -796,7 +796,7 @@ static void update_smoother(struct userdata *u) {
} }
static pa_usec_t source_get_latency(struct userdata *u) { static pa_usec_t source_get_latency(struct userdata *u) {
int64_t delay; int64_t delay;
pa_usec_t now1, now2; pa_usec_t now1, now2;
pa_assert(u); pa_assert(u);

View file

@ -362,7 +362,7 @@ int pa_alsa_set_hw_params(
pa_log_debug("Set neither period nor buffer size."); pa_log_debug("Set neither period nor buffer size.");
/* Last chance, set nothing */ /* Last chance, set nothing */
if ((ret = snd_pcm_hw_params(pcm_handle, hwparams)) < 0) { if ((ret = snd_pcm_hw_params(pcm_handle, hwparams)) < 0) {
pa_log_info("snd_pcm_hw_params failed: %s", pa_alsa_strerror(ret)); pa_log_info("snd_pcm_hw_params failed: %s", pa_alsa_strerror(ret));
goto finish; goto finish;
} }

View file

@ -590,7 +590,7 @@ static void list_devices_reply(DBusPendingCall *pending, void *userdata) {
finish: finish:
if (paths) if (paths)
dbus_free_string_array (paths); dbus_free_string_array(paths);
dbus_message_unref(r); dbus_message_unref(r);
@ -598,8 +598,7 @@ finish:
pa_dbus_pending_free(p); pa_dbus_pending_free(p);
} }
static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const char *endpoint, const char *uuid) static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const char *endpoint, const char *uuid) {
{
DBusMessage *m; DBusMessage *m;
DBusMessageIter i, d; DBusMessageIter i, d;
uint8_t codec = 0; uint8_t codec = 0;
@ -699,7 +698,7 @@ static void list_adapters_reply(DBusPendingCall *pending, void *userdata) {
finish: finish:
if (paths) if (paths)
dbus_free_string_array (paths); dbus_free_string_array(paths);
dbus_message_unref(r); dbus_message_unref(r);

View file

@ -857,8 +857,7 @@ static int stop_stream_fd(struct userdata *u) {
return r; return r;
} }
static void bt_transport_release(struct userdata *u) static void bt_transport_release(struct userdata *u) {
{
const char *accesstype = "rw"; const char *accesstype = "rw";
const pa_bluetooth_transport *t; const pa_bluetooth_transport *t;
@ -891,8 +890,7 @@ static void bt_transport_release(struct userdata *u)
} }
} }
static int bt_transport_acquire(struct userdata *u, pa_bool_t start) static int bt_transport_acquire(struct userdata *u, pa_bool_t start) {
{
const char *accesstype = "rw"; const char *accesstype = "rw";
const pa_bluetooth_transport *t; const pa_bluetooth_transport *t;
@ -1679,8 +1677,8 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
dbus_message_get_path(m), dbus_message_get_path(m),
dbus_message_get_member(m)); dbus_message_get_member(m));
if (!dbus_message_has_path(m, u->path)) if (!dbus_message_has_path(m, u->path))
goto fail; goto fail;
if (dbus_message_is_signal(m, "org.bluez.Headset", "SpeakerGainChanged") || if (dbus_message_is_signal(m, "org.bluez.Headset", "SpeakerGainChanged") ||
dbus_message_is_signal(m, "org.bluez.Headset", "MicrophoneGainChanged")) { dbus_message_is_signal(m, "org.bluez.Headset", "MicrophoneGainChanged")) {
@ -2007,8 +2005,7 @@ static void shutdown_bt(struct userdata *u) {
} }
} }
static int bt_transport_config_a2dp(struct userdata *u) static int bt_transport_config_a2dp(struct userdata *u) {
{
const pa_bluetooth_transport *t; const pa_bluetooth_transport *t;
struct a2dp_info *a2dp = &u->a2dp; struct a2dp_info *a2dp = &u->a2dp;
sbc_capabilities_raw_t *config; sbc_capabilities_raw_t *config;
@ -2112,8 +2109,7 @@ static int bt_transport_config_a2dp(struct userdata *u)
return 0; return 0;
} }
static int bt_transport_config(struct userdata *u) static int bt_transport_config(struct userdata *u) {
{
if (u->profile == PROFILE_HSP || u->profile == PROFILE_HFGW) { if (u->profile == PROFILE_HSP || u->profile == PROFILE_HFGW) {
u->block_size = u->link_mtu; u->block_size = u->link_mtu;
return 0; return 0;
@ -2122,8 +2118,7 @@ static int bt_transport_config(struct userdata *u)
return bt_transport_config_a2dp(u); return bt_transport_config_a2dp(u);
} }
static int parse_transport_property(struct userdata *u, DBusMessageIter *i) static int parse_transport_property(struct userdata *u, DBusMessageIter *i) {
{
const char *key; const char *key;
DBusMessageIter variant_i; DBusMessageIter variant_i;
@ -2168,8 +2163,7 @@ static int parse_transport_property(struct userdata *u, DBusMessageIter *i)
} }
/* Run from main thread */ /* Run from main thread */
static int bt_transport_open(struct userdata *u) static int bt_transport_open(struct userdata *u) {
{
DBusMessage *m, *r; DBusMessage *m, *r;
DBusMessageIter arg_i, element_i; DBusMessageIter arg_i, element_i;
DBusError err; DBusError err;
@ -2855,10 +2849,7 @@ void pa__done(pa_module *m) {
speaker = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='SpeakerGainChanged',path='%s'", u->path); speaker = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='SpeakerGainChanged',path='%s'", u->path);
mike = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='MicrophoneGainChanged',path='%s'", u->path); mike = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='MicrophoneGainChanged',path='%s'", u->path);
pa_dbus_remove_matches(pa_dbus_connection_get(u->connection), pa_dbus_remove_matches(pa_dbus_connection_get(u->connection), speaker, mike, NULL);
speaker,
mike,
NULL);
pa_xfree(speaker); pa_xfree(speaker);
pa_xfree(mike); pa_xfree(mike);

View file

@ -42,7 +42,7 @@ static const char* const valid_modargs[] = {
}; };
static void pa_adrian_ec_fixate_spec(pa_sample_spec *source_ss, pa_channel_map *source_map, static void pa_adrian_ec_fixate_spec(pa_sample_spec *source_ss, pa_channel_map *source_map,
pa_sample_spec *sink_ss, pa_channel_map *sink_map) pa_sample_spec *sink_ss, pa_channel_map *sink_map)
{ {
source_ss->format = PA_SAMPLE_S16NE; source_ss->format = PA_SAMPLE_S16NE;
source_ss->channels = 1; source_ss->channels = 1;
@ -87,19 +87,18 @@ pa_bool_t pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec,
ec->params.priv.adrian.aec = AEC_init(rate, have_vector); ec->params.priv.adrian.aec = AEC_init(rate, have_vector);
if (!ec->params.priv.adrian.aec) if (!ec->params.priv.adrian.aec)
goto fail; goto fail;
pa_modargs_free(ma); pa_modargs_free(ma);
return TRUE; return TRUE;
fail: fail:
if (ma) if (ma)
pa_modargs_free(ma); pa_modargs_free(ma);
return FALSE; return FALSE;
} }
void pa_adrian_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) void pa_adrian_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) {
{
unsigned int i; unsigned int i;
for (i = 0; i < ec->params.priv.adrian.blocksize; i += 2) { for (i = 0; i < ec->params.priv.adrian.blocksize; i += 2) {
@ -110,8 +109,7 @@ void pa_adrian_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *
} }
} }
void pa_adrian_ec_done(pa_echo_canceller *ec) void pa_adrian_ec_done(pa_echo_canceller *ec) {
{
pa_xfree(ec->params.priv.adrian.aec); pa_xfree(ec->params.priv.adrian.aec);
ec->params.priv.adrian.aec = NULL; ec->params.priv.adrian.aec = NULL;
} }

View file

@ -290,7 +290,7 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim
* canceler does not work in this case. */ * canceler does not work in this case. */
pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->source_output), SOURCE_OUTPUT_MESSAGE_APPLY_DIFF_TIME, pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->source_output), SOURCE_OUTPUT_MESSAGE_APPLY_DIFF_TIME,
NULL, diff_time, NULL, NULL); NULL, diff_time, NULL, NULL);
//new_rate = base_rate - ((pa_usec_to_bytes (-diff_time, &u->source_output->sample_spec) / fs) * PA_USEC_PER_SEC) / u->adjust_time; //new_rate = base_rate - ((pa_usec_to_bytes(-diff_time, &u->source_output->sample_spec) / fs) * PA_USEC_PER_SEC) / u->adjust_time;
new_rate = base_rate; new_rate = base_rate;
} }
else { else {
@ -301,7 +301,7 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim
} }
/* recording behind playback, we need to slowly adjust the rate to match */ /* recording behind playback, we need to slowly adjust the rate to match */
//new_rate = base_rate + ((pa_usec_to_bytes (diff_time, &u->source_output->sample_spec) / fs) * PA_USEC_PER_SEC) / u->adjust_time; //new_rate = base_rate + ((pa_usec_to_bytes(diff_time, &u->source_output->sample_spec) / fs) * PA_USEC_PER_SEC) / u->adjust_time;
/* assume equal samplerates for now */ /* assume equal samplerates for now */
new_rate = base_rate; new_rate = base_rate;
@ -404,7 +404,7 @@ static int source_set_state_cb(pa_source *s, pa_source_state_t state) {
if (u->active_mask == 3) if (u->active_mask == 3)
pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time); pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time);
pa_atomic_store (&u->request_resync, 1); pa_atomic_store(&u->request_resync, 1);
pa_source_output_cork(u->source_output, FALSE); pa_source_output_cork(u->source_output, FALSE);
} else if (state == PA_SOURCE_SUSPENDED) { } else if (state == PA_SOURCE_SUSPENDED) {
u->active_mask &= ~1; u->active_mask &= ~1;
@ -432,7 +432,7 @@ static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) {
if (u->active_mask == 3) if (u->active_mask == 3)
pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time); pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time);
pa_atomic_store (&u->request_resync, 1); pa_atomic_store(&u->request_resync, 1);
pa_sink_input_cork(u->sink_input, FALSE); pa_sink_input_cork(u->sink_input, FALSE);
} else if (state == PA_SINK_SUSPENDED) { } else if (state == PA_SINK_SUSPENDED) {
u->active_mask &= ~2; u->active_mask &= ~2;
@ -597,7 +597,7 @@ static void apply_diff_time(struct userdata *u, int64_t diff_time) {
int64_t diff; int64_t diff;
if (diff_time < 0) { if (diff_time < 0) {
diff = pa_usec_to_bytes (-diff_time, &u->source_output->sample_spec); diff = pa_usec_to_bytes(-diff_time, &u->source_output->sample_spec);
if (diff > 0) { if (diff > 0) {
/* add some extra safety samples to compensate for jitter in the /* add some extra safety samples to compensate for jitter in the
@ -610,7 +610,7 @@ static void apply_diff_time(struct userdata *u, int64_t diff_time) {
u->source_skip = 0; u->source_skip = 0;
} }
} else if (diff_time > 0) { } else if (diff_time > 0) {
diff = pa_usec_to_bytes (diff_time, &u->source_output->sample_spec); diff = pa_usec_to_bytes(diff_time, &u->source_output->sample_spec);
if (diff > 0) { if (diff > 0) {
pa_log("playback too far ahead (%lld), drop source %lld", (long long) diff_time, (long long) diff); pa_log("playback too far ahead (%lld), drop source %lld", (long long) diff_time, (long long) diff);
@ -660,7 +660,7 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk)
u->in_push = FALSE; u->in_push = FALSE;
if (pa_atomic_cmpxchg (&u->request_resync, 1, 0)) { if (pa_atomic_cmpxchg (&u->request_resync, 1, 0)) {
do_resync (u); do_resync(u);
} }
pa_memblockq_push_align(u->source_memblockq, chunk); pa_memblockq_push_align(u->source_memblockq, chunk);
@ -770,7 +770,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
if (i->thread_info.underrun_for > 0) { if (i->thread_info.underrun_for > 0) {
pa_log_debug("Handling end of underrun."); pa_log_debug("Handling end of underrun.");
pa_atomic_store (&u->request_resync, 1); pa_atomic_store(&u->request_resync, 1);
} }
/* let source thread handle the chunk. pass the sample count as well so that /* let source thread handle the chunk. pass the sample count as well so that
@ -926,7 +926,7 @@ static void sink_input_update_max_rewind_cb(pa_sink_input *i, size_t nbytes) {
pa_log_debug("Sink input update max rewind %lld", (long long) nbytes); pa_log_debug("Sink input update max rewind %lld", (long long) nbytes);
pa_memblockq_set_maxrewind (u->sink_memblockq, nbytes); pa_memblockq_set_maxrewind(u->sink_memblockq, nbytes);
pa_sink_set_max_rewind_within_thread(u->sink, nbytes); pa_sink_set_max_rewind_within_thread(u->sink, nbytes);
} }
@ -1300,8 +1300,7 @@ static void sink_input_mute_changed_cb(pa_sink_input *i) {
pa_sink_mute_changed(u->sink, i->muted); pa_sink_mute_changed(u->sink, i->muted);
} }
static pa_echo_canceller_method_t get_ec_method_from_string(const char *method) static pa_echo_canceller_method_t get_ec_method_from_string(const char *method) {
{
if (strcmp(method, "speex") == 0) if (strcmp(method, "speex") == 0)
return PA_ECHO_CANCELLER_SPEEX; return PA_ECHO_CANCELLER_SPEEX;
else if (strcmp(method, "adrian") == 0) else if (strcmp(method, "adrian") == 0)
@ -1615,7 +1614,7 @@ int pa__init(pa_module*m) {
return 0; return 0;
fail: fail:
if (ma) if (ma)
pa_modargs_free(ma); pa_modargs_free(ma);

View file

@ -40,7 +40,7 @@ static const char* const valid_modargs[] = {
}; };
static void pa_speex_ec_fixate_spec(pa_sample_spec *source_ss, pa_channel_map *source_map, static void pa_speex_ec_fixate_spec(pa_sample_spec *source_ss, pa_channel_map *source_map,
pa_sample_spec *sink_ss, pa_channel_map *sink_map) pa_sample_spec *sink_ss, pa_channel_map *sink_map)
{ {
source_ss->format = PA_SAMPLE_S16NE; source_ss->format = PA_SAMPLE_S16NE;
@ -91,7 +91,7 @@ pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec,
ec->params.priv.speex.state = speex_echo_state_init_mc (framelen, (rate * filter_size_ms) / 1000, source_ss->channels, source_ss->channels); ec->params.priv.speex.state = speex_echo_state_init_mc (framelen, (rate * filter_size_ms) / 1000, source_ss->channels, source_ss->channels);
if (!ec->params.priv.speex.state) if (!ec->params.priv.speex.state)
goto fail; goto fail;
speex_echo_ctl(ec->params.priv.speex.state, SPEEX_ECHO_SET_SAMPLING_RATE, &rate); speex_echo_ctl(ec->params.priv.speex.state, SPEEX_ECHO_SET_SAMPLING_RATE, &rate);
@ -100,17 +100,15 @@ pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec,
fail: fail:
if (ma) if (ma)
pa_modargs_free(ma); pa_modargs_free(ma);
return FALSE; return FALSE;
} }
void pa_speex_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) void pa_speex_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) {
{
speex_echo_cancellation(ec->params.priv.speex.state, (const spx_int16_t *) rec, (const spx_int16_t *) play, (spx_int16_t *) out); speex_echo_cancellation(ec->params.priv.speex.state, (const spx_int16_t *) rec, (const spx_int16_t *) play, (spx_int16_t *) out);
} }
void pa_speex_ec_done(pa_echo_canceller *ec) void pa_speex_ec_done(pa_echo_canceller *ec) {
{ speex_echo_state_destroy(ec->params.priv.speex.state);
speex_echo_state_destroy (ec->params.priv.speex.state);
ec->params.priv.speex.state = NULL; ec->params.priv.speex.state = NULL;
} }

View file

@ -84,8 +84,7 @@ struct userdata {
}; };
static void ensure_ports_stopped(struct userdata* u) static void ensure_ports_stopped(struct userdata* u) {
{
int i; int i;
pa_assert(u); pa_assert(u);
@ -97,8 +96,7 @@ static void ensure_ports_stopped(struct userdata* u)
} }
} }
static void ensure_ports_started(struct userdata* u) static void ensure_ports_started(struct userdata* u) {
{
int i; int i;
pa_assert(u); pa_assert(u);
@ -120,8 +118,7 @@ static void ensure_ports_started(struct userdata* u)
} }
static pa_bool_t check_service_started(struct userdata* u) static pa_bool_t check_service_started(struct userdata* u) {
{
DBusError error; DBusError error;
DBusMessage *m = NULL, *reply = NULL; DBusMessage *m = NULL, *reply = NULL;
pa_bool_t new_status = FALSE; pa_bool_t new_status = FALSE;
@ -169,8 +166,7 @@ finish:
return new_status; return new_status;
} }
static DBusHandlerResult dbus_filter_handler(DBusConnection *c, DBusMessage *s, void *userdata) static DBusHandlerResult dbus_filter_handler(DBusConnection *c, DBusMessage *s, void *userdata) {
{
struct userdata *u = NULL; struct userdata *u = NULL;
DBusError error; DBusError error;
@ -182,13 +178,11 @@ static DBusHandlerResult dbus_filter_handler(DBusConnection *c, DBusMessage *s,
if (dbus_message_is_signal(s, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) { if (dbus_message_is_signal(s, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
const char *name, *old, *new; const char *name, *old, *new;
if (!dbus_message_get_args( if (!dbus_message_get_args(s, &error,
s, DBUS_TYPE_STRING, &name,
&error, DBUS_TYPE_STRING, &old,
DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &new,
DBUS_TYPE_STRING, &old, DBUS_TYPE_INVALID))
DBUS_TYPE_STRING, &new,
DBUS_TYPE_INVALID))
goto finish; goto finish;
if (strcmp(name, JACK_SERVICE_NAME)) if (strcmp(name, JACK_SERVICE_NAME))
goto finish; goto finish;
@ -211,8 +205,7 @@ finish:
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} }
int pa__init(pa_module *m) int pa__init(pa_module *m) {
{
DBusError error; DBusError error;
pa_dbus_connection *connection = NULL; pa_dbus_connection *connection = NULL;
struct userdata *u = NULL; struct userdata *u = NULL;
@ -275,8 +268,7 @@ fail:
return -1; return -1;
} }
void pa__done(pa_module *m) void pa__done(pa_module *m) {
{
struct userdata *u; struct userdata *u;
pa_assert(m); pa_assert(m);

View file

@ -191,9 +191,7 @@ static void update_rule(struct rule *r) {
continue; continue;
pa_xfree(fn); pa_xfree(fn);
fn = pa_sprintf_malloc(DESKTOPFILEDIR fn = pa_sprintf_malloc(DESKTOPFILEDIR PA_PATH_SEP "%s" PA_PATH_SEP "%s.desktop", dir->d_name, r->process_name);
PA_PATH_SEP "%s" PA_PATH_SEP "%s.desktop",
dir->d_name, r->process_name);
if (stat(fn, &st) == 0) { if (stat(fn, &st) == 0) {
found = TRUE; found = TRUE;

View file

@ -557,7 +557,7 @@ static int sink_input_process_msg(pa_msgobject *obj, int code, void *data, int64
switch (code) { switch (code) {
case PA_SINK_INPUT_MESSAGE_GET_LATENCY: { case PA_SINK_INPUT_MESSAGE_GET_LATENCY: {
pa_usec_t *r = data; pa_usec_t *r = data;
*r = pa_bytes_to_usec(pa_memblockq_get_length(o->memblockq), &o->sink_input->sample_spec); *r = pa_bytes_to_usec(pa_memblockq_get_length(o->memblockq), &o->sink_input->sample_spec);

View file

@ -77,7 +77,7 @@ static void add_session(struct userdata *u, const char *id) {
struct session *session; struct session *session;
pa_client_new_data data; pa_client_new_data data;
dbus_error_init (&error); dbus_error_init(&error);
if (pa_hashmap_get(u->sessions, id)) { if (pa_hashmap_get(u->sessions, id)) {
pa_log_warn("Duplicate session %s, ignoring.", id); pa_log_warn("Duplicate session %s, ignoring.", id);

View file

@ -144,7 +144,7 @@ static int detect_oss(pa_core *c, int just_one) {
line[strcspn(line, "\r\n")] = 0; line[strcspn(line, "\r\n")] = 0;
if (!b) { if (!b) {
b = strcmp(line, "Audio devices:") == 0 || strcmp(line, "Installed devices:") == 0; b = strcmp(line, "Audio devices:") == 0 || strcmp(line, "Installed devices:") == 0;
continue; continue;
} }

View file

@ -1174,7 +1174,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
goto fail; goto fail;
if (PA_INVALID_INDEX == (role_index = get_role_index(role))) if (PA_INVALID_INDEX == (role_index = get_role_index(role)))
goto fail; goto fail;
/* Cycle through the devices given and make sure they exist */ /* Cycle through the devices given and make sure they exist */
h = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); h = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
@ -1209,9 +1209,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
if (first) { if (first) {
first = FALSE; first = FALSE;
sink_mode = (0 == strncmp("sink:", s, 5)); sink_mode = (0 == strncmp("sink:", s, 5));
} else if ((sink_mode && 0 != strncmp("sink:", s, 5)) } else if ((sink_mode && 0 != strncmp("sink:", s, 5)) || (!sink_mode && 0 != strncmp("source:", s, 7))) {
|| (!sink_mode && 0 != strncmp("source:", s, 7)))
{
while ((device = pa_hashmap_steal_first(h))) { while ((device = pa_hashmap_steal_first(h))) {
pa_xfree(device->device); pa_xfree(device->device);
pa_xfree(device); pa_xfree(device);

View file

@ -437,9 +437,9 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in
switch (code) { switch (code) {
case PA_SINK_INPUT_MESSAGE_GET_LATENCY: { case PA_SINK_INPUT_MESSAGE_GET_LATENCY: {
pa_usec_t *r = data; pa_usec_t *r = data;
pa_sink_input_assert_io_context(u->sink_input); pa_sink_input_assert_io_context(u->sink_input);
*r = pa_bytes_to_usec(pa_memblockq_get_length(u->memblockq), &u->sink_input->sample_spec); *r = pa_bytes_to_usec(pa_memblockq_get_length(u->memblockq), &u->sink_input->sample_spec);

View file

@ -362,7 +362,7 @@ void pa__done(pa_module*m) {
pa_sink_unref(u->sink); pa_sink_unref(u->sink);
if (u->memchunk.memblock) if (u->memchunk.memblock)
pa_memblock_unref(u->memchunk.memblock); pa_memblock_unref(u->memchunk.memblock);
if (u->rtpoll_item) if (u->rtpoll_item)
pa_rtpoll_item_free(u->rtpoll_item); pa_rtpoll_item_free(u->rtpoll_item);

View file

@ -723,10 +723,7 @@ static DBusHandlerResult root_handler(DBusConnection *c, DBusMessage *m, void *u
const char *xml = ROOT_INTROSPECT_XML; const char *xml = ROOT_INTROSPECT_XML;
pa_assert_se(r = dbus_message_new_method_return(m)); pa_assert_se(r = dbus_message_new_method_return(m));
pa_assert_se(dbus_message_append_args( pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID));
r,
DBUS_TYPE_STRING, &xml,
DBUS_TYPE_INVALID));
} else } else
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@ -938,10 +935,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
xml = pa_strbuf_tostring_free(sb); xml = pa_strbuf_tostring_free(sb);
pa_assert_se(r = dbus_message_new_method_return(m)); pa_assert_se(r = dbus_message_new_method_return(m));
pa_assert_se(dbus_message_append_args( pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID));
r,
DBUS_TYPE_STRING, &xml,
DBUS_TYPE_INVALID));
pa_xfree(xml); pa_xfree(xml);
} else } else
@ -1012,10 +1006,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
ITEM_INTROSPECT_XML; ITEM_INTROSPECT_XML;
pa_assert_se(r = dbus_message_new_method_return(m)); pa_assert_se(r = dbus_message_new_method_return(m));
pa_assert_se(dbus_message_append_args( pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID));
r,
DBUS_TYPE_STRING, &xml,
DBUS_TYPE_INVALID));
} else } else
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;

View file

@ -307,8 +307,8 @@ static int auto_format(int fd, int mode, pa_sample_spec *ss) {
info.record.encoding = AUDIO_ENCODING_LINEAR; info.record.encoding = AUDIO_ENCODING_LINEAR;
break; break;
default: default:
pa_log("AUDIO_SETINFO: Unsupported sample format."); pa_log("AUDIO_SETINFO: Unsupported sample format.");
return -1; return -1;
} }
} }

View file

@ -379,7 +379,7 @@ static void command_stream_buffer_attr_changed(pa_pdispatch *pd, uint32_t comman
/* Called from main context */ /* Called from main context */
static void command_started(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { static void command_started(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
struct userdata *u = userdata; struct userdata *u = userdata;
pa_assert(pd); pa_assert(pd);
pa_assert(t); pa_assert(t);
@ -973,8 +973,7 @@ static void server_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
pa_tagstruct_gets(t, &default_sink_name) < 0 || pa_tagstruct_gets(t, &default_sink_name) < 0 ||
pa_tagstruct_gets(t, &default_source_name) < 0 || pa_tagstruct_gets(t, &default_source_name) < 0 ||
pa_tagstruct_getu32(t, &cookie) < 0 || pa_tagstruct_getu32(t, &cookie) < 0 ||
(u->version >= 15 && (u->version >= 15 && pa_tagstruct_get_channel_map(t, &cm) < 0)) {
pa_tagstruct_get_channel_map(t, &cm) < 0)) {
pa_log("Parse failure"); pa_log("Parse failure");
goto fail; goto fail;

View file

@ -442,8 +442,7 @@ static void process_device(struct userdata *u, struct udev_device *dev) {
if (action && pa_streq(action, "remove")) if (action && pa_streq(action, "remove"))
remove_card(u, dev); remove_card(u, dev);
else if ((!action || pa_streq(action, "change")) && else if ((!action || pa_streq(action, "change")) && udev_device_get_property_value(dev, "SOUND_INITIALIZED"))
udev_device_get_property_value(dev, "SOUND_INITIALIZED"))
card_changed(u, dev); card_changed(u, dev);
/* For an explanation why we don't look for 'add' events here /* For an explanation why we don't look for 'add' events here

View file

@ -620,7 +620,7 @@ int pa__init(pa_module*m) {
return 0; return 0;
fail: fail:
if (ma) if (ma)
pa_modargs_free(ma); pa_modargs_free(ma);

View file

@ -715,7 +715,7 @@ int pa__init(pa_module*m) {
return 0; return 0;
fail: fail:
if (ma) if (ma)
pa_modargs_free(ma); pa_modargs_free(ma);
@ -763,7 +763,7 @@ void pa__done(pa_module*m) {
pa_memblockq_free(u->memblockq); pa_memblockq_free(u->memblockq);
if (u->sink_memblockq) if (u->sink_memblockq)
pa_memblockq_free(u->sink_memblockq); pa_memblockq_free(u->sink_memblockq);
pa_xfree(u); pa_xfree(u);
} }

View file

@ -169,7 +169,7 @@ static void trigger(struct userdata *u, pa_bool_t quick) {
if (u->fd < 0) if (u->fd < 0)
return; return;
pa_log_debug("trigger"); pa_log_debug("trigger");
if (u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state)) if (u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state))
enable_bits |= PCM_ENABLE_INPUT; enable_bits |= PCM_ENABLE_INPUT;

View file

@ -38,8 +38,7 @@
static const char base64_chars[] = static const char base64_chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static int pos(char c) static int pos(char c) {
{
if (c >= 'A' && c <= 'Z') return c - 'A' + 0; if (c >= 'A' && c <= 'Z') return c - 'A' + 0;
if (c >= 'a' && c <= 'z') return c - 'a' + 26; if (c >= 'a' && c <= 'z') return c - 'a' + 26;
if (c >= '0' && c <= '9') return c - '0' + 52; if (c >= '0' && c <= '9') return c - '0' + 52;
@ -48,8 +47,7 @@ static int pos(char c)
return -1; return -1;
} }
int pa_base64_encode(const void *data, int size, char **str) int pa_base64_encode(const void *data, int size, char **str) {
{
char *s, *p; char *s, *p;
int i; int i;
int c; int c;
@ -84,8 +82,7 @@ int pa_base64_encode(const void *data, int size, char **str)
#define DECODE_ERROR 0xffffffff #define DECODE_ERROR 0xffffffff
static unsigned int token_decode(const char *token) static unsigned int token_decode(const char *token) {
{
int i; int i;
unsigned int val = 0; unsigned int val = 0;
int marker = 0; int marker = 0;
@ -109,8 +106,7 @@ static unsigned int token_decode(const char *token)
return (marker << 24) | val; return (marker << 24) | val;
} }
int pa_base64_decode(const char *str, void *data) int pa_base64_decode(const char *str, void *data) {
{
const char *p; const char *p;
unsigned char *q; unsigned char *q;

View file

@ -174,8 +174,7 @@ static int rsa_encrypt(uint8_t *text, int len, uint8_t *res) {
return size; return size;
} }
static int aes_encrypt(pa_raop_client* c, uint8_t *data, int size) static int aes_encrypt(pa_raop_client* c, uint8_t *data, int size) {
{
uint8_t *buf; uint8_t *buf;
int i=0, j; int i=0, j;
@ -194,8 +193,7 @@ static int aes_encrypt(pa_raop_client* c, uint8_t *data, int size)
return i; return i;
} }
static inline void rtrimchar(char *str, char rc) static inline void rtrimchar(char *str, char rc) {
{
char *sp = str + strlen(str) - 1; char *sp = str + strlen(str) - 1;
while (sp >= str && *sp == rc) { while (sp >= str && *sp == rc) {
*sp = '\0'; *sp = '\0';
@ -232,8 +230,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata
c->callback(c->fd, c->userdata); c->callback(c->fd, c->userdata);
} }
static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* headers, void *userdata) static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* headers, void *userdata) {
{
pa_raop_client* c = userdata; pa_raop_client* c = userdata;
pa_assert(c); pa_assert(c);
pa_assert(rtsp); pa_assert(rtsp);
@ -368,8 +365,7 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* he
} }
} }
pa_raop_client* pa_raop_client_new(pa_core *core, const char* host) pa_raop_client* pa_raop_client_new(pa_core *core, const char* host) {
{
pa_raop_client* c = pa_xnew0(pa_raop_client, 1); pa_raop_client* c = pa_xnew0(pa_raop_client, 1);
pa_assert(core); pa_assert(core);
@ -387,8 +383,7 @@ pa_raop_client* pa_raop_client_new(pa_core *core, const char* host)
} }
void pa_raop_client_free(pa_raop_client* c) void pa_raop_client_free(pa_raop_client* c) {
{
pa_assert(c); pa_assert(c);
if (c->rtsp) if (c->rtsp)
@ -398,8 +393,7 @@ void pa_raop_client_free(pa_raop_client* c)
} }
int pa_raop_connect(pa_raop_client* c) int pa_raop_connect(pa_raop_client* c) {
{
char *sci; char *sci;
struct { struct {
uint32_t a; uint32_t a;
@ -433,8 +427,7 @@ int pa_raop_connect(pa_raop_client* c)
} }
int pa_raop_flush(pa_raop_client* c) int pa_raop_flush(pa_raop_client* c) {
{
pa_assert(c); pa_assert(c);
pa_rtsp_flush(c->rtsp, c->seq, c->rtptime); pa_rtsp_flush(c->rtsp, c->seq, c->rtptime);
@ -442,8 +435,7 @@ int pa_raop_flush(pa_raop_client* c)
} }
int pa_raop_client_set_volume(pa_raop_client* c, pa_volume_t volume) int pa_raop_client_set_volume(pa_raop_client* c, pa_volume_t volume) {
{
int rv; int rv;
double db; double db;
char *param; char *param;
@ -465,8 +457,7 @@ int pa_raop_client_set_volume(pa_raop_client* c, pa_volume_t volume)
} }
int pa_raop_client_encode_sample(pa_raop_client* c, pa_memchunk* raw, pa_memchunk* encoded) int pa_raop_client_encode_sample(pa_raop_client* c, pa_memchunk* raw, pa_memchunk* encoded) {
{
uint16_t len; uint16_t len;
size_t bufmax; size_t bufmax;
uint8_t *bp, bpos; uint8_t *bp, bpos;
@ -548,16 +539,14 @@ int pa_raop_client_encode_sample(pa_raop_client* c, pa_memchunk* raw, pa_memchun
} }
void pa_raop_client_set_callback(pa_raop_client* c, pa_raop_client_cb_t callback, void *userdata) void pa_raop_client_set_callback(pa_raop_client* c, pa_raop_client_cb_t callback, void *userdata) {
{
pa_assert(c); pa_assert(c);
c->callback = callback; c->callback = callback;
c->userdata = userdata; c->userdata = userdata;
} }
void pa_raop_client_set_closed_callback(pa_raop_client* c, pa_raop_client_closed_cb_t callback, void *userdata) void pa_raop_client_set_closed_callback(pa_raop_client* c, pa_raop_client_closed_cb_t callback, void *userdata) {
{
pa_assert(c); pa_assert(c);
c->closed_callback = callback; c->closed_callback = callback;

View file

@ -372,8 +372,7 @@ void pa_rtsp_set_url(pa_rtsp_client* c, const char* url) {
c->url = pa_xstrdup(url); c->url = pa_xstrdup(url);
} }
void pa_rtsp_add_header(pa_rtsp_client *c, const char* key, const char* value) void pa_rtsp_add_header(pa_rtsp_client *c, const char* key, const char* value) {
{
pa_assert(c); pa_assert(c);
pa_assert(key); pa_assert(key);
pa_assert(value); pa_assert(value);
@ -381,8 +380,7 @@ void pa_rtsp_add_header(pa_rtsp_client *c, const char* key, const char* value)
pa_headerlist_puts(c->headers, key, value); pa_headerlist_puts(c->headers, key, value);
} }
void pa_rtsp_remove_header(pa_rtsp_client *c, const char* key) void pa_rtsp_remove_header(pa_rtsp_client *c, const char* key) {
{
pa_assert(c); pa_assert(c);
pa_assert(key); pa_assert(key);

View file

@ -336,7 +336,7 @@ static void glib_time_restart(pa_time_event*e, const struct timeval *tv) {
e->mainloop->cached_next_time_event = e; e->mainloop->cached_next_time_event = e;
} else if (e->mainloop->cached_next_time_event == e) } else if (e->mainloop->cached_next_time_event == e)
e->mainloop->cached_next_time_event = NULL; e->mainloop->cached_next_time_event = NULL;
} }
static void glib_time_free(pa_time_event *e) { static void glib_time_free(pa_time_event *e) {
g_assert(e); g_assert(e);

View file

@ -790,7 +790,7 @@ void pa_command_overflow_or_underflow(pa_pdispatch *pd, uint32_t command, uint32
s->underflow_callback(s, s->underflow_userdata); s->underflow_callback(s, s->underflow_userdata);
} }
finish: finish:
pa_context_unref(c); pa_context_unref(c);
} }

View file

@ -217,12 +217,12 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
#ifdef OS_IS_WIN32 #ifdef OS_IS_WIN32
r = mkdir(dir); r = mkdir(dir);
#else #else
{ {
mode_t u; mode_t u;
u = umask((~m) & 0777); u = umask((~m) & 0777);
r = mkdir(dir, m); r = mkdir(dir, m);
umask(u); umask(u);
} }
#endif #endif
if (r < 0 && errno != EEXIST) if (r < 0 && errno != EEXIST)
@ -1043,8 +1043,7 @@ static int is_group(gid_t gid, const char *name) {
int r = -1; int r = -1;
errno = 0; errno = 0;
if (!(group = pa_getgrgid_malloc(gid))) if (!(group = pa_getgrgid_malloc(gid))) {
{
if (!errno) if (!errno)
errno = ENOENT; errno = ENOENT;
@ -1110,8 +1109,7 @@ int pa_uid_in_group(uid_t uid, const char *name) {
int r = -1; int r = -1;
errno = 0; errno = 0;
if (!(group = pa_getgrnam_malloc(name))) if (!(group = pa_getgrnam_malloc(name))) {
{
if (!errno) if (!errno)
errno = ENOENT; errno = ENOENT;
goto finish; goto finish;
@ -1146,8 +1144,7 @@ gid_t pa_get_gid_of_group(const char *name) {
struct group *gr = NULL; struct group *gr = NULL;
errno = 0; errno = 0;
if (!(gr = pa_getgrnam_malloc(name))) if (!(gr = pa_getgrnam_malloc(name))) {
{
if (!errno) if (!errno)
errno = ENOENT; errno = ENOENT;
goto finish; goto finish;

View file

@ -39,22 +39,22 @@
#define MAX_BUFFER 4096 #define MAX_BUFFER 4096
static char * static char *
get_cpuinfo_line (char *cpuinfo, const char *tag) { get_cpuinfo_line(char *cpuinfo, const char *tag) {
char *line, *end, *colon; char *line, *end, *colon;
if (!(line = strstr (cpuinfo, tag))) if (!(line = strstr(cpuinfo, tag)))
return NULL; return NULL;
if (!(end = strchr (line, '\n'))) if (!(end = strchr(line, '\n')))
return NULL; return NULL;
if (!(colon = strchr (line, ':'))) if (!(colon = strchr(line, ':')))
return NULL; return NULL;
if (++colon >= end) if (++colon >= end)
return NULL; return NULL;
return pa_xstrndup (colon, end - colon); return pa_xstrndup(colon, end - colon);
} }
static char *get_cpuinfo(void) { static char *get_cpuinfo(void) {
@ -80,7 +80,7 @@ static char *get_cpuinfo(void) {
} }
#endif /* defined (__arm__) && defined (__linux__) */ #endif /* defined (__arm__) && defined (__linux__) */
pa_bool_t pa_cpu_init_arm (pa_cpu_arm_flag_t *flags) { pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags) {
#if defined (__arm__) #if defined (__arm__)
#if defined (__linux__) #if defined (__linux__)
char *cpuinfo, *line; char *cpuinfo, *line;
@ -88,16 +88,16 @@ pa_bool_t pa_cpu_init_arm (pa_cpu_arm_flag_t *flags) {
/* We need to read the CPU flags from /proc/cpuinfo because there is no user /* We need to read the CPU flags from /proc/cpuinfo because there is no user
* space support to get the CPU features. This only works on linux AFAIK. */ * space support to get the CPU features. This only works on linux AFAIK. */
if (!(cpuinfo = get_cpuinfo ())) { if (!(cpuinfo = get_cpuinfo())) {
pa_log ("Can't read cpuinfo"); pa_log("Can't read cpuinfo");
return; return;
} }
*flags = 0; *flags = 0;
/* get the CPU architecture */ /* get the CPU architecture */
if ((line = get_cpuinfo_line (cpuinfo, "CPU architecture"))) { if ((line = get_cpuinfo_line(cpuinfo, "CPU architecture"))) {
arch = strtoul (line, NULL, 0); arch = strtoul(line, NULL, 0);
if (arch >= 6) if (arch >= 6)
*flags |= PA_CPU_ARM_V6; *flags |= PA_CPU_ARM_V6;
if (arch >= 7) if (arch >= 7)
@ -106,18 +106,18 @@ pa_bool_t pa_cpu_init_arm (pa_cpu_arm_flag_t *flags) {
pa_xfree(line); pa_xfree(line);
} }
/* get the CPU features */ /* get the CPU features */
if ((line = get_cpuinfo_line (cpuinfo, "Features"))) { if ((line = get_cpuinfo_line(cpuinfo, "Features"))) {
const char *state = NULL; const char *state = NULL;
char *current; char *current;
while ((current = pa_split_spaces (line, &state))) { while ((current = pa_split_spaces(line, &state))) {
if (!strcmp (current, "vfp")) if (!strcmp(current, "vfp"))
*flags |= PA_CPU_ARM_VFP; *flags |= PA_CPU_ARM_VFP;
else if (!strcmp (current, "edsp")) else if (!strcmp(current, "edsp"))
*flags |= PA_CPU_ARM_EDSP; *flags |= PA_CPU_ARM_EDSP;
else if (!strcmp (current, "neon")) else if (!strcmp(current, "neon"))
*flags |= PA_CPU_ARM_NEON; *flags |= PA_CPU_ARM_NEON;
else if (!strcmp (current, "vfpv3")) else if (!strcmp(current, "vfpv3"))
*flags |= PA_CPU_ARM_VFPV3; *flags |= PA_CPU_ARM_VFPV3;
pa_xfree(current); pa_xfree(current);
@ -125,7 +125,7 @@ pa_bool_t pa_cpu_init_arm (pa_cpu_arm_flag_t *flags) {
} }
pa_xfree(cpuinfo); pa_xfree(cpuinfo);
pa_log_info ("CPU flags: %s%s%s%s%s%s", pa_log_info("CPU flags: %s%s%s%s%s%s",
(*flags & PA_CPU_ARM_V6) ? "V6 " : "", (*flags & PA_CPU_ARM_V6) ? "V6 " : "",
(*flags & PA_CPU_ARM_V7) ? "V7 " : "", (*flags & PA_CPU_ARM_V7) ? "V7 " : "",
(*flags & PA_CPU_ARM_VFP) ? "VFP " : "", (*flags & PA_CPU_ARM_VFP) ? "VFP " : "",
@ -134,7 +134,7 @@ pa_bool_t pa_cpu_init_arm (pa_cpu_arm_flag_t *flags) {
(*flags & PA_CPU_ARM_VFPV3) ? "VFPV3 " : ""); (*flags & PA_CPU_ARM_VFPV3) ? "VFPV3 " : "");
if (*flags & PA_CPU_ARM_V6) if (*flags & PA_CPU_ARM_V6)
pa_volume_func_init_arm (*flags); pa_volume_func_init_arm(*flags);
return TRUE; return TRUE;

View file

@ -31,9 +31,7 @@
#include "cpu-x86.h" #include "cpu-x86.h"
#if defined (__i386__) || defined (__amd64__) #if defined (__i386__) || defined (__amd64__)
static void static void get_cpuid(uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d) {
get_cpuid (uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
{
__asm__ __volatile__ ( __asm__ __volatile__ (
" push %%"PA_REG_b" \n\t" " push %%"PA_REG_b" \n\t"
" cpuid \n\t" " cpuid \n\t"
@ -46,7 +44,7 @@ get_cpuid (uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
} }
#endif #endif
pa_bool_t pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags) { pa_bool_t pa_cpu_init_x86(pa_cpu_x86_flag_t *flags) {
#if defined (__i386__) || defined (__amd64__) #if defined (__i386__) || defined (__amd64__)
uint32_t eax, ebx, ecx, edx; uint32_t eax, ebx, ecx, edx;
uint32_t level; uint32_t level;
@ -54,9 +52,9 @@ pa_bool_t pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags) {
*flags = 0; *flags = 0;
/* get standard level */ /* get standard level */
get_cpuid (0x00000000, &level, &ebx, &ecx, &edx); get_cpuid(0x00000000, &level, &ebx, &ecx, &edx);
if (level >= 1) { if (level >= 1) {
get_cpuid (0x00000001, &eax, &ebx, &ecx, &edx); get_cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
if (edx & (1<<15)) if (edx & (1<<15))
*flags |= PA_CPU_X86_CMOV; *flags |= PA_CPU_X86_CMOV;
@ -84,9 +82,9 @@ pa_bool_t pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags) {
} }
/* get extended level */ /* get extended level */
get_cpuid (0x80000000, &level, &ebx, &ecx, &edx); get_cpuid(0x80000000, &level, &ebx, &ecx, &edx);
if (level >= 0x80000001) { if (level >= 0x80000001) {
get_cpuid (0x80000001, &eax, &ebx, &ecx, &edx); get_cpuid(0x80000001, &eax, &ebx, &ecx, &edx);
if (edx & (1<<22)) if (edx & (1<<22))
*flags |= PA_CPU_X86_MMXEXT; *flags |= PA_CPU_X86_MMXEXT;
@ -101,7 +99,7 @@ pa_bool_t pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags) {
*flags |= PA_CPU_X86_3DNOW; *flags |= PA_CPU_X86_3DNOW;
} }
pa_log_info ("CPU flags: %s%s%s%s%s%s%s%s%s%s%s", pa_log_info("CPU flags: %s%s%s%s%s%s%s%s%s%s%s",
(*flags & PA_CPU_X86_CMOV) ? "CMOV " : "", (*flags & PA_CPU_X86_CMOV) ? "CMOV " : "",
(*flags & PA_CPU_X86_MMX) ? "MMX " : "", (*flags & PA_CPU_X86_MMX) ? "MMX " : "",
(*flags & PA_CPU_X86_SSE) ? "SSE " : "", (*flags & PA_CPU_X86_SSE) ? "SSE " : "",
@ -116,14 +114,14 @@ pa_bool_t pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags) {
/* activate various optimisations */ /* activate various optimisations */
if (*flags & PA_CPU_X86_MMX) { if (*flags & PA_CPU_X86_MMX) {
pa_volume_func_init_mmx (*flags); pa_volume_func_init_mmx(*flags);
pa_remap_func_init_mmx (*flags); pa_remap_func_init_mmx(*flags);
} }
if (*flags & (PA_CPU_X86_SSE | PA_CPU_X86_SSE2)) { if (*flags & (PA_CPU_X86_SSE | PA_CPU_X86_SSE2)) {
pa_volume_func_init_sse (*flags); pa_volume_func_init_sse(*flags);
pa_remap_func_init_sse (*flags); pa_remap_func_init_sse(*flags);
pa_convert_func_init_sse (*flags); pa_convert_func_init_sse(*flags);
} }
return TRUE; return TRUE;

View file

@ -429,7 +429,7 @@ static int write_uint(FILE *f, const uint32_t num) {
errno = 0; errno = 0;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
values[i] = (num >> (i*8)) & 0xFF; values[i] = (num >> (i*8)) & 0xFF;
items = fwrite(&values, sizeof(values), sizeof(uint8_t), f); items = fwrite(&values, sizeof(values), sizeof(uint8_t), f);

View file

@ -212,7 +212,7 @@ int pa_ip_acl_check(pa_ip_acl *acl, int fd) {
return 1; return 1;
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
} else if (e->family == AF_INET6) { } else if (e->family == AF_INET6) {
int i, bits ; int i, bits;
struct sockaddr_in6 *sai = (struct sockaddr_in6*) &sa; struct sockaddr_in6 *sai = (struct sockaddr_in6*) &sa;
if (e->bits == 128) if (e->bits == 128)

View file

@ -531,9 +531,7 @@ static void memblock_free(pa_memblock *b) {
pa_mutex_lock(import->mutex); pa_mutex_lock(import->mutex);
pa_assert_se(pa_hashmap_remove( pa_assert_se(pa_hashmap_remove(import->blocks, PA_UINT32_TO_PTR(b->per_type.imported.id)));
import->blocks,
PA_UINT32_TO_PTR(b->per_type.imported.id)));
pa_assert(segment->n_blocks >= 1); pa_assert(segment->n_blocks >= 1);
if (-- segment->n_blocks <= 0) if (-- segment->n_blocks <= 0)
@ -693,9 +691,7 @@ static void memblock_replace_import(pa_memblock *b) {
pa_mutex_lock(import->mutex); pa_mutex_lock(import->mutex);
pa_assert_se(pa_hashmap_remove( pa_assert_se(pa_hashmap_remove(import->blocks, PA_UINT32_TO_PTR(b->per_type.imported.id)));
import->blocks,
PA_UINT32_TO_PTR(b->per_type.imported.id)));
memblock_make_local(b); memblock_make_local(b);

View file

@ -376,8 +376,8 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
size_t d; size_t d;
pa_assert(bq->write_index + (int64_t)chunk.length > q->index && pa_assert(bq->write_index + (int64_t)chunk.length > q->index &&
bq->write_index + (int64_t)chunk.length < q->index + (int64_t)q->chunk.length && bq->write_index + (int64_t)chunk.length < q->index + (int64_t)q->chunk.length &&
bq->write_index < q->index); bq->write_index < q->index);
/* The job overwrites the current entry at the end, so let's drop the beginning of this entry */ /* The job overwrites the current entry at the end, so let's drop the beginning of this entry */

View file

@ -105,7 +105,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) {
tv.tv_sec = timeout / 1000; tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000; tv.tv_usec = (timeout % 1000) * 1000;
ready = select ((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 &rset, ready = select((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 &rset,
SELECT_TYPE_ARG234 &wset, SELECT_TYPE_ARG234 &xset, SELECT_TYPE_ARG234 &wset, SELECT_TYPE_ARG234 &xset,
SELECT_TYPE_ARG5 (timeout == -1 ? NULL : &tv)); SELECT_TYPE_ARG5 (timeout == -1 ? NULL : &tv));
@ -160,7 +160,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) {
/* Linux alters the tv struct... but it shouldn't matter here ... /* Linux alters the tv struct... but it shouldn't matter here ...
* as we're going to be a little bit out anyway as we've just eaten * as we're going to be a little bit out anyway as we've just eaten
* more than a couple of cpu cycles above */ * more than a couple of cpu cycles above */
ready = select ((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 &rset, ready = select((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 &rset,
SELECT_TYPE_ARG234 &wset, SELECT_TYPE_ARG234 &xset, SELECT_TYPE_ARG234 &wset, SELECT_TYPE_ARG234 &xset,
SELECT_TYPE_ARG5 (timeout == -1 ? NULL : &tv)); SELECT_TYPE_ARG5 (timeout == -1 ? NULL : &tv));
} }

View file

@ -43,12 +43,11 @@
#define POLLNVAL 0x020 /* Invalid polling request. */ #define POLLNVAL 0x020 /* Invalid polling request. */
/* Data structure describing a polling request. */ /* Data structure describing a polling request. */
struct pollfd struct pollfd {
{
int fd; /* File descriptor to poll. */ int fd; /* File descriptor to poll. */
short int events; /* Types of events poller cares about. */ short int events; /* Types of events poller cares about. */
short int revents; /* Types of events that actually occurred. */ short int revents; /* Types of events that actually occurred. */
}; };
/* Poll the file descriptors described by the NFDS structures starting at /* Poll the file descriptors described by the NFDS structures starting at
@ -62,5 +61,5 @@ struct pollfd
#if defined(HAVE_POLL_H) && !defined(OS_IS_DARWIN) #if defined(HAVE_POLL_H) && !defined(OS_IS_DARWIN)
#define pa_poll(fds,nfds,timeout) poll((fds),(nfds),(timeout)) #define pa_poll(fds,nfds,timeout) poll((fds),(nfds),(timeout))
#else #else
int pa_poll (struct pollfd *fds, unsigned long nfds, int timeout); int pa_poll(struct pollfd *fds, unsigned long nfds, int timeout);
#endif #endif

View file

@ -1387,7 +1387,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
/* If more data is in queue, we rewind later instead. */ /* If more data is in queue, we rewind later instead. */
if (s->seek_windex != -1) if (s->seek_windex != -1)
windex = PA_MIN(windex, s->seek_windex); windex = PA_MIN(windex, s->seek_windex);
if (pa_atomic_dec(&s->seek_or_post_in_queue) > 1) if (pa_atomic_dec(&s->seek_or_post_in_queue) > 1)
s->seek_windex = windex; s->seek_windex = windex;
else { else {
@ -1406,7 +1406,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
pa_sink_input *isync; pa_sink_input *isync;
void (*func)(pa_memblockq *bq); void (*func)(pa_memblockq *bq);
switch (code) { switch (code) {
case SINK_INPUT_MESSAGE_FLUSH: case SINK_INPUT_MESSAGE_FLUSH:
func = flush_write_no_account; func = flush_write_no_account;
break; break;
@ -4939,7 +4939,7 @@ pa_pstream* pa_native_connection_get_pstream(pa_native_connection *c) {
} }
pa_client* pa_native_connection_get_client(pa_native_connection *c) { pa_client* pa_native_connection_get_client(pa_native_connection *c) {
pa_native_connection_assert_ref(c); pa_native_connection_assert_ref(c);
return c->client; return c->client;
} }

View file

@ -32,7 +32,7 @@
#include "remap.h" #include "remap.h"
static void remap_mono_to_stereo_c (pa_remap_t *m, void *dst, const void *src, unsigned n) { static void remap_mono_to_stereo_c(pa_remap_t *m, void *dst, const void *src, unsigned n) {
unsigned i; unsigned i;
switch (*m->format) { switch (*m->format) {
@ -85,7 +85,7 @@ static void remap_mono_to_stereo_c (pa_remap_t *m, void *dst, const void *src, u
} }
} }
static void remap_channels_matrix_c (pa_remap_t *m, void *dst, const void *src, unsigned n) { static void remap_channels_matrix_c(pa_remap_t *m, void *dst, const void *src, unsigned n) {
unsigned oc, ic, i; unsigned oc, ic, i;
unsigned n_ic, n_oc; unsigned n_ic, n_oc;
@ -97,7 +97,7 @@ static void remap_channels_matrix_c (pa_remap_t *m, void *dst, const void *src,
{ {
float *d, *s; float *d, *s;
memset(dst, 0, n * sizeof (float) * n_oc); memset(dst, 0, n * sizeof(float) * n_oc);
for (oc = 0; oc < n_oc; oc++) { for (oc = 0; oc < n_oc; oc++) {
@ -128,7 +128,7 @@ static void remap_channels_matrix_c (pa_remap_t *m, void *dst, const void *src,
{ {
int16_t *d, *s; int16_t *d, *s;
memset(dst, 0, n * sizeof (int16_t) * n_oc); memset(dst, 0, n * sizeof(int16_t) * n_oc);
for (oc = 0; oc < n_oc; oc++) { for (oc = 0; oc < n_oc; oc++) {
@ -160,7 +160,7 @@ static void remap_channels_matrix_c (pa_remap_t *m, void *dst, const void *src,
} }
/* set the function that will execute the remapping based on the matrices */ /* set the function that will execute the remapping based on the matrices */
static void init_remap_c (pa_remap_t *m) { static void init_remap_c(pa_remap_t *m) {
unsigned n_oc, n_ic; unsigned n_oc, n_ic;
n_oc = m->o_ss->channels; n_oc = m->o_ss->channels;
@ -181,17 +181,17 @@ static void init_remap_c (pa_remap_t *m) {
/* default C implementation */ /* default C implementation */
static pa_init_remap_func_t remap_func = init_remap_c; static pa_init_remap_func_t remap_func = init_remap_c;
void pa_init_remap (pa_remap_t *m) { void pa_init_remap(pa_remap_t *m) {
pa_assert (remap_func); pa_assert(remap_func);
m->do_remap = NULL; m->do_remap = NULL;
/* call the installed remap init function */ /* call the installed remap init function */
remap_func (m); remap_func(m);
if (m->do_remap == NULL) { if (m->do_remap == NULL) {
/* nothing was installed, fallback to C version */ /* nothing was installed, fallback to C version */
init_remap_c (m); init_remap_c(m);
} }
} }

View file

@ -103,7 +103,7 @@
" emms \n\t" " emms \n\t"
#if defined (__i386__) || defined (__amd64__) #if defined (__i386__) || defined (__amd64__)
static void remap_mono_to_stereo_mmx (pa_remap_t *m, void *dst, const void *src, unsigned n) { static void remap_mono_to_stereo_mmx(pa_remap_t *m, void *dst, const void *src, unsigned n) {
pa_reg_x86 temp, temp2; pa_reg_x86 temp, temp2;
switch (*m->format) { switch (*m->format) {
@ -133,7 +133,7 @@ static void remap_mono_to_stereo_mmx (pa_remap_t *m, void *dst, const void *src,
} }
/* set the function that will execute the remapping based on the matrices */ /* set the function that will execute the remapping based on the matrices */
static void init_remap_mmx (pa_remap_t *m) { static void init_remap_mmx(pa_remap_t *m) {
unsigned n_oc, n_ic; unsigned n_oc, n_ic;
n_oc = m->o_ss->channels; n_oc = m->o_ss->channels;
@ -148,13 +148,13 @@ static void init_remap_mmx (pa_remap_t *m) {
} }
#endif /* defined (__i386__) || defined (__amd64__) */ #endif /* defined (__i386__) || defined (__amd64__) */
void pa_remap_func_init_mmx (pa_cpu_x86_flag_t flags) { void pa_remap_func_init_mmx(pa_cpu_x86_flag_t flags) {
#if defined (__i386__) || defined (__amd64__) #if defined (__i386__) || defined (__amd64__)
if (flags & PA_CPU_X86_MMX) { if (flags & PA_CPU_X86_MMX) {
pa_log_info("Initialising MMX optimized remappers."); pa_log_info("Initialising MMX optimized remappers.");
pa_set_init_remap_func ((pa_init_remap_func_t) init_remap_mmx); pa_set_init_remap_func((pa_init_remap_func_t) init_remap_mmx);
} }
#endif /* defined (__i386__) || defined (__amd64__) */ #endif /* defined (__i386__) || defined (__amd64__) */

View file

@ -102,7 +102,7 @@
"4: \n\t" "4: \n\t"
#if defined (__i386__) || defined (__amd64__) #if defined (__i386__) || defined (__amd64__)
static void remap_mono_to_stereo_sse2 (pa_remap_t *m, void *dst, const void *src, unsigned n) { static void remap_mono_to_stereo_sse2(pa_remap_t *m, void *dst, const void *src, unsigned n) {
pa_reg_x86 temp, temp2; pa_reg_x86 temp, temp2;
switch (*m->format) { switch (*m->format) {
@ -132,7 +132,7 @@ static void remap_mono_to_stereo_sse2 (pa_remap_t *m, void *dst, const void *src
} }
/* set the function that will execute the remapping based on the matrices */ /* set the function that will execute the remapping based on the matrices */
static void init_remap_sse2 (pa_remap_t *m) { static void init_remap_sse2(pa_remap_t *m) {
unsigned n_oc, n_ic; unsigned n_oc, n_ic;
n_oc = m->o_ss->channels; n_oc = m->o_ss->channels;
@ -147,7 +147,7 @@ static void init_remap_sse2 (pa_remap_t *m) {
} }
#endif /* defined (__i386__) || defined (__amd64__) */ #endif /* defined (__i386__) || defined (__amd64__) */
void pa_remap_func_init_sse (pa_cpu_x86_flag_t flags) { void pa_remap_func_init_sse(pa_cpu_x86_flag_t flags) {
#if defined (__i386__) || defined (__amd64__) #if defined (__i386__) || defined (__amd64__)
if (flags & PA_CPU_X86_SSE2) { if (flags & PA_CPU_X86_SSE2) {

View file

@ -1022,7 +1022,7 @@ static void calc_map_table(pa_resampler *r) {
pa_xfree(t); pa_xfree(t);
/* initialize the remapping function */ /* initialize the remapping function */
pa_init_remap (m); pa_init_remap(m);
} }
static pa_memchunk* convert_to_work_format(pa_resampler *r, pa_memchunk *input) { static pa_memchunk* convert_to_work_format(pa_resampler *r, pa_memchunk *input) {
@ -1096,8 +1096,8 @@ static pa_memchunk *remap_channels(pa_resampler *r, pa_memchunk *input) {
remap = &r->remap; remap = &r->remap;
pa_assert (remap->do_remap); pa_assert(remap->do_remap);
remap->do_remap (remap, dst, src, n_frames); remap->do_remap(remap, dst, src, n_frames);
pa_memblock_release(input->memblock); pa_memblock_release(input->memblock);
pa_memblock_release(r->buf2.memblock); pa_memblock_release(r->buf2.memblock);

View file

@ -752,7 +752,7 @@ void pa_volume_memchunk(
return; return;
} }
do_volume = pa_get_volume_func (spec->format); do_volume = pa_get_volume_func(spec->format);
pa_assert(do_volume); pa_assert(do_volume);
calc_volume_table[spec->format] ((void *)linear, volume); calc_volume_table[spec->format] ((void *)linear, volume);

View file

@ -170,7 +170,7 @@ static void pa_sconv_s16le_from_f32ne_sse2(unsigned n, const float *a, int16_t *
#define SAMPLES 1019 #define SAMPLES 1019
#define TIMES 1000 #define TIMES 1000
static void run_test (void) { static void run_test(void) {
int16_t samples[SAMPLES]; int16_t samples[SAMPLES];
int16_t samples_ref[SAMPLES]; int16_t samples_ref[SAMPLES];
float floats[SAMPLES]; float floats[SAMPLES];
@ -178,18 +178,18 @@ static void run_test (void) {
pa_usec_t start, stop; pa_usec_t start, stop;
pa_convert_func_t func; pa_convert_func_t func;
printf ("checking SSE %zd\n", sizeof (samples)); printf("checking SSE %zd\n", sizeof(samples));
memset (samples_ref, 0, sizeof (samples_ref)); memset(samples_ref, 0, sizeof(samples_ref));
memset (samples, 0, sizeof (samples)); memset(samples, 0, sizeof(samples));
for (i = 0; i < SAMPLES; i++) { for (i = 0; i < SAMPLES; i++) {
floats[i] = (rand()/(RAND_MAX+2.2)) - 1.1; floats[i] = (rand()/(RAND_MAX+2.2)) - 1.1;
} }
func = pa_get_convert_from_float32ne_function (PA_SAMPLE_S16LE); func = pa_get_convert_from_float32ne_function(PA_SAMPLE_S16LE);
func (SAMPLES, floats, samples_ref); func(SAMPLES, floats, samples_ref);
pa_sconv_s16le_from_f32ne_sse2 (SAMPLES, floats, samples); pa_sconv_s16le_from_f32ne_sse2(SAMPLES, floats, samples);
for (i = 0; i < SAMPLES; i++) { for (i = 0; i < SAMPLES; i++) {
if (samples[i] != samples_ref[i]) { if (samples[i] != samples_ref[i]) {
@ -200,14 +200,14 @@ static void run_test (void) {
start = pa_rtclock_now(); start = pa_rtclock_now();
for (i = 0; i < TIMES; i++) { for (i = 0; i < TIMES; i++) {
pa_sconv_s16le_from_f32ne_sse2 (SAMPLES, floats, samples); pa_sconv_s16le_from_f32ne_sse2(SAMPLES, floats, samples);
} }
stop = pa_rtclock_now(); stop = pa_rtclock_now();
pa_log_info("SSE: %llu usec.", (long long unsigned int)(stop - start)); pa_log_info("SSE: %llu usec.", (long long unsigned int)(stop - start));
start = pa_rtclock_now(); start = pa_rtclock_now();
for (i = 0; i < TIMES; i++) { for (i = 0; i < TIMES; i++) {
func (SAMPLES, floats, samples_ref); func(SAMPLES, floats, samples_ref);
} }
stop = pa_rtclock_now(); stop = pa_rtclock_now();
pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start)); pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start));
@ -216,19 +216,19 @@ static void run_test (void) {
#endif /* defined (__i386__) || defined (__amd64__) */ #endif /* defined (__i386__) || defined (__amd64__) */
void pa_convert_func_init_sse (pa_cpu_x86_flag_t flags) { void pa_convert_func_init_sse(pa_cpu_x86_flag_t flags) {
#if !defined(__APPLE__) && defined (__i386__) || defined (__amd64__) #if !defined(__APPLE__) && defined (__i386__) || defined (__amd64__)
#ifdef RUN_TEST #ifdef RUN_TEST
run_test (); run_test();
#endif #endif
if (flags & PA_CPU_X86_SSE2) { if (flags & PA_CPU_X86_SSE2) {
pa_log_info("Initialising SSE2 optimized conversions."); pa_log_info("Initialising SSE2 optimized conversions.");
pa_set_convert_from_float32ne_function (PA_SAMPLE_S16LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_sse2); pa_set_convert_from_float32ne_function(PA_SAMPLE_S16LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_sse2);
} else { } else {
pa_log_info("Initialising SSE optimized conversions."); pa_log_info("Initialising SSE optimized conversions.");
pa_set_convert_from_float32ne_function (PA_SAMPLE_S16LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_sse); pa_set_convert_from_float32ne_function(PA_SAMPLE_S16LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_sse);
} }
#endif /* defined (__i386__) || defined (__amd64__) */ #endif /* defined (__i386__) || defined (__amd64__) */

View file

@ -30,8 +30,7 @@
#include "semaphore.h" #include "semaphore.h"
struct pa_semaphore struct pa_semaphore {
{
MPSemaphoreID sema; MPSemaphoreID sema;
}; };

View file

@ -30,8 +30,7 @@
#include "semaphore.h" #include "semaphore.h"
struct pa_semaphore struct pa_semaphore {
{
HANDLE sema; HANDLE sema;
}; };

View file

@ -74,10 +74,10 @@ static int check_passthrough_connection(pa_sink_input_flags_t flags, pa_sink *de
} }
} else { } else {
if (flags & PA_SINK_INPUT_PASSTHROUGH) { if (flags & PA_SINK_INPUT_PASSTHROUGH) {
pa_log_warn("Cannot connect PASSTHROUGH sink input to sink without PASSTHROUGH capabilities"); pa_log_warn("Cannot connect PASSTHROUGH sink input to sink without PASSTHROUGH capabilities");
return -PA_ERR_INVALID; return -PA_ERR_INVALID;
} }
} }
return PA_OK; return PA_OK;
} }

View file

@ -2732,22 +2732,22 @@ void pa_sink_set_latency_range(pa_sink *s, pa_usec_t min_latency, pa_usec_t max_
/* Called from main thread */ /* Called from main thread */
void pa_sink_get_latency_range(pa_sink *s, pa_usec_t *min_latency, pa_usec_t *max_latency) { void pa_sink_get_latency_range(pa_sink *s, pa_usec_t *min_latency, pa_usec_t *max_latency) {
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
pa_assert_ctl_context(); pa_assert_ctl_context();
pa_assert(min_latency); pa_assert(min_latency);
pa_assert(max_latency); pa_assert(max_latency);
if (PA_SINK_IS_LINKED(s->state)) { if (PA_SINK_IS_LINKED(s->state)) {
pa_usec_t r[2] = { 0, 0 }; pa_usec_t r[2] = { 0, 0 };
pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_LATENCY_RANGE, r, 0, NULL) == 0); pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_LATENCY_RANGE, r, 0, NULL) == 0);
*min_latency = r[0]; *min_latency = r[0];
*max_latency = r[1]; *max_latency = r[1];
} else { } else {
*min_latency = s->thread_info.min_latency; *min_latency = s->thread_info.min_latency;
*max_latency = s->thread_info.max_latency; *max_latency = s->thread_info.max_latency;
} }
} }
/* Called from IO thread */ /* Called from IO thread */

View file

@ -52,7 +52,7 @@ int pa_sndfile_read_sample_spec(SNDFILE *sf, pa_sample_spec *ss) {
case SF_FORMAT_PCM_24: case SF_FORMAT_PCM_24:
ss->format = PA_SAMPLE_S24NE; ss->format = PA_SAMPLE_S24NE;
break; break;
case SF_FORMAT_PCM_32: case SF_FORMAT_PCM_32:
ss->format = PA_SAMPLE_S32NE; ss->format = PA_SAMPLE_S32NE;
@ -109,9 +109,9 @@ int pa_sndfile_write_sample_spec(SF_INFO *sfi, pa_sample_spec *ss) {
case PA_SAMPLE_S24LE: case PA_SAMPLE_S24LE:
case PA_SAMPLE_S24BE: case PA_SAMPLE_S24BE:
ss->format = PA_SAMPLE_S24NE; ss->format = PA_SAMPLE_S24NE;
sfi->format |= SF_FORMAT_PCM_24; sfi->format |= SF_FORMAT_PCM_24;
break; break;
case PA_SAMPLE_S24_32LE: case PA_SAMPLE_S24_32LE:
case PA_SAMPLE_S24_32BE: case PA_SAMPLE_S24_32BE:
@ -304,8 +304,7 @@ int pa_sndfile_write_channel_map(SNDFILE *sf, pa_channel_map *cm) {
channels[c] = table[cm->map[c]]; channels[c] = table[cm->map[c]];
} }
if (!sf_command(sf, SFC_SET_CHANNEL_MAP_INFO, if (!sf_command(sf, SFC_SET_CHANNEL_MAP_INFO, channels, sizeof(channels[0]) * cm->channels)) {
channels, sizeof(channels[0]) * cm->channels)) {
pa_xfree(channels); pa_xfree(channels);
return -1; return -1;
} }

View file

@ -200,7 +200,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk
} }
return -1; return -1;
} }
static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) { static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
file_stream *u; file_stream *u;

View file

@ -1402,22 +1402,22 @@ void pa_source_set_latency_range(pa_source *s, pa_usec_t min_latency, pa_usec_t
/* Called from main thread */ /* Called from main thread */
void pa_source_get_latency_range(pa_source *s, pa_usec_t *min_latency, pa_usec_t *max_latency) { void pa_source_get_latency_range(pa_source *s, pa_usec_t *min_latency, pa_usec_t *max_latency) {
pa_source_assert_ref(s); pa_source_assert_ref(s);
pa_assert_ctl_context(); pa_assert_ctl_context();
pa_assert(min_latency); pa_assert(min_latency);
pa_assert(max_latency); pa_assert(max_latency);
if (PA_SOURCE_IS_LINKED(s->state)) { if (PA_SOURCE_IS_LINKED(s->state)) {
pa_usec_t r[2] = { 0, 0 }; pa_usec_t r[2] = { 0, 0 };
pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_GET_LATENCY_RANGE, r, 0, NULL) == 0); pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_GET_LATENCY_RANGE, r, 0, NULL) == 0);
*min_latency = r[0]; *min_latency = r[0];
*max_latency = r[1]; *max_latency = r[1];
} else { } else {
*min_latency = s->thread_info.min_latency; *min_latency = s->thread_info.min_latency;
*max_latency = s->thread_info.max_latency; *max_latency = s->thread_info.max_latency;
} }
} }
/* Called from IO thread, and from main thread before pa_source_put() is called */ /* Called from IO thread, and from main thread before pa_source_put() is called */

View file

@ -156,7 +156,7 @@ struct pa_source {
pa_usec_t max_latency; /* An upper limit for the latencies */ pa_usec_t max_latency; /* An upper limit for the latencies */
pa_usec_t fixed_latency; /* for sources with PA_SOURCE_DYNAMIC_LATENCY this is 0 */ pa_usec_t fixed_latency; /* for sources with PA_SOURCE_DYNAMIC_LATENCY this is 0 */
} thread_info; } thread_info;
void *userdata; void *userdata;
}; };

View file

@ -146,7 +146,7 @@ void pa_strbuf_putsn(pa_strbuf *sb, const char *t, size_t l) {
pa_assert(t); pa_assert(t);
if (!l) if (!l)
return; return;
c = pa_xmalloc(PA_ALIGN(sizeof(struct chunk)) + l); c = pa_xmalloc(PA_ALIGN(sizeof(struct chunk)) + l);
c->length = l; c->length = l;

View file

@ -43,9 +43,7 @@
" addcs r0, %1 \n\t" \ " addcs r0, %1 \n\t" \
" movcs r6, r0 \n\t" " movcs r6, r0 \n\t"
static void static void pa_volume_s16ne_arm(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s16ne_arm (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
int32_t *ve; int32_t *ve;
/* Channels must be at least 4, and always a multiple of the original number. /* Channels must be at least 4, and always a multiple of the original number.
@ -134,7 +132,7 @@ pa_volume_s16ne_arm (int16_t *samples, int32_t *volumes, unsigned channels, unsi
#define TIMES 1000 #define TIMES 1000
#define PADDING 16 #define PADDING 16
static void run_test (void) { static void run_test(void) {
int16_t samples[SAMPLES]; int16_t samples[SAMPLES];
int16_t samples_ref[SAMPLES]; int16_t samples_ref[SAMPLES];
int16_t samples_orig[SAMPLES]; int16_t samples_orig[SAMPLES];
@ -143,21 +141,21 @@ static void run_test (void) {
pa_do_volume_func_t func; pa_do_volume_func_t func;
pa_usec_t start, stop; pa_usec_t start, stop;
func = pa_get_volume_func (PA_SAMPLE_S16NE); func = pa_get_volume_func(PA_SAMPLE_S16NE);
printf ("checking ARM %zd\n", sizeof (samples)); printf("checking ARM %zd\n", sizeof(samples));
pa_random (samples, sizeof (samples)); pa_random(samples, sizeof(samples));
memcpy (samples_ref, samples, sizeof (samples)); memcpy(samples_ref, samples, sizeof(samples));
memcpy (samples_orig, samples, sizeof (samples)); memcpy(samples_orig, samples, sizeof(samples));
for (i = 0; i < CHANNELS; i++) for (i = 0; i < CHANNELS; i++)
volumes[i] = PA_CLAMP_VOLUME(rand() >> 1); volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
for (padding = 0; padding < PADDING; padding++, i++) for (padding = 0; padding < PADDING; padding++, i++)
volumes[i] = volumes[padding]; volumes[i] = volumes[padding];
func (samples_ref, volumes, CHANNELS, sizeof (samples)); func(samples_ref, volumes, CHANNELS, sizeof(samples));
pa_volume_s16ne_arm (samples, volumes, CHANNELS, sizeof (samples)); pa_volume_s16ne_arm(samples, volumes, CHANNELS, sizeof(samples));
for (i = 0; i < SAMPLES; i++) { for (i = 0; i < SAMPLES; i++) {
if (samples[i] != samples_ref[i]) { if (samples[i] != samples_ref[i]) {
printf ("%d: %04x != %04x (%04x * %04x)\n", i, samples[i], samples_ref[i], printf ("%d: %04x != %04x (%04x * %04x)\n", i, samples[i], samples_ref[i],
@ -167,16 +165,16 @@ static void run_test (void) {
start = pa_rtclock_now(); start = pa_rtclock_now();
for (j = 0; j < TIMES; j++) { for (j = 0; j < TIMES; j++) {
memcpy (samples, samples_orig, sizeof (samples)); memcpy(samples, samples_orig, sizeof(samples));
pa_volume_s16ne_arm (samples, volumes, CHANNELS, sizeof (samples)); pa_volume_s16ne_arm(samples, volumes, CHANNELS, sizeof(samples));
} }
stop = pa_rtclock_now(); stop = pa_rtclock_now();
pa_log_info("ARM: %llu usec.", (long long unsigned int) (stop - start)); pa_log_info("ARM: %llu usec.", (long long unsigned int) (stop - start));
start = pa_rtclock_now(); start = pa_rtclock_now();
for (j = 0; j < TIMES; j++) { for (j = 0; j < TIMES; j++) {
memcpy (samples_ref, samples_orig, sizeof (samples)); memcpy(samples_ref, samples_orig, sizeof(samples));
func (samples_ref, volumes, CHANNELS, sizeof (samples)); func(samples_ref, volumes, CHANNELS, sizeof(samples));
} }
stop = pa_rtclock_now(); stop = pa_rtclock_now();
pa_log_info("ref: %llu usec.", (long long unsigned int) (stop - start)); pa_log_info("ref: %llu usec.", (long long unsigned int) (stop - start));
@ -186,14 +184,14 @@ static void run_test (void) {
#endif /* defined (__arm__) && defined (HAVE_ARMV6) */ #endif /* defined (__arm__) && defined (HAVE_ARMV6) */
void pa_volume_func_init_arm (pa_cpu_arm_flag_t flags) { void pa_volume_func_init_arm(pa_cpu_arm_flag_t flags) {
#if defined (__arm__) && defined (HAVE_ARMV6) #if defined (__arm__) && defined (HAVE_ARMV6)
pa_log_info("Initialising ARM optimized functions."); pa_log_info("Initialising ARM optimized functions.");
#ifdef RUN_TEST #ifdef RUN_TEST
run_test (); run_test();
#endif #endif
pa_set_volume_func (PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_arm); pa_set_volume_func(PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_arm);
#endif /* defined (__arm__) && defined (HAVE_ARMV6) */ #endif /* defined (__arm__) && defined (HAVE_ARMV6) */
} }

View file

@ -32,9 +32,7 @@
#include "sample-util.h" #include "sample-util.h"
#include "endianmacros.h" #include "endianmacros.h"
static void static void pa_volume_u8_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_u8_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
for (channel = 0; length; length--) { for (channel = 0; length; length--) {
@ -53,9 +51,7 @@ pa_volume_u8_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned
} }
} }
static void static void pa_volume_alaw_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_alaw_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
for (channel = 0; length; length--) { for (channel = 0; length; length--) {
@ -74,9 +70,7 @@ pa_volume_alaw_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigne
} }
} }
static void static void pa_volume_ulaw_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_ulaw_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
for (channel = 0; length; length--) { for (channel = 0; length; length--) {
@ -95,12 +89,10 @@ pa_volume_ulaw_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigne
} }
} }
static void static void pa_volume_s16ne_c(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s16ne_c (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
length /= sizeof (int16_t); length /= sizeof(int16_t);
for (channel = 0; length; length--) { for (channel = 0; length; length--) {
int32_t t, hi, lo; int32_t t, hi, lo;
@ -124,12 +116,10 @@ pa_volume_s16ne_c (int16_t *samples, int32_t *volumes, unsigned channels, unsign
} }
} }
static void static void pa_volume_s16re_c(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s16re_c (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
length /= sizeof (int16_t); length /= sizeof(int16_t);
for (channel = 0; length; length--) { for (channel = 0; length; length--) {
int32_t t, hi, lo; int32_t t, hi, lo;
@ -147,12 +137,10 @@ pa_volume_s16re_c (int16_t *samples, int32_t *volumes, unsigned channels, unsign
} }
} }
static void static void pa_volume_float32ne_c(float *samples, float *volumes, unsigned channels, unsigned length) {
pa_volume_float32ne_c (float *samples, float *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
length /= sizeof (float); length /= sizeof(float);
for (channel = 0; length; length--) { for (channel = 0; length; length--) {
*samples++ *= volumes[channel]; *samples++ *= volumes[channel];
@ -162,12 +150,10 @@ pa_volume_float32ne_c (float *samples, float *volumes, unsigned channels, unsign
} }
} }
static void static void pa_volume_float32re_c(float *samples, float *volumes, unsigned channels, unsigned length) {
pa_volume_float32re_c (float *samples, float *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
length /= sizeof (float); length /= sizeof(float);
for (channel = 0; length; length--) { for (channel = 0; length; length--) {
float t; float t;
@ -181,12 +167,10 @@ pa_volume_float32re_c (float *samples, float *volumes, unsigned channels, unsign
} }
} }
static void static void pa_volume_s32ne_c(int32_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s32ne_c (int32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
length /= sizeof (int32_t); length /= sizeof(int32_t);
for (channel = 0; length; length--) { for (channel = 0; length; length--) {
int64_t t; int64_t t;
@ -201,12 +185,10 @@ pa_volume_s32ne_c (int32_t *samples, int32_t *volumes, unsigned channels, unsign
} }
} }
static void static void pa_volume_s32re_c(int32_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s32re_c (int32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
length /= sizeof (int32_t); length /= sizeof(int32_t);
for (channel = 0; length; length--) { for (channel = 0; length; length--) {
int64_t t; int64_t t;
@ -221,9 +203,7 @@ pa_volume_s32re_c (int32_t *samples, int32_t *volumes, unsigned channels, unsign
} }
} }
static void static void pa_volume_s24ne_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s24ne_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
uint8_t *e; uint8_t *e;
@ -242,9 +222,7 @@ pa_volume_s24ne_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsign
} }
} }
static void static void pa_volume_s24re_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s24re_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
uint8_t *e; uint8_t *e;
@ -263,12 +241,10 @@ pa_volume_s24re_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsign
} }
} }
static void static void pa_volume_s24_32ne_c(uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s24_32ne_c (uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
length /= sizeof (uint32_t); length /= sizeof(uint32_t);
for (channel = 0; length; length--) { for (channel = 0; length; length--) {
int64_t t; int64_t t;
@ -283,12 +259,10 @@ pa_volume_s24_32ne_c (uint32_t *samples, int32_t *volumes, unsigned channels, un
} }
} }
static void static void pa_volume_s24_32re_c(uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s24_32re_c (uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
unsigned channel; unsigned channel;
length /= sizeof (uint32_t); length /= sizeof(uint32_t);
for (channel = 0; length; length--) { for (channel = 0; length; length--) {
int64_t t; int64_t t;
@ -303,8 +277,7 @@ pa_volume_s24_32re_c (uint32_t *samples, int32_t *volumes, unsigned channels, un
} }
} }
static pa_do_volume_func_t do_volume_table[] = static pa_do_volume_func_t do_volume_table[] = {
{
[PA_SAMPLE_U8] = (pa_do_volume_func_t) pa_volume_u8_c, [PA_SAMPLE_U8] = (pa_do_volume_func_t) pa_volume_u8_c,
[PA_SAMPLE_ALAW] = (pa_do_volume_func_t) pa_volume_alaw_c, [PA_SAMPLE_ALAW] = (pa_do_volume_func_t) pa_volume_alaw_c,
[PA_SAMPLE_ULAW] = (pa_do_volume_func_t) pa_volume_ulaw_c, [PA_SAMPLE_ULAW] = (pa_do_volume_func_t) pa_volume_ulaw_c,

View file

@ -95,9 +95,7 @@
" por %%mm4, "#s1" \n\t" /* .. | l h | */ \ " por %%mm4, "#s1" \n\t" /* .. | l h | */ \
" por %%mm5, "#s2" \n\t" " por %%mm5, "#s2" \n\t"
static void static void pa_volume_s16ne_mmx(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s16ne_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
pa_reg_x86 channel, temp; pa_reg_x86 channel, temp;
/* Channels must be at least 4, and always a multiple of the original number. /* Channels must be at least 4, and always a multiple of the original number.
@ -162,9 +160,7 @@ pa_volume_s16ne_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
); );
} }
static void static void pa_volume_s16re_mmx(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s16re_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
pa_reg_x86 channel, temp; pa_reg_x86 channel, temp;
/* Channels must be at least 4, and always a multiple of the original number. /* Channels must be at least 4, and always a multiple of the original number.
@ -247,7 +243,7 @@ pa_volume_s16re_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
#define TIMES 1000 #define TIMES 1000
#define PADDING 16 #define PADDING 16
static void run_test (void) { static void run_test(void) {
int16_t samples[SAMPLES]; int16_t samples[SAMPLES];
int16_t samples_ref[SAMPLES]; int16_t samples_ref[SAMPLES];
int16_t samples_orig[SAMPLES]; int16_t samples_orig[SAMPLES];
@ -256,15 +252,15 @@ static void run_test (void) {
pa_do_volume_func_t func; pa_do_volume_func_t func;
pa_usec_t start, stop; pa_usec_t start, stop;
func = pa_get_volume_func (PA_SAMPLE_S16NE); func = pa_get_volume_func(PA_SAMPLE_S16NE);
printf ("checking MMX %zd\n", sizeof (samples)); printf("checking MMX %zd\n", sizeof(samples));
pa_random (samples, sizeof (samples)); pa_random(samples, sizeof(samples));
/* for (i = 0; i < SAMPLES; i++) /* for (i = 0; i < SAMPLES; i++)
samples[i] = -1; */ samples[i] = -1; */
memcpy (samples_ref, samples, sizeof (samples)); memcpy(samples_ref, samples, sizeof(samples));
memcpy (samples_orig, samples, sizeof (samples)); memcpy(samples_orig, samples, sizeof(samples));
for (i = 0; i < CHANNELS; i++) for (i = 0; i < CHANNELS; i++)
volumes[i] = PA_CLAMP_VOLUME(rand() >> 1); volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
@ -272,27 +268,27 @@ static void run_test (void) {
for (padding = 0; padding < PADDING; padding++, i++) for (padding = 0; padding < PADDING; padding++, i++)
volumes[i] = volumes[padding]; volumes[i] = volumes[padding];
func (samples_ref, volumes, CHANNELS, sizeof (samples)); func(samples_ref, volumes, CHANNELS, sizeof(samples));
pa_volume_s16ne_mmx (samples, volumes, CHANNELS, sizeof (samples)); pa_volume_s16ne_mmx(samples, volumes, CHANNELS, sizeof(samples));
for (i = 0; i < SAMPLES; i++) { for (i = 0; i < SAMPLES; i++) {
if (samples[i] != samples_ref[i]) { if (samples[i] != samples_ref[i]) {
printf ("%d: %04x != %04x (%04x * %08x)\n", i, samples[i], samples_ref[i], printf("%d: %04x != %04x (%04x * %08x)\n", i, samples[i], samples_ref[i],
samples_orig[i], volumes[i % CHANNELS]); samples_orig[i], volumes[i % CHANNELS]);
} }
} }
start = pa_rtclock_now(); start = pa_rtclock_now();
for (j = 0; j < TIMES; j++) { for (j = 0; j < TIMES; j++) {
memcpy (samples, samples_orig, sizeof (samples)); memcpy(samples, samples_orig, sizeof(samples));
pa_volume_s16ne_mmx (samples, volumes, CHANNELS, sizeof (samples)); pa_volume_s16ne_mmx(samples, volumes, CHANNELS, sizeof(samples));
} }
stop = pa_rtclock_now(); stop = pa_rtclock_now();
pa_log_info("MMX: %llu usec.", (long long unsigned int)(stop - start)); pa_log_info("MMX: %llu usec.", (long long unsigned int)(stop - start));
start = pa_rtclock_now(); start = pa_rtclock_now();
for (j = 0; j < TIMES; j++) { for (j = 0; j < TIMES; j++) {
memcpy (samples_ref, samples_orig, sizeof (samples)); memcpy(samples_ref, samples_orig, sizeof(samples));
func (samples_ref, volumes, CHANNELS, sizeof (samples)); func(samples_ref, volumes, CHANNELS, sizeof(samples));
} }
stop = pa_rtclock_now(); stop = pa_rtclock_now();
pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start)); pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start));
@ -304,18 +300,18 @@ static void run_test (void) {
#endif /* defined (__i386__) || defined (__amd64__) */ #endif /* defined (__i386__) || defined (__amd64__) */
void pa_volume_func_init_mmx (pa_cpu_x86_flag_t flags) { void pa_volume_func_init_mmx(pa_cpu_x86_flag_t flags) {
#if defined (__i386__) || defined (__amd64__) #if defined (__i386__) || defined (__amd64__)
#ifdef RUN_TEST #ifdef RUN_TEST
run_test (); run_test();
#endif #endif
if ((flags & PA_CPU_X86_MMX) && (flags & PA_CPU_X86_CMOV)) { if ((flags & PA_CPU_X86_MMX) && (flags & PA_CPU_X86_CMOV)) {
pa_log_info("Initialising MMX optimized functions."); pa_log_info("Initialising MMX optimized functions.");
pa_set_volume_func (PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_mmx); pa_set_volume_func(PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_mmx);
pa_set_volume_func (PA_SAMPLE_S16RE, (pa_do_volume_func_t) pa_volume_s16re_mmx); pa_set_volume_func(PA_SAMPLE_S16RE, (pa_do_volume_func_t) pa_volume_s16re_mmx);
} }
#endif /* defined (__i386__) || defined (__amd64__) */ #endif /* defined (__i386__) || defined (__amd64__) */
} }

View file

@ -79,9 +79,7 @@
static int channel_overread_table[8] = {8,8,8,12,8,10,12,14}; static int channel_overread_table[8] = {8,8,8,12,8,10,12,14};
static void static void pa_volume_s16ne_sse2(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s16ne_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
pa_reg_x86 channel, temp; pa_reg_x86 channel, temp;
/* Channels must be at least 8 and always a multiple of the original number. /* Channels must be at least 8 and always a multiple of the original number.
@ -161,9 +159,7 @@ pa_volume_s16ne_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, uns
); );
} }
static void static void pa_volume_s16re_sse2(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
pa_volume_s16re_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
{
pa_reg_x86 channel, temp; pa_reg_x86 channel, temp;
/* Channels must be at least 8 and always a multiple of the original number. /* Channels must be at least 8 and always a multiple of the original number.
@ -259,7 +255,7 @@ pa_volume_s16re_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, uns
#define TIMES 1000 #define TIMES 1000
#define PADDING 16 #define PADDING 16
static void run_test (void) { static void run_test(void) {
int16_t samples[SAMPLES]; int16_t samples[SAMPLES];
int16_t samples_ref[SAMPLES]; int16_t samples_ref[SAMPLES];
int16_t samples_orig[SAMPLES]; int16_t samples_orig[SAMPLES];
@ -268,21 +264,21 @@ static void run_test (void) {
pa_do_volume_func_t func; pa_do_volume_func_t func;
pa_usec_t start, stop; pa_usec_t start, stop;
func = pa_get_volume_func (PA_SAMPLE_S16NE); func = pa_get_volume_func(PA_SAMPLE_S16NE);
printf ("checking SSE2 %zd\n", sizeof (samples)); printf("checking SSE2 %zd\n", sizeof(samples));
pa_random (samples, sizeof (samples)); pa_random(samples, sizeof(samples));
memcpy (samples_ref, samples, sizeof (samples)); memcpy(samples_ref, samples, sizeof(samples));
memcpy (samples_orig, samples, sizeof (samples)); memcpy(samples_orig, samples, sizeof(samples));
for (i = 0; i < CHANNELS; i++) for (i = 0; i < CHANNELS; i++)
volumes[i] = PA_CLAMP_VOLUME(rand() >> 1); volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
for (padding = 0; padding < PADDING; padding++, i++) for (padding = 0; padding < PADDING; padding++, i++)
volumes[i] = volumes[padding]; volumes[i] = volumes[padding];
func (samples_ref, volumes, CHANNELS, sizeof (samples)); func(samples_ref, volumes, CHANNELS, sizeof(samples));
pa_volume_s16ne_sse2 (samples, volumes, CHANNELS, sizeof (samples)); pa_volume_s16ne_sse2(samples, volumes, CHANNELS, sizeof(samples));
for (i = 0; i < SAMPLES; i++) { for (i = 0; i < SAMPLES; i++) {
if (samples[i] != samples_ref[i]) { if (samples[i] != samples_ref[i]) {
printf ("%d: %04x != %04x (%04x * %04x)\n", i, samples[i], samples_ref[i], printf ("%d: %04x != %04x (%04x * %04x)\n", i, samples[i], samples_ref[i],
@ -292,16 +288,16 @@ static void run_test (void) {
start = pa_rtclock_now(); start = pa_rtclock_now();
for (j = 0; j < TIMES; j++) { for (j = 0; j < TIMES; j++) {
memcpy (samples, samples_orig, sizeof (samples)); memcpy(samples, samples_orig, sizeof(samples));
pa_volume_s16ne_sse2 (samples, volumes, CHANNELS, sizeof (samples)); pa_volume_s16ne_sse2(samples, volumes, CHANNELS, sizeof(samples));
} }
stop = pa_rtclock_now(); stop = pa_rtclock_now();
pa_log_info("SSE: %llu usec.", (long long unsigned int)(stop - start)); pa_log_info("SSE: %llu usec.", (long long unsigned int)(stop - start));
start = pa_rtclock_now(); start = pa_rtclock_now();
for (j = 0; j < TIMES; j++) { for (j = 0; j < TIMES; j++) {
memcpy (samples_ref, samples_orig, sizeof (samples)); memcpy(samples_ref, samples_orig, sizeof(samples));
func (samples_ref, volumes, CHANNELS, sizeof (samples)); func(samples_ref, volumes, CHANNELS, sizeof (samples));
} }
stop = pa_rtclock_now(); stop = pa_rtclock_now();
pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start)); pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start));
@ -311,18 +307,18 @@ static void run_test (void) {
#endif #endif
#endif /* defined (__i386__) || defined (__amd64__) */ #endif /* defined (__i386__) || defined (__amd64__) */
void pa_volume_func_init_sse (pa_cpu_x86_flag_t flags) { void pa_volume_func_init_sse(pa_cpu_x86_flag_t flags) {
#if defined (__i386__) || defined (__amd64__) #if defined (__i386__) || defined (__amd64__)
#ifdef RUN_TEST #ifdef RUN_TEST
run_test (); run_test();
#endif #endif
if (flags & PA_CPU_X86_SSE2) { if (flags & PA_CPU_X86_SSE2) {
pa_log_info("Initialising SSE2 optimized functions."); pa_log_info("Initialising SSE2 optimized functions.");
pa_set_volume_func (PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_sse2); pa_set_volume_func(PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_sse2);
pa_set_volume_func (PA_SAMPLE_S16RE, (pa_do_volume_func_t) pa_volume_s16re_sse2); pa_set_volume_func(PA_SAMPLE_S16RE, (pa_do_volume_func_t) pa_volume_s16re_sse2);
} }
#endif /* defined (__i386__) || defined (__amd64__) */ #endif /* defined (__i386__) || defined (__amd64__) */
} }

View file

@ -142,9 +142,7 @@ struct group *pa_getgrgid_malloc(gid_t gid) {
getgr_buflen = buflen - sizeof(struct group); getgr_buflen = buflen - sizeof(struct group);
getgr_buf = (char *)buf + sizeof(struct group); getgr_buf = (char *)buf + sizeof(struct group);
while ((err = getgrgid_r(gid, (struct group *)buf, getgr_buf, while ((err = getgrgid_r(gid, (struct group *)buf, getgr_buf, getgr_buflen, &result)) == ERANGE) {
getgr_buflen, &result)) == ERANGE)
{
if (expand_buffer_trashcontents(&buf, &buflen)) if (expand_buffer_trashcontents(&buf, &buflen))
break; break;
@ -203,9 +201,7 @@ struct group *pa_getgrnam_malloc(const char *name) {
getgr_buflen = buflen - sizeof(struct group); getgr_buflen = buflen - sizeof(struct group);
getgr_buf = (char *)buf + sizeof(struct group); getgr_buf = (char *)buf + sizeof(struct group);
while ((err = getgrnam_r(name, (struct group *)buf, getgr_buf, while ((err = getgrnam_r(name, (struct group *)buf, getgr_buf, getgr_buflen, &result)) == ERANGE) {
getgr_buflen, &result)) == ERANGE)
{
if (expand_buffer_trashcontents(&buf, &buflen)) if (expand_buffer_trashcontents(&buf, &buflen))
break; break;
@ -268,9 +264,7 @@ struct passwd *pa_getpwnam_malloc(const char *name) {
getpw_buflen = buflen - sizeof(struct passwd); getpw_buflen = buflen - sizeof(struct passwd);
getpw_buf = (char *)buf + sizeof(struct passwd); getpw_buf = (char *)buf + sizeof(struct passwd);
while ((err = getpwnam_r(name, (struct passwd *)buf, getpw_buf, while ((err = getpwnam_r(name, (struct passwd *)buf, getpw_buf, getpw_buflen, &result)) == ERANGE) {
getpw_buflen, &result)) == ERANGE)
{
if (expand_buffer_trashcontents(&buf, &buflen)) if (expand_buffer_trashcontents(&buf, &buflen))
break; break;
@ -329,9 +323,7 @@ struct passwd *pa_getpwuid_malloc(uid_t uid) {
getpw_buflen = buflen - sizeof(struct passwd); getpw_buflen = buflen - sizeof(struct passwd);
getpw_buf = (char *)buf + sizeof(struct passwd); getpw_buf = (char *)buf + sizeof(struct passwd);
while ((err = getpwuid_r(uid, (struct passwd *)buf, getpw_buf, while ((err = getpwuid_r(uid, (struct passwd *)buf, getpw_buf, getpw_buflen, &result)) == ERANGE) {
getpw_buflen, &result)) == ERANGE)
{
if (expand_buffer_trashcontents(&buf, &buflen)) if (expand_buffer_trashcontents(&buf, &buflen))
break; break;

View file

@ -34,8 +34,7 @@
#define PA_XCB_FORMAT 8 #define PA_XCB_FORMAT 8
static xcb_screen_t *screen_of_display(xcb_connection_t *xcb, int screen) static xcb_screen_t *screen_of_display(xcb_connection_t *xcb, int screen) {
{
const xcb_setup_t *s; const xcb_setup_t *s;
xcb_screen_iterator_t iter; xcb_screen_iterator_t iter;

View file

@ -47,28 +47,24 @@ static int compare_group(const struct group *a, const struct group *b) {
char **amem, **bmem; char **amem, **bmem;
if (strcmp(a->gr_name, b->gr_name)) { if (strcmp(a->gr_name, b->gr_name)) {
fprintf(stderr, "Group name mismatch: [%s] [%s]\n", fprintf(stderr, "Group name mismatch: [%s] [%s]\n", a->gr_name, b->gr_name);
a->gr_name, b->gr_name);
return 1; return 1;
} }
if (strcmp(a->gr_passwd, b->gr_passwd)) { if (strcmp(a->gr_passwd, b->gr_passwd)) {
fprintf(stderr, "Group password mismatch: [%s] [%s]\n", fprintf(stderr, "Group password mismatch: [%s] [%s]\n", a->gr_passwd, b->gr_passwd);
a->gr_passwd, b->gr_passwd);
return 1; return 1;
} }
if (a->gr_gid != b->gr_gid) { if (a->gr_gid != b->gr_gid) {
fprintf(stderr, "Gid mismatch: [%lu] [%lu]\n", fprintf(stderr, "Gid mismatch: [%lu] [%lu]\n", (unsigned long) a->gr_gid, (unsigned long) b->gr_gid);
(unsigned long) a->gr_gid, (unsigned long) b->gr_gid);
return 1; return 1;
} }
/* XXX: Assuming the group ordering is identical. */ /* XXX: Assuming the group ordering is identical. */
for (amem = a->gr_mem, bmem = b->gr_mem; *amem && *bmem; ++amem, ++bmem) { for (amem = a->gr_mem, bmem = b->gr_mem; *amem && *bmem; ++amem, ++bmem) {
if (strcmp(*amem, *bmem)) { if (strcmp(*amem, *bmem)) {
fprintf(stderr, "Group member mismatch: [%s] [%s]\n", fprintf(stderr, "Group member mismatch: [%s] [%s]\n", *amem, *bmem);
*amem, *bmem);
return 1; return 1;
} }
} }
@ -93,14 +89,12 @@ static int compare_passwd(const struct passwd *a, const struct passwd *b) {
} }
if (a->pw_uid != b->pw_uid) { if (a->pw_uid != b->pw_uid) {
fprintf(stderr, "pw_uid mismatch: [%lu] [%lu]\n", fprintf(stderr, "pw_uid mismatch: [%lu] [%lu]\n", (unsigned long) a->pw_uid, (unsigned long) b->pw_uid);
(unsigned long) a->pw_uid, (unsigned long) b->pw_uid);
return 1; return 1;
} }
if (a->pw_gid != b->pw_gid) { if (a->pw_gid != b->pw_gid) {
fprintf(stderr, "pw_gid mismatch: [%lu] [%lu]\n", fprintf(stderr, "pw_gid mismatch: [%lu] [%lu]\n", (unsigned long) a->pw_gid, (unsigned long) b->pw_gid);
(unsigned long) a->pw_gid, (unsigned long) b->pw_gid);
return 1; return 1;
} }

View file

@ -44,8 +44,7 @@
#include <pulsecore/pid.h> #include <pulsecore/pid.h>
int main(int argc, char*argv[]) { int main(int argc, char*argv[]) {
pid_t pid;
pid_t pid ;
int fd = -1; int fd = -1;
int ret = 1, i; int ret = 1, i;
struct sockaddr_un sa; struct sockaddr_un sa;