Remove pa_bool_t and replace it with bool.

commands used for this (executed from the pulseaudio/src directory):
    find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
        -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
        -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
        -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
        -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;

and:
    sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
        -e '181,194!s/\bTRUE\b/true/' -e \
        '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
This commit is contained in:
poljar (Damir Jelić) 2013-06-27 19:28:09 +02:00 committed by Tanu Kaskinen
parent e9822bfcb0
commit d806b19714
288 changed files with 3360 additions and 3360 deletions

View file

@ -215,7 +215,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
case ARG_START: case ARG_START:
conf->cmd = PA_CMD_START; conf->cmd = PA_CMD_START;
conf->daemonize = TRUE; conf->daemonize = true;
break; break;
case ARG_CHECK: case ARG_CHECK:
@ -318,7 +318,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
break; break;
case 'n': case 'n':
conf->load_default_script_file = FALSE; conf->load_default_script_file = false;
break; break;
case ARG_LOG_TARGET: case ARG_LOG_TARGET:

View file

@ -80,7 +80,7 @@ static pa_io_event *io_event = NULL;
static struct sigaction sigaction_prev; static struct sigaction sigaction_prev;
/* Nonzero after pa_cpu_limit_init() */ /* Nonzero after pa_cpu_limit_init() */
static pa_bool_t installed = FALSE; static bool installed = false;
/* The current state of operation */ /* The current state of operation */
static enum { static enum {
@ -209,7 +209,7 @@ int pa_cpu_limit_init(pa_mainloop_api *m) {
return -1; return -1;
} }
installed = TRUE; installed = true;
reset_cpu_time(CPUTIME_INTERVAL_SOFT); reset_cpu_time(CPUTIME_INTERVAL_SOFT);
@ -230,7 +230,7 @@ void pa_cpu_limit_done(void) {
if (installed) { if (installed) {
pa_assert_se(sigaction(SIGXCPU, &sigaction_prev, NULL) >= 0); pa_assert_se(sigaction(SIGXCPU, &sigaction_prev, NULL) >= 0);
installed = FALSE; installed = false;
} }
} }

View file

@ -62,39 +62,39 @@
static const pa_daemon_conf default_conf = { static const pa_daemon_conf default_conf = {
.cmd = PA_CMD_DAEMON, .cmd = PA_CMD_DAEMON,
.daemonize = FALSE, .daemonize = false,
.fail = TRUE, .fail = true,
.high_priority = TRUE, .high_priority = true,
.nice_level = -11, .nice_level = -11,
.realtime_scheduling = TRUE, .realtime_scheduling = true,
.realtime_priority = 5, /* Half of JACK's default rtprio */ .realtime_priority = 5, /* Half of JACK's default rtprio */
.disallow_module_loading = FALSE, .disallow_module_loading = false,
.disallow_exit = FALSE, .disallow_exit = false,
.flat_volumes = TRUE, .flat_volumes = true,
.exit_idle_time = 20, .exit_idle_time = 20,
.scache_idle_time = 20, .scache_idle_time = 20,
.script_commands = NULL, .script_commands = NULL,
.dl_search_path = NULL, .dl_search_path = NULL,
.load_default_script_file = TRUE, .load_default_script_file = true,
.default_script_file = NULL, .default_script_file = NULL,
.log_target = NULL, .log_target = NULL,
.log_level = PA_LOG_NOTICE, .log_level = PA_LOG_NOTICE,
.log_backtrace = 0, .log_backtrace = 0,
.log_meta = FALSE, .log_meta = false,
.log_time = FALSE, .log_time = false,
.resample_method = PA_RESAMPLER_AUTO, .resample_method = PA_RESAMPLER_AUTO,
.disable_remixing = FALSE, .disable_remixing = false,
.disable_lfe_remixing = TRUE, .disable_lfe_remixing = true,
.config_file = NULL, .config_file = NULL,
.use_pid_file = TRUE, .use_pid_file = true,
.system_instance = FALSE, .system_instance = false,
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
.local_server_type = PA_SERVER_TYPE_UNSET, /* The actual default is _USER, but we have to detect when the user doesn't specify this option. */ .local_server_type = PA_SERVER_TYPE_UNSET, /* The actual default is _USER, but we have to detect when the user doesn't specify this option. */
#endif #endif
.no_cpu_limit = TRUE, .no_cpu_limit = true,
.disable_shm = FALSE, .disable_shm = false,
.lock_memory = FALSE, .lock_memory = false,
.deferred_volume = TRUE, .deferred_volume = true,
.default_n_fragments = 4, .default_n_fragments = 4,
.default_fragment_size_msec = 25, .default_fragment_size_msec = 25,
.deferred_volume_safety_margin_usec = 8000, .deferred_volume_safety_margin_usec = 8000,
@ -104,42 +104,42 @@ static const pa_daemon_conf default_conf = {
.default_channel_map = { .channels = 2, .map = { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT } }, .default_channel_map = { .channels = 2, .map = { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT } },
.shm_size = 0 .shm_size = 0
#ifdef HAVE_SYS_RESOURCE_H #ifdef HAVE_SYS_RESOURCE_H
,.rlimit_fsize = { .value = 0, .is_set = FALSE }, ,.rlimit_fsize = { .value = 0, .is_set = false },
.rlimit_data = { .value = 0, .is_set = FALSE }, .rlimit_data = { .value = 0, .is_set = false },
.rlimit_stack = { .value = 0, .is_set = FALSE }, .rlimit_stack = { .value = 0, .is_set = false },
.rlimit_core = { .value = 0, .is_set = FALSE } .rlimit_core = { .value = 0, .is_set = false }
#ifdef RLIMIT_RSS #ifdef RLIMIT_RSS
,.rlimit_rss = { .value = 0, .is_set = FALSE } ,.rlimit_rss = { .value = 0, .is_set = false }
#endif #endif
#ifdef RLIMIT_NPROC #ifdef RLIMIT_NPROC
,.rlimit_nproc = { .value = 0, .is_set = FALSE } ,.rlimit_nproc = { .value = 0, .is_set = false }
#endif #endif
#ifdef RLIMIT_NOFILE #ifdef RLIMIT_NOFILE
,.rlimit_nofile = { .value = 256, .is_set = TRUE } ,.rlimit_nofile = { .value = 256, .is_set = true }
#endif #endif
#ifdef RLIMIT_MEMLOCK #ifdef RLIMIT_MEMLOCK
,.rlimit_memlock = { .value = 0, .is_set = FALSE } ,.rlimit_memlock = { .value = 0, .is_set = false }
#endif #endif
#ifdef RLIMIT_AS #ifdef RLIMIT_AS
,.rlimit_as = { .value = 0, .is_set = FALSE } ,.rlimit_as = { .value = 0, .is_set = false }
#endif #endif
#ifdef RLIMIT_LOCKS #ifdef RLIMIT_LOCKS
,.rlimit_locks = { .value = 0, .is_set = FALSE } ,.rlimit_locks = { .value = 0, .is_set = false }
#endif #endif
#ifdef RLIMIT_SIGPENDING #ifdef RLIMIT_SIGPENDING
,.rlimit_sigpending = { .value = 0, .is_set = FALSE } ,.rlimit_sigpending = { .value = 0, .is_set = false }
#endif #endif
#ifdef RLIMIT_MSGQUEUE #ifdef RLIMIT_MSGQUEUE
,.rlimit_msgqueue = { .value = 0, .is_set = FALSE } ,.rlimit_msgqueue = { .value = 0, .is_set = false }
#endif #endif
#ifdef RLIMIT_NICE #ifdef RLIMIT_NICE
,.rlimit_nice = { .value = 31, .is_set = TRUE } /* nice level of -11 */ ,.rlimit_nice = { .value = 31, .is_set = true } /* nice level of -11 */
#endif #endif
#ifdef RLIMIT_RTPRIO #ifdef RLIMIT_RTPRIO
,.rlimit_rtprio = { .value = 9, .is_set = TRUE } /* One below JACK's default for the server */ ,.rlimit_rtprio = { .value = 9, .is_set = true } /* One below JACK's default for the server */
#endif #endif
#ifdef RLIMIT_RTTIME #ifdef RLIMIT_RTTIME
,.rlimit_rttime = { .value = PA_USEC_PER_SEC, .is_set = TRUE } ,.rlimit_rttime = { .value = PA_USEC_PER_SEC, .is_set = true }
#endif #endif
#endif #endif
}; };
@ -375,8 +375,8 @@ static int parse_alternate_sample_rate(pa_config_parser_state *state) {
struct channel_conf_info { struct channel_conf_info {
pa_daemon_conf *conf; pa_daemon_conf *conf;
pa_bool_t default_sample_spec_set; bool default_sample_spec_set;
pa_bool_t default_channel_map_set; bool default_channel_map_set;
}; };
static int parse_sample_channels(pa_config_parser_state *state) { static int parse_sample_channels(pa_config_parser_state *state) {
@ -393,7 +393,7 @@ static int parse_sample_channels(pa_config_parser_state *state) {
} }
i->conf->default_sample_spec.channels = (uint8_t) n; i->conf->default_sample_spec.channels = (uint8_t) n;
i->default_sample_spec_set = TRUE; i->default_sample_spec_set = true;
return 0; return 0;
} }
@ -409,7 +409,7 @@ static int parse_channel_map(pa_config_parser_state *state) {
return -1; return -1;
} }
i->default_channel_map_set = TRUE; i->default_channel_map_set = true;
return 0; return 0;
} }
@ -616,7 +616,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
goto finish; goto finish;
} }
ci.default_channel_map_set = ci.default_sample_spec_set = FALSE; ci.default_channel_map_set = ci.default_sample_spec_set = false;
ci.conf = c; ci.conf = c;
r = f ? pa_config_parse(c->config_file, f, table, NULL, NULL) : 0; r = f ? pa_config_parse(c->config_file, f, table, NULL, NULL) : 0;

View file

@ -52,14 +52,14 @@ typedef enum pa_daemon_conf_cmd {
#ifdef HAVE_SYS_RESOURCE_H #ifdef HAVE_SYS_RESOURCE_H
typedef struct pa_rlimit { typedef struct pa_rlimit {
rlim_t value; rlim_t value;
pa_bool_t is_set; bool is_set;
} pa_rlimit; } pa_rlimit;
#endif #endif
/* A structure containing configuration data for the PulseAudio server . */ /* A structure containing configuration data for the PulseAudio server . */
typedef struct pa_daemon_conf { typedef struct pa_daemon_conf {
pa_daemon_conf_cmd_t cmd; pa_daemon_conf_cmd_t cmd;
pa_bool_t daemonize, bool daemonize,
fail, fail,
high_priority, high_priority,
realtime_scheduling, realtime_scheduling,

View file

@ -202,12 +202,12 @@ static int change_user(void) {
if (!pa_streq(pw->pw_dir, PA_SYSTEM_RUNTIME_PATH)) if (!pa_streq(pw->pw_dir, PA_SYSTEM_RUNTIME_PATH))
pa_log_warn(_("Home directory of user '%s' is not '%s', ignoring."), PA_SYSTEM_USER, PA_SYSTEM_RUNTIME_PATH); pa_log_warn(_("Home directory of user '%s' is not '%s', ignoring."), PA_SYSTEM_USER, PA_SYSTEM_RUNTIME_PATH);
if (pa_make_secure_dir(PA_SYSTEM_RUNTIME_PATH, 0755, pw->pw_uid, gr->gr_gid, TRUE) < 0) { if (pa_make_secure_dir(PA_SYSTEM_RUNTIME_PATH, 0755, pw->pw_uid, gr->gr_gid, true) < 0) {
pa_log(_("Failed to create '%s': %s"), PA_SYSTEM_RUNTIME_PATH, pa_cstrerror(errno)); pa_log(_("Failed to create '%s': %s"), PA_SYSTEM_RUNTIME_PATH, pa_cstrerror(errno));
return -1; return -1;
} }
if (pa_make_secure_dir(PA_SYSTEM_STATE_PATH, 0700, pw->pw_uid, gr->gr_gid, TRUE) < 0) { if (pa_make_secure_dir(PA_SYSTEM_STATE_PATH, 0700, pw->pw_uid, gr->gr_gid, true) < 0) {
pa_log(_("Failed to create '%s': %s"), PA_SYSTEM_STATE_PATH, pa_cstrerror(errno)); pa_log(_("Failed to create '%s': %s"), PA_SYSTEM_STATE_PATH, pa_cstrerror(errno));
return -1; return -1;
} }
@ -402,8 +402,8 @@ int main(int argc, char *argv[]) {
char *s; char *s;
char *configured_address; char *configured_address;
int r = 0, retval = 1, d = 0; int r = 0, retval = 1, d = 0;
pa_bool_t valid_pid_file = FALSE; bool valid_pid_file = false;
pa_bool_t ltdl_init = FALSE; bool ltdl_init = false;
int passed_fd = -1; int passed_fd = -1;
const char *e; const char *e;
#ifdef HAVE_FORK #ifdef HAVE_FORK
@ -415,12 +415,12 @@ int main(int argc, char *argv[]) {
struct timeval win32_tv; struct timeval win32_tv;
#endif #endif
int autospawn_fd = -1; int autospawn_fd = -1;
pa_bool_t autospawn_locked = FALSE; bool autospawn_locked = false;
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
pa_dbusobj_server_lookup *server_lookup = NULL; /* /org/pulseaudio/server_lookup */ pa_dbusobj_server_lookup *server_lookup = NULL; /* /org/pulseaudio/server_lookup */
pa_dbus_connection *lookup_service_bus = NULL; /* Always the user bus. */ pa_dbus_connection *lookup_service_bus = NULL; /* Always the user bus. */
pa_dbus_connection *server_bus = NULL; /* The bus where we reserve org.pulseaudio.Server, either the user or the system bus. */ pa_dbus_connection *server_bus = NULL; /* The bus where we reserve org.pulseaudio.Server, either the user or the system bus. */
pa_bool_t start_server; bool start_server;
#endif #endif
pa_log_set_ident("pulseaudio"); pa_log_set_ident("pulseaudio");
@ -522,10 +522,10 @@ int main(int argc, char *argv[]) {
break; break;
case PA_SERVER_TYPE_USER: case PA_SERVER_TYPE_USER:
case PA_SERVER_TYPE_NONE: case PA_SERVER_TYPE_NONE:
conf->system_instance = FALSE; conf->system_instance = false;
break; break;
case PA_SERVER_TYPE_SYSTEM: case PA_SERVER_TYPE_SYSTEM:
conf->system_instance = TRUE; conf->system_instance = true;
break; break;
default: default:
pa_assert_not_reached(); pa_assert_not_reached();
@ -535,13 +535,13 @@ int main(int argc, char *argv[]) {
if (!start_server && conf->local_server_type == PA_SERVER_TYPE_SYSTEM) { if (!start_server && conf->local_server_type == PA_SERVER_TYPE_SYSTEM) {
pa_log_notice(_("System mode refused for non-root user. Only starting the D-Bus server lookup service.")); pa_log_notice(_("System mode refused for non-root user. Only starting the D-Bus server lookup service."));
conf->system_instance = FALSE; conf->system_instance = false;
} }
#endif #endif
LTDL_SET_PRELOADED_SYMBOLS(); LTDL_SET_PRELOADED_SYMBOLS();
pa_ltdl_init(); pa_ltdl_init();
ltdl_init = TRUE; ltdl_init = true;
if (conf->dl_search_path) if (conf->dl_search_path)
lt_dlsetsearchpath(conf->dl_search_path); lt_dlsetsearchpath(conf->dl_search_path);
@ -685,7 +685,7 @@ int main(int argc, char *argv[]) {
* recover (i.e. autospawn) from a crash. * recover (i.e. autospawn) from a crash.
*/ */
char *ufn; char *ufn;
pa_bool_t start_anyway = FALSE; bool start_anyway = false;
if ((ufn = pa_runtime_path(PA_NATIVE_DEFAULT_UNIX_SOCKET))) { if ((ufn = pa_runtime_path(PA_NATIVE_DEFAULT_UNIX_SOCKET))) {
char *id; char *id;
@ -730,7 +730,7 @@ int main(int argc, char *argv[]) {
if (conf->system_instance && !conf->disable_shm) { if (conf->system_instance && !conf->disable_shm) {
pa_log_notice(_("Running in system mode, forcibly disabling SHM mode!")); pa_log_notice(_("Running in system mode, forcibly disabling SHM mode!"));
conf->disable_shm = TRUE; conf->disable_shm = true;
} }
if (conf->system_instance && conf->exit_idle_time >= 0) { if (conf->system_instance && conf->exit_idle_time >= 0) {
@ -748,12 +748,12 @@ int main(int argc, char *argv[]) {
goto finish; goto finish;
} }
if ((pa_autospawn_lock_acquire(TRUE) < 0)) { if ((pa_autospawn_lock_acquire(true) < 0)) {
pa_log("Failed to acquire autospawn lock"); pa_log("Failed to acquire autospawn lock");
goto finish; goto finish;
} }
autospawn_locked = TRUE; autospawn_locked = true;
} }
if (conf->daemonize) { if (conf->daemonize) {
@ -806,9 +806,9 @@ int main(int argc, char *argv[]) {
* to close it in the child */ * to close it in the child */
pa_autospawn_lock_release(); pa_autospawn_lock_release();
pa_autospawn_lock_done(TRUE); pa_autospawn_lock_done(true);
autospawn_locked = FALSE; autospawn_locked = false;
autospawn_fd = -1; autospawn_fd = -1;
} }
@ -992,7 +992,7 @@ int main(int argc, char *argv[]) {
goto finish; goto finish;
} }
valid_pid_file = TRUE; valid_pid_file = true;
} }
pa_disable_sigpipe(); pa_disable_sigpipe();
@ -1110,7 +1110,7 @@ int main(int argc, char *argv[]) {
* any modules to be loaded. We haven't loaded any so far, so one might * any modules to be loaded. We haven't loaded any so far, so one might
* think there's no way to contact the server, but receiving certain * think there's no way to contact the server, but receiving certain
* signals could still cause modules to load. */ * signals could still cause modules to load. */
conf->disallow_module_loading = TRUE; conf->disallow_module_loading = true;
} }
#endif #endif
@ -1161,7 +1161,7 @@ finish:
if (autospawn_locked) if (autospawn_locked)
pa_autospawn_lock_release(); pa_autospawn_lock_release();
pa_autospawn_lock_done(FALSE); pa_autospawn_lock_done(false);
} }
#ifdef OS_IS_WIN32 #ifdef OS_IS_WIN32

View file

@ -42,7 +42,7 @@
struct pa_dbusobj_server_lookup { struct pa_dbusobj_server_lookup {
pa_core *core; pa_core *core;
pa_dbus_connection *conn; pa_dbus_connection *conn;
pa_bool_t path_registered; bool path_registered;
}; };
static const char introspection[] = static const char introspection[] =
@ -82,7 +82,7 @@ static void unregister_cb(DBusConnection *conn, void *user_data) {
pa_assert(sl); pa_assert(sl);
pa_assert(sl->path_registered); pa_assert(sl->path_registered);
sl->path_registered = FALSE; sl->path_registered = false;
} }
static DBusHandlerResult handle_introspect(DBusConnection *conn, DBusMessage *msg, pa_dbusobj_server_lookup *sl) { static DBusHandlerResult handle_introspect(DBusConnection *conn, DBusMessage *msg, pa_dbusobj_server_lookup *sl) {
@ -482,7 +482,7 @@ pa_dbusobj_server_lookup *pa_dbusobj_server_lookup_new(pa_core *c) {
sl = pa_xnew(pa_dbusobj_server_lookup, 1); sl = pa_xnew(pa_dbusobj_server_lookup, 1);
sl->core = c; sl->core = c;
sl->path_registered = FALSE; sl->path_registered = false;
if (!(sl->conn = pa_dbus_bus_get(c, DBUS_BUS_SESSION, &error)) || dbus_error_is_set(&error)) { if (!(sl->conn = pa_dbus_bus_get(c, DBUS_BUS_SESSION, &error)) || dbus_error_is_set(&error)) {
pa_log_warn("Unable to contact D-Bus: %s: %s", error.name, error.message); pa_log_warn("Unable to contact D-Bus: %s: %s", error.name, error.message);
@ -494,7 +494,7 @@ pa_dbusobj_server_lookup *pa_dbusobj_server_lookup_new(pa_core *c) {
goto fail; goto fail;
} }
sl->path_registered = TRUE; sl->path_registered = true;
return sl; return sl;

View file

@ -83,7 +83,7 @@ struct pa_alsa_fdlist {
pa_defer_event *defer; pa_defer_event *defer;
pa_io_event **ios; pa_io_event **ios;
pa_bool_t polled; bool polled;
void (*cb)(void *userdata); void (*cb)(void *userdata);
void *userdata; void *userdata;
@ -105,7 +105,7 @@ static void io_cb(pa_mainloop_api *a, pa_io_event *e, int fd, pa_io_event_flags_
if (fdl->polled) if (fdl->polled)
return; return;
fdl->polled = TRUE; fdl->polled = true;
memcpy(fdl->work_fds, fdl->fds, sizeof(struct pollfd) * fdl->num_fds); memcpy(fdl->work_fds, fdl->fds, sizeof(struct pollfd) * fdl->num_fds);
@ -189,7 +189,7 @@ static void defer_cb(pa_mainloop_api *a, pa_defer_event *e, void *userdata) {
return; return;
} }
fdl->polled = FALSE; fdl->polled = false;
if (memcmp(fdl->fds, fdl->work_fds, sizeof(struct pollfd) * num_fds) == 0) if (memcmp(fdl->fds, fdl->work_fds, sizeof(struct pollfd) * num_fds) == 0)
return; return;
@ -559,7 +559,7 @@ static pa_volume_t from_alsa_volume(long v, long min, long max) {
snd_mixer_selem_id_alloca(&(sid)); \ snd_mixer_selem_id_alloca(&(sid)); \
snd_mixer_selem_id_set_name((sid), (name)); \ snd_mixer_selem_id_set_name((sid), (name)); \
snd_mixer_selem_id_set_index((sid), 0); \ snd_mixer_selem_id_set_index((sid), 0); \
} while(FALSE) } while(false)
static int element_get_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v) { static int element_get_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v) {
snd_mixer_selem_id_t *sid; snd_mixer_selem_id_t *sid;
@ -729,7 +729,7 @@ int pa_alsa_path_get_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_ma
return 0; return 0;
} }
static int element_get_switch(pa_alsa_element *e, snd_mixer_t *m, pa_bool_t *b) { static int element_get_switch(pa_alsa_element *e, snd_mixer_t *m, bool *b) {
snd_mixer_selem_id_t *sid; snd_mixer_selem_id_t *sid;
snd_mixer_elem_t *me; snd_mixer_elem_t *me;
snd_mixer_selem_channel_id_t c; snd_mixer_selem_channel_id_t c;
@ -766,16 +766,16 @@ static int element_get_switch(pa_alsa_element *e, snd_mixer_t *m, pa_bool_t *b)
continue; continue;
if (!value) { if (!value) {
*b = FALSE; *b = false;
return 0; return 0;
} }
} }
*b = TRUE; *b = true;
return 0; return 0;
} }
int pa_alsa_path_get_mute(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t *muted) { int pa_alsa_path_get_mute(pa_alsa_path *p, snd_mixer_t *m, bool *muted) {
pa_alsa_element *e; pa_alsa_element *e;
pa_assert(m); pa_assert(m);
@ -786,7 +786,7 @@ int pa_alsa_path_get_mute(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t *muted) {
return -1; return -1;
PA_LLIST_FOREACH(e, p->elements) { PA_LLIST_FOREACH(e, p->elements) {
pa_bool_t b; bool b;
if (e->switch_use != PA_ALSA_SWITCH_MUTE) if (e->switch_use != PA_ALSA_SWITCH_MUTE)
continue; continue;
@ -795,12 +795,12 @@ int pa_alsa_path_get_mute(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t *muted) {
return -1; return -1;
if (!b) { if (!b) {
*muted = TRUE; *muted = true;
return 0; return 0;
} }
} }
*muted = FALSE; *muted = false;
return 0; return 0;
} }
@ -887,7 +887,7 @@ static int element_get_nearest_alsa_dB(snd_mixer_elem_t *me, snd_mixer_selem_cha
return r; return r;
} }
static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t deferred_volume, pa_bool_t write_to_hw) { static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, bool deferred_volume, bool write_to_hw) {
snd_mixer_selem_id_t *sid; snd_mixer_selem_id_t *sid;
pa_cvolume rv; pa_cvolume rv;
@ -913,11 +913,11 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
for (c = 0; c <= SND_MIXER_SCHN_LAST; c++) { for (c = 0; c <= SND_MIXER_SCHN_LAST; c++) {
int r; int r;
pa_volume_t f = PA_VOLUME_MUTED; pa_volume_t f = PA_VOLUME_MUTED;
pa_bool_t found = FALSE; bool found = false;
for (k = 0; k < cm->channels; k++) for (k = 0; k < cm->channels; k++)
if (e->masks[c][e->n_channels-1] & PA_CHANNEL_POSITION_MASK(cm->map[k])) { if (e->masks[c][e->n_channels-1] & PA_CHANNEL_POSITION_MASK(cm->map[k])) {
found = TRUE; found = true;
if (v->values[k] > f) if (v->values[k] > f)
f = v->values[k]; f = v->values[k];
} }
@ -1047,7 +1047,7 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
return 0; return 0;
} }
int pa_alsa_path_set_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t deferred_volume, pa_bool_t write_to_hw) { int pa_alsa_path_set_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, bool deferred_volume, bool write_to_hw) {
pa_alsa_element *e; pa_alsa_element *e;
pa_cvolume rv; pa_cvolume rv;
@ -1088,7 +1088,7 @@ int pa_alsa_path_set_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_ma
return 0; return 0;
} }
static int element_set_switch(pa_alsa_element *e, snd_mixer_t *m, pa_bool_t b) { static int element_set_switch(pa_alsa_element *e, snd_mixer_t *m, bool b) {
snd_mixer_elem_t *me; snd_mixer_elem_t *me;
snd_mixer_selem_id_t *sid; snd_mixer_selem_id_t *sid;
int r; int r;
@ -1113,7 +1113,7 @@ static int element_set_switch(pa_alsa_element *e, snd_mixer_t *m, pa_bool_t b) {
return r; return r;
} }
int pa_alsa_path_set_mute(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t muted) { int pa_alsa_path_set_mute(pa_alsa_path *p, snd_mixer_t *m, bool muted) {
pa_alsa_element *e; pa_alsa_element *e;
pa_assert(m); pa_assert(m);
@ -1142,7 +1142,7 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) {
snd_mixer_selem_id_t *sid = NULL; snd_mixer_selem_id_t *sid = NULL;
int r = 0; int r = 0;
long volume = -1; long volume = -1;
pa_bool_t volume_set = FALSE; bool volume_set = false;
pa_assert(m); pa_assert(m);
pa_assert(e); pa_assert(e);
@ -1156,7 +1156,7 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) {
switch (e->volume_use) { switch (e->volume_use) {
case PA_ALSA_VOLUME_OFF: case PA_ALSA_VOLUME_OFF:
volume = e->min_volume; volume = e->min_volume;
volume_set = TRUE; volume_set = true;
break; break;
case PA_ALSA_VOLUME_ZERO: case PA_ALSA_VOLUME_ZERO:
@ -1164,13 +1164,13 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) {
long dB = 0; long dB = 0;
volume = decibel_fix_get_step(e->db_fix, &dB, (e->direction == PA_ALSA_DIRECTION_OUTPUT ? +1 : -1)); volume = decibel_fix_get_step(e->db_fix, &dB, (e->direction == PA_ALSA_DIRECTION_OUTPUT ? +1 : -1));
volume_set = TRUE; volume_set = true;
} }
break; break;
case PA_ALSA_VOLUME_CONSTANT: case PA_ALSA_VOLUME_CONSTANT:
volume = e->constant_volume; volume = e->constant_volume;
volume_set = TRUE; volume_set = true;
break; break;
default: default:
@ -1217,7 +1217,7 @@ int pa_alsa_path_select(pa_alsa_path *p, pa_alsa_setting *s, snd_mixer_t *m, boo
* selecting a path, so we ignore the return value. * selecting a path, so we ignore the return value.
* element_set_switch() will print a warning anyway, so this * element_set_switch() will print a warning anyway, so this
* won't be a silent failure either. */ * won't be a silent failure either. */
(void) element_set_switch(e, m, FALSE); (void) element_set_switch(e, m, false);
} }
} }
@ -1225,11 +1225,11 @@ int pa_alsa_path_select(pa_alsa_path *p, pa_alsa_setting *s, snd_mixer_t *m, boo
switch (e->switch_use) { switch (e->switch_use) {
case PA_ALSA_SWITCH_OFF: case PA_ALSA_SWITCH_OFF:
r = element_set_switch(e, m, FALSE); r = element_set_switch(e, m, false);
break; break;
case PA_ALSA_SWITCH_ON: case PA_ALSA_SWITCH_ON:
r = element_set_switch(e, m, TRUE); r = element_set_switch(e, m, true);
break; break;
case PA_ALSA_SWITCH_MUTE: case PA_ALSA_SWITCH_MUTE:
@ -1276,9 +1276,9 @@ int pa_alsa_path_select(pa_alsa_path *p, pa_alsa_setting *s, snd_mixer_t *m, boo
} }
static int check_required(pa_alsa_element *e, snd_mixer_elem_t *me) { static int check_required(pa_alsa_element *e, snd_mixer_elem_t *me) {
pa_bool_t has_switch; bool has_switch;
pa_bool_t has_enumeration; bool has_enumeration;
pa_bool_t has_volume; bool has_volume;
pa_assert(e); pa_assert(e);
pa_assert(me); pa_assert(me);
@ -1401,7 +1401,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
} }
if (e->switch_use != PA_ALSA_SWITCH_IGNORE) if (e->switch_use != PA_ALSA_SWITCH_IGNORE)
e->direction_try_other = FALSE; e->direction_try_other = false;
} }
if (e->volume_use != PA_ALSA_VOLUME_IGNORE) { if (e->volume_use != PA_ALSA_VOLUME_IGNORE) {
@ -1429,7 +1429,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
long min_dB = 0, max_dB = 0; long min_dB = 0, max_dB = 0;
int r; int r;
e->direction_try_other = FALSE; e->direction_try_other = false;
if (e->direction == PA_ALSA_DIRECTION_OUTPUT) if (e->direction == PA_ALSA_DIRECTION_OUTPUT)
r = snd_mixer_selem_get_playback_volume_range(me, &e->min_volume, &e->max_volume); r = snd_mixer_selem_get_playback_volume_range(me, &e->min_volume, &e->max_volume);
@ -1452,7 +1452,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
e->volume_use = PA_ALSA_VOLUME_IGNORE; e->volume_use = PA_ALSA_VOLUME_IGNORE;
} else { } else {
pa_bool_t is_mono; bool is_mono;
pa_channel_position_t p; pa_channel_position_t p;
if (e->db_fix && if (e->db_fix &&
@ -1468,7 +1468,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
} }
if (e->db_fix) { if (e->db_fix) {
e->has_dB = TRUE; e->has_dB = true;
e->min_volume = e->db_fix->min_step; e->min_volume = e->db_fix->min_step;
e->max_volume = e->db_fix->max_step; e->max_volume = e->db_fix->max_step;
min_dB = e->db_fix->db_values[0]; min_dB = e->db_fix->db_values[0];
@ -1527,7 +1527,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
if (min_dB >= max_dB) { if (min_dB >= max_dB) {
pa_assert(!e->db_fix); pa_assert(!e->db_fix);
pa_log_warn("Your kernel driver is broken: it reports a volume range from %0.2f dB to %0.2f dB which makes no sense.", e->min_dB, e->max_dB); pa_log_warn("Your kernel driver is broken: it reports a volume range from %0.2f dB to %0.2f dB which makes no sense.", e->min_dB, e->max_dB);
e->has_dB = FALSE; e->has_dB = false;
} }
} }
@ -1553,7 +1553,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
if (r < 0) { if (r < 0) {
pa_log_warn("Failed to get dB value of %s: %s", e->alsa_name, pa_alsa_strerror(r)); pa_log_warn("Failed to get dB value of %s: %s", e->alsa_name, pa_alsa_strerror(r));
e->has_dB = FALSE; e->has_dB = false;
} else } else
e->max_dB = ((double) max_dB) / 100.0; e->max_dB = ((double) max_dB) / 100.0;
} }
@ -1617,7 +1617,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
if (!e->override_map) { if (!e->override_map) {
for (p = PA_CHANNEL_POSITION_FRONT_LEFT; p < PA_CHANNEL_POSITION_MAX; p++) { for (p = PA_CHANNEL_POSITION_FRONT_LEFT; p < PA_CHANNEL_POSITION_MAX; p++) {
pa_bool_t has_channel; bool has_channel;
if (alsa_channel_ids[p] == SND_MIXER_SCHN_UNKNOWN) if (alsa_channel_ids[p] == SND_MIXER_SCHN_UNKNOWN)
continue; continue;
@ -1692,7 +1692,7 @@ static int jack_probe(pa_alsa_jack *j, snd_hctl_t *h) {
if (j->required_absent != PA_ALSA_REQUIRED_IGNORE) if (j->required_absent != PA_ALSA_REQUIRED_IGNORE)
return -1; return -1;
if (j->required_any != PA_ALSA_REQUIRED_IGNORE) if (j->required_any != PA_ALSA_REQUIRED_IGNORE)
j->path->req_any_present = TRUE; j->path->req_any_present = true;
} else { } else {
if (j->required != PA_ALSA_REQUIRED_IGNORE) if (j->required != PA_ALSA_REQUIRED_IGNORE)
return -1; return -1;
@ -1701,7 +1701,7 @@ static int jack_probe(pa_alsa_jack *j, snd_hctl_t *h) {
return 0; return 0;
} }
static pa_alsa_element* element_get(pa_alsa_path *p, const char *section, pa_bool_t prefixed) { static pa_alsa_element* element_get(pa_alsa_path *p, const char *section, bool prefixed) {
pa_alsa_element *e; pa_alsa_element *e;
pa_assert(p); pa_assert(p);
@ -1790,7 +1790,7 @@ static pa_alsa_option* option_get(pa_alsa_path *p, const char *section) {
return p->last_option; return p->last_option;
} }
pa_assert_se(e = element_get(p, en, FALSE)); pa_assert_se(e = element_get(p, en, false));
pa_xfree(en); pa_xfree(en);
PA_LLIST_FOREACH(o, e->options) PA_LLIST_FOREACH(o, e->options)
@ -1820,7 +1820,7 @@ static int element_parse_switch(pa_config_parser_state *state) {
p = state->userdata; p = state->userdata;
if (!(e = element_get(p, state->section, TRUE))) { if (!(e = element_get(p, state->section, true))) {
pa_log("[%s:%u] Switch makes no sense in '%s'", state->filename, state->lineno, state->section); pa_log("[%s:%u] Switch makes no sense in '%s'", state->filename, state->lineno, state->section);
return -1; return -1;
} }
@ -1851,7 +1851,7 @@ static int element_parse_volume(pa_config_parser_state *state) {
p = state->userdata; p = state->userdata;
if (!(e = element_get(p, state->section, TRUE))) { if (!(e = element_get(p, state->section, true))) {
pa_log("[%s:%u] Volume makes no sense in '%s'", state->filename, state->lineno, state->section); pa_log("[%s:%u] Volume makes no sense in '%s'", state->filename, state->lineno, state->section);
return -1; return -1;
} }
@ -1887,7 +1887,7 @@ static int element_parse_enumeration(pa_config_parser_state *state) {
p = state->userdata; p = state->userdata;
if (!(e = element_get(p, state->section, TRUE))) { if (!(e = element_get(p, state->section, true))) {
pa_log("[%s:%u] Enumeration makes no sense in '%s'", state->filename, state->lineno, state->section); pa_log("[%s:%u] Enumeration makes no sense in '%s'", state->filename, state->lineno, state->section);
return -1; return -1;
} }
@ -1957,7 +1957,7 @@ static int element_parse_required(pa_config_parser_state *state) {
p = state->userdata; p = state->userdata;
e = element_get(p, state->section, TRUE); e = element_get(p, state->section, true);
o = option_get(p, state->section); o = option_get(p, state->section);
j = jack_get(p, state->section); j = jack_get(p, state->section);
if (!e && !o && !j) { if (!e && !o && !j) {
@ -2023,7 +2023,7 @@ static int element_parse_direction(pa_config_parser_state *state) {
p = state->userdata; p = state->userdata;
if (!(e = element_get(p, state->section, TRUE))) { if (!(e = element_get(p, state->section, true))) {
pa_log("[%s:%u] Direction makes no sense in '%s'", state->filename, state->lineno, state->section); pa_log("[%s:%u] Direction makes no sense in '%s'", state->filename, state->lineno, state->section);
return -1; return -1;
} }
@ -2049,7 +2049,7 @@ static int element_parse_direction_try_other(pa_config_parser_state *state) {
p = state->userdata; p = state->userdata;
if (!(e = element_get(p, state->section, TRUE))) { if (!(e = element_get(p, state->section, true))) {
pa_log("[%s:%u] Direction makes no sense in '%s'", state->filename, state->lineno, state->section); pa_log("[%s:%u] Direction makes no sense in '%s'", state->filename, state->lineno, state->section);
return -1; return -1;
} }
@ -2072,7 +2072,7 @@ static int element_parse_volume_limit(pa_config_parser_state *state) {
p = state->userdata; p = state->userdata;
if (!(e = element_get(p, state->section, TRUE))) { if (!(e = element_get(p, state->section, true))) {
pa_log("[%s:%u] volume-limit makes no sense in '%s'", state->filename, state->lineno, state->section); pa_log("[%s:%u] volume-limit makes no sense in '%s'", state->filename, state->lineno, state->section);
return -1; return -1;
} }
@ -2130,7 +2130,7 @@ static int element_parse_override_map(pa_config_parser_state *state) {
p = state->userdata; p = state->userdata;
if (!(e = element_get(p, state->section, TRUE))) { if (!(e = element_get(p, state->section, true))) {
pa_log("[%s:%u] Override map makes no sense in '%s'", state->filename, state->lineno, state->section); pa_log("[%s:%u] Override map makes no sense in '%s'", state->filename, state->lineno, state->section);
return -1; return -1;
} }
@ -2158,7 +2158,7 @@ static int element_parse_override_map(pa_config_parser_state *state) {
pa_xfree(n); pa_xfree(n);
} }
e->override_map = TRUE; e->override_map = true;
return 0; return 0;
} }
@ -2482,7 +2482,7 @@ pa_alsa_path *pa_alsa_path_synthesize(const char *element, pa_alsa_direction_t d
return p; return p;
} }
static pa_bool_t element_drop_unsupported(pa_alsa_element *e) { static bool element_drop_unsupported(pa_alsa_element *e) {
pa_alsa_option *o, *n; pa_alsa_option *o, *n;
pa_assert(e); pa_assert(e);
@ -2558,7 +2558,7 @@ static void path_make_options_unique(pa_alsa_path *p) {
} }
} }
static pa_bool_t element_create_settings(pa_alsa_element *e, pa_alsa_setting *template) { static bool element_create_settings(pa_alsa_element *e, pa_alsa_setting *template) {
pa_alsa_option *o; pa_alsa_option *o;
for (; e; e = e->next) for (; e; e = e->next)
@ -2567,7 +2567,7 @@ static pa_bool_t element_create_settings(pa_alsa_element *e, pa_alsa_setting *te
break; break;
if (!e) if (!e)
return FALSE; return false;
for (o = e->options; o; o = o->next) { for (o = e->options; o; o = o->next) {
pa_alsa_setting *s; pa_alsa_setting *s;
@ -2605,7 +2605,7 @@ static pa_bool_t element_create_settings(pa_alsa_element *e, pa_alsa_setting *te
} }
} }
return TRUE; return true;
} }
static void path_create_settings(pa_alsa_path *p) { static void path_create_settings(pa_alsa_path *p) {
@ -2614,7 +2614,7 @@ static void path_create_settings(pa_alsa_path *p) {
element_create_settings(p->elements, NULL); element_create_settings(p->elements, NULL);
} }
int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_bool_t ignore_dB) { int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, bool ignore_dB) {
pa_alsa_element *e; pa_alsa_element *e;
pa_alsa_jack *j; pa_alsa_jack *j;
double min_dB[PA_CHANNEL_POSITION_MAX], max_dB[PA_CHANNEL_POSITION_MAX]; double min_dB[PA_CHANNEL_POSITION_MAX], max_dB[PA_CHANNEL_POSITION_MAX];
@ -2626,7 +2626,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_boo
if (p->probed) if (p->probed)
return p->supported ? 0 : -1; return p->supported ? 0 : -1;
p->probed = TRUE; p->probed = true;
pa_zero(min_dB); pa_zero(min_dB);
pa_zero(max_dB); pa_zero(max_dB);
@ -2635,7 +2635,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_boo
PA_LLIST_FOREACH(j, p->jacks) { PA_LLIST_FOREACH(j, p->jacks) {
if (jack_probe(j, hctl) < 0) { if (jack_probe(j, hctl) < 0) {
p->supported = FALSE; p->supported = false;
pa_log_debug("Probe of jack '%s' failed.", j->alsa_name); pa_log_debug("Probe of jack '%s' failed.", j->alsa_name);
return -1; return -1;
} }
@ -2644,14 +2644,14 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_boo
PA_LLIST_FOREACH(e, p->elements) { PA_LLIST_FOREACH(e, p->elements) {
if (element_probe(e, m) < 0) { if (element_probe(e, m) < 0) {
p->supported = FALSE; p->supported = false;
pa_log_debug("Probe of element '%s' failed.", e->alsa_name); pa_log_debug("Probe of element '%s' failed.", e->alsa_name);
return -1; return -1;
} }
pa_log_debug("Probe of element '%s' succeeded (volume=%d, switch=%d, enumeration=%d).", e->alsa_name, e->volume_use, e->switch_use, e->enumeration_use); pa_log_debug("Probe of element '%s' succeeded (volume=%d, switch=%d, enumeration=%d).", e->alsa_name, e->volume_use, e->switch_use, e->enumeration_use);
if (ignore_dB) if (ignore_dB)
e->has_dB = FALSE; e->has_dB = false;
if (e->volume_use == PA_ALSA_VOLUME_MERGE) { if (e->volume_use == PA_ALSA_VOLUME_MERGE) {
@ -2669,7 +2669,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_boo
path_volume_channels |= PA_CHANNEL_POSITION_MASK(t); path_volume_channels |= PA_CHANNEL_POSITION_MASK(t);
} }
p->has_dB = TRUE; p->has_dB = true;
} else { } else {
if (p->has_dB) { if (p->has_dB) {
@ -2692,15 +2692,15 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_boo
e->volume_use = PA_ALSA_VOLUME_IGNORE; e->volume_use = PA_ALSA_VOLUME_IGNORE;
pa_log_info("Ignoring volume of '%s' on path '%s' (missing dB info)", e->alsa_name, p->name); pa_log_info("Ignoring volume of '%s' on path '%s' (missing dB info)", e->alsa_name, p->name);
} }
p->has_volume = TRUE; p->has_volume = true;
} }
if (e->switch_use == PA_ALSA_SWITCH_MUTE) if (e->switch_use == PA_ALSA_SWITCH_MUTE)
p->has_mute = TRUE; p->has_mute = true;
} }
if (p->has_req_any && !p->req_any_present) { if (p->has_req_any && !p->req_any_present) {
p->supported = FALSE; p->supported = false;
pa_log_debug("Skipping path '%s', none of required-any elements preset.", p->name); pa_log_debug("Skipping path '%s', none of required-any elements preset.", p->name);
return -1; return -1;
} }
@ -2709,7 +2709,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_boo
path_make_options_unique(p); path_make_options_unique(p);
path_create_settings(p); path_create_settings(p);
p->supported = TRUE; p->supported = true;
p->min_dB = INFINITY; p->min_dB = INFINITY;
p->max_dB = -INFINITY; p->max_dB = -INFINITY;
@ -2904,12 +2904,12 @@ pa_alsa_path_set *pa_alsa_path_set_new(pa_alsa_mapping *m, pa_alsa_direction_t d
for (in = pn; *in; in++) { for (in = pn; *in; in++) {
pa_alsa_path *p = NULL; pa_alsa_path *p = NULL;
pa_bool_t duplicate = FALSE; bool duplicate = false;
char **kn; char **kn;
for (kn = pn; kn < in; kn++) for (kn = pn; kn < in; kn++)
if (pa_streq(*kn, *in)) { if (pa_streq(*kn, *in)) {
duplicate = TRUE; duplicate = true;
break; break;
} }
@ -3018,7 +3018,7 @@ void pa_alsa_path_set_dump(pa_alsa_path_set *ps) {
pa_alsa_path_dump(p); pa_alsa_path_dump(p);
} }
static pa_bool_t options_have_option(pa_alsa_option *options, const char *alsa_name) { static bool options_have_option(pa_alsa_option *options, const char *alsa_name) {
pa_alsa_option *o; pa_alsa_option *o;
pa_assert(options); pa_assert(options);
@ -3026,36 +3026,36 @@ static pa_bool_t options_have_option(pa_alsa_option *options, const char *alsa_n
PA_LLIST_FOREACH(o, options) { PA_LLIST_FOREACH(o, options) {
if (pa_streq(o->alsa_name, alsa_name)) if (pa_streq(o->alsa_name, alsa_name))
return TRUE; return true;
} }
return FALSE; return false;
} }
static pa_bool_t enumeration_is_subset(pa_alsa_option *a_options, pa_alsa_option *b_options) { static bool enumeration_is_subset(pa_alsa_option *a_options, pa_alsa_option *b_options) {
pa_alsa_option *oa, *ob; pa_alsa_option *oa, *ob;
if (!a_options) return TRUE; if (!a_options) return true;
if (!b_options) return FALSE; if (!b_options) return false;
/* If there is an option A offers that B does not, then A is not a subset of B. */ /* If there is an option A offers that B does not, then A is not a subset of B. */
PA_LLIST_FOREACH(oa, a_options) { PA_LLIST_FOREACH(oa, a_options) {
pa_bool_t found = FALSE; bool found = false;
PA_LLIST_FOREACH(ob, b_options) { PA_LLIST_FOREACH(ob, b_options) {
if (pa_streq(oa->alsa_name, ob->alsa_name)) { if (pa_streq(oa->alsa_name, ob->alsa_name)) {
found = TRUE; found = true;
break; break;
} }
} }
if (!found) if (!found)
return FALSE; return false;
} }
return TRUE; return true;
} }
/** /**
* Compares two elements to see if a is a subset of b * Compares two elements to see if a is a subset of b
*/ */
static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_mixer_t *m) { static bool element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_mixer_t *m) {
pa_assert(a); pa_assert(a);
pa_assert(b); pa_assert(b);
pa_assert(m); pa_assert(m);
@ -3069,11 +3069,11 @@ static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_m
/* "Constant" is subset of "Constant" only when their constant values are equal */ /* "Constant" is subset of "Constant" only when their constant values are equal */
if (a->volume_use == PA_ALSA_VOLUME_CONSTANT && b->volume_use == PA_ALSA_VOLUME_CONSTANT && a->constant_volume != b->constant_volume) if (a->volume_use == PA_ALSA_VOLUME_CONSTANT && b->volume_use == PA_ALSA_VOLUME_CONSTANT && a->constant_volume != b->constant_volume)
return FALSE; return false;
/* Different volume uses when b is not "Merge" means we are definitely not a subset */ /* Different volume uses when b is not "Merge" means we are definitely not a subset */
if (a->volume_use != b->volume_use && b->volume_use != PA_ALSA_VOLUME_MERGE) if (a->volume_use != b->volume_use && b->volume_use != PA_ALSA_VOLUME_MERGE)
return FALSE; return false;
/* "Constant" is a subset of "Merge", if there is not a "volume-limit" in "Merge" below the actual constant. /* "Constant" is a subset of "Merge", if there is not a "volume-limit" in "Merge" below the actual constant.
* "Zero" and "Off" are just special cases of "Constant" when comparing to "Merge" * "Zero" and "Off" are just special cases of "Constant" when comparing to "Merge"
@ -3096,15 +3096,15 @@ static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_m
SELEM_INIT(sid, a->alsa_name); SELEM_INIT(sid, a->alsa_name);
if (!(me = snd_mixer_find_selem(m, sid))) { if (!(me = snd_mixer_find_selem(m, sid))) {
pa_log_warn("Element %s seems to have disappeared.", a->alsa_name); pa_log_warn("Element %s seems to have disappeared.", a->alsa_name);
return FALSE; return false;
} }
if (a->direction == PA_ALSA_DIRECTION_OUTPUT) { if (a->direction == PA_ALSA_DIRECTION_OUTPUT) {
if (snd_mixer_selem_ask_playback_dB_vol(me, dB, +1, &a_limit) < 0) if (snd_mixer_selem_ask_playback_dB_vol(me, dB, +1, &a_limit) < 0)
return FALSE; return false;
} else { } else {
if (snd_mixer_selem_ask_capture_dB_vol(me, dB, -1, &a_limit) < 0) if (snd_mixer_selem_ask_capture_dB_vol(me, dB, -1, &a_limit) < 0)
return FALSE; return false;
} }
} }
} else if (a->volume_use == PA_ALSA_VOLUME_OFF) } else if (a->volume_use == PA_ALSA_VOLUME_OFF)
@ -3113,22 +3113,22 @@ static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_m
a_limit = a->volume_limit; a_limit = a->volume_limit;
else else
/* This should never be reached */ /* This should never be reached */
pa_assert(FALSE); pa_assert(false);
if (a_limit > b->volume_limit) if (a_limit > b->volume_limit)
return FALSE; return false;
} }
if (a->volume_use == PA_ALSA_VOLUME_MERGE) { if (a->volume_use == PA_ALSA_VOLUME_MERGE) {
int s; int s;
/* If override-maps are different, they're not subsets */ /* If override-maps are different, they're not subsets */
if (a->n_channels != b->n_channels) if (a->n_channels != b->n_channels)
return FALSE; return false;
for (s = 0; s <= SND_MIXER_SCHN_LAST; s++) for (s = 0; s <= SND_MIXER_SCHN_LAST; s++)
if (a->masks[s][a->n_channels-1] != b->masks[s][b->n_channels-1]) { if (a->masks[s][a->n_channels-1] != b->masks[s][b->n_channels-1]) {
pa_log_debug("Element %s is not a subset - mask a: 0x%" PRIx64 ", mask b: 0x%" PRIx64 ", at channel %d", pa_log_debug("Element %s is not a subset - mask a: 0x%" PRIx64 ", mask b: 0x%" PRIx64 ", at channel %d",
a->alsa_name, a->masks[s][a->n_channels-1], b->masks[s][b->n_channels-1], s); a->alsa_name, a->masks[s][a->n_channels-1], b->masks[s][b->n_channels-1], s);
return FALSE; return false;
} }
} }
} }
@ -3144,31 +3144,31 @@ static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_m
if (a->switch_use == PA_ALSA_SWITCH_SELECT || a->switch_use == PA_ALSA_SWITCH_MUTE if (a->switch_use == PA_ALSA_SWITCH_SELECT || a->switch_use == PA_ALSA_SWITCH_MUTE
|| b->switch_use == PA_ALSA_SWITCH_OFF || b->switch_use == PA_ALSA_SWITCH_ON) || b->switch_use == PA_ALSA_SWITCH_OFF || b->switch_use == PA_ALSA_SWITCH_ON)
return FALSE; return false;
if (b->switch_use == PA_ALSA_SWITCH_SELECT) { if (b->switch_use == PA_ALSA_SWITCH_SELECT) {
if (a->switch_use == PA_ALSA_SWITCH_ON) { if (a->switch_use == PA_ALSA_SWITCH_ON) {
if (!options_have_option(b->options, "on")) if (!options_have_option(b->options, "on"))
return FALSE; return false;
} else if (a->switch_use == PA_ALSA_SWITCH_OFF) { } else if (a->switch_use == PA_ALSA_SWITCH_OFF) {
if (!options_have_option(b->options, "off")) if (!options_have_option(b->options, "off"))
return FALSE; return false;
} }
} }
} else if (a->switch_use == PA_ALSA_SWITCH_SELECT) { } else if (a->switch_use == PA_ALSA_SWITCH_SELECT) {
if (!enumeration_is_subset(a->options, b->options)) if (!enumeration_is_subset(a->options, b->options))
return FALSE; return false;
} }
} }
if (a->enumeration_use != PA_ALSA_ENUMERATION_IGNORE) { if (a->enumeration_use != PA_ALSA_ENUMERATION_IGNORE) {
if (b->enumeration_use == PA_ALSA_ENUMERATION_IGNORE) if (b->enumeration_use == PA_ALSA_ENUMERATION_IGNORE)
return FALSE; return false;
if (!enumeration_is_subset(a->options, b->options)) if (!enumeration_is_subset(a->options, b->options))
return FALSE; return false;
} }
return TRUE; return true;
} }
static void path_set_condense(pa_alsa_path_set *ps, snd_mixer_t *m) { static void path_set_condense(pa_alsa_path_set *ps, snd_mixer_t *m) {
@ -3966,11 +3966,11 @@ static int profile_verify(pa_alsa_profile *p) {
for (name = p->output_mapping_names; *name; name++) { for (name = p->output_mapping_names; *name; name++) {
pa_alsa_mapping *m; pa_alsa_mapping *m;
char **in; char **in;
pa_bool_t duplicate = FALSE; bool duplicate = false;
for (in = name + 1; *in; in++) for (in = name + 1; *in; in++)
if (pa_streq(*name, *in)) { if (pa_streq(*name, *in)) {
duplicate = TRUE; duplicate = true;
break; break;
} }
@ -4002,11 +4002,11 @@ static int profile_verify(pa_alsa_profile *p) {
for (name = p->input_mapping_names; *name; name++) { for (name = p->input_mapping_names; *name; name++) {
pa_alsa_mapping *m; pa_alsa_mapping *m;
char **in; char **in;
pa_bool_t duplicate = FALSE; bool duplicate = false;
for (in = name + 1; *in; in++) for (in = name + 1; *in; in++)
if (pa_streq(*name, *in)) { if (pa_streq(*name, *in)) {
duplicate = TRUE; duplicate = true;
break; break;
} }
@ -4277,7 +4277,7 @@ static snd_pcm_t* mapping_open_pcm(pa_alsa_mapping *m,
return pa_alsa_open_by_template( return pa_alsa_open_by_template(
m->device_strings, dev_id, NULL, &try_ss, m->device_strings, dev_id, NULL, &try_ss,
&try_map, mode, &try_period_size, &try_map, mode, &try_period_size,
&try_buffer_size, 0, NULL, NULL, TRUE); &try_buffer_size, 0, NULL, NULL, true);
} }
static void paths_drop_unsupported(pa_hashmap* h) { static void paths_drop_unsupported(pa_hashmap* h) {
@ -4326,13 +4326,13 @@ void pa_alsa_profile_set_probe(
if (!p->supported) { if (!p->supported) {
profile_finalize_probing(last, p); profile_finalize_probing(last, p);
p->supported = TRUE; p->supported = true;
if (p->output_mappings) { if (p->output_mappings) {
PA_IDXSET_FOREACH(m, p->output_mappings, idx) { PA_IDXSET_FOREACH(m, p->output_mappings, idx) {
if (pa_hashmap_get(broken_outputs, m) == m) { if (pa_hashmap_get(broken_outputs, m) == m) {
pa_log_debug("Skipping profile %s - will not be able to open output:%s", p->name, m->name); pa_log_debug("Skipping profile %s - will not be able to open output:%s", p->name, m->name);
p->supported = FALSE; p->supported = false;
break; break;
} }
} }
@ -4342,7 +4342,7 @@ void pa_alsa_profile_set_probe(
PA_IDXSET_FOREACH(m, p->input_mappings, idx) { PA_IDXSET_FOREACH(m, p->input_mappings, idx) {
if (pa_hashmap_get(broken_inputs, m) == m) { if (pa_hashmap_get(broken_inputs, m) == m) {
pa_log_debug("Skipping profile %s - will not be able to open input:%s", p->name, m->name); pa_log_debug("Skipping profile %s - will not be able to open input:%s", p->name, m->name);
p->supported = FALSE; p->supported = false;
break; break;
} }
} }
@ -4363,7 +4363,7 @@ void pa_alsa_profile_set_probe(
SND_PCM_STREAM_PLAYBACK, SND_PCM_STREAM_PLAYBACK,
default_n_fragments, default_n_fragments,
default_fragment_size_msec))) { default_fragment_size_msec))) {
p->supported = FALSE; p->supported = false;
if (pa_idxset_size(p->output_mappings) == 1 && if (pa_idxset_size(p->output_mappings) == 1 &&
((!p->input_mappings) || pa_idxset_size(p->input_mappings) == 0)) { ((!p->input_mappings) || pa_idxset_size(p->input_mappings) == 0)) {
pa_log_debug("Caching failure to open output:%s", m->name); pa_log_debug("Caching failure to open output:%s", m->name);
@ -4384,7 +4384,7 @@ void pa_alsa_profile_set_probe(
SND_PCM_STREAM_CAPTURE, SND_PCM_STREAM_CAPTURE,
default_n_fragments, default_n_fragments,
default_fragment_size_msec))) { default_fragment_size_msec))) {
p->supported = FALSE; p->supported = false;
if (pa_idxset_size(p->input_mappings) == 1 && if (pa_idxset_size(p->input_mappings) == 1 &&
((!p->output_mappings) || pa_idxset_size(p->output_mappings) == 0)) { ((!p->output_mappings) || pa_idxset_size(p->output_mappings) == 0)) {
pa_log_debug("Caching failure to open input:%s", m->name); pa_log_debug("Caching failure to open input:%s", m->name);
@ -4423,7 +4423,7 @@ void pa_alsa_profile_set_probe(
pa_hashmap_free(broken_inputs, NULL); pa_hashmap_free(broken_inputs, NULL);
pa_hashmap_free(broken_outputs, NULL); pa_hashmap_free(broken_outputs, NULL);
ps->probed = TRUE; ps->probed = true;
} }
void pa_alsa_profile_set_dump(pa_alsa_profile_set *ps) { void pa_alsa_profile_set_dump(pa_alsa_profile_set *ps) {

View file

@ -138,10 +138,10 @@ struct pa_alsa_element {
long constant_volume; long constant_volume;
pa_bool_t override_map:1; bool override_map:1;
pa_bool_t direction_try_other:1; bool direction_try_other:1;
pa_bool_t has_dB:1; bool has_dB:1;
long min_volume, max_volume; long min_volume, max_volume;
long volume_limit; /* -1 for no configured limit */ long volume_limit; /* -1 for no configured limit */
double min_dB, max_dB; double min_dB, max_dB;
@ -162,8 +162,8 @@ struct pa_alsa_jack {
char *name; /* E g "Headphone" */ char *name; /* E g "Headphone" */
char *alsa_name; /* E g "Headphone Jack" */ char *alsa_name; /* E g "Headphone Jack" */
pa_bool_t has_control; /* is the jack itself present? */ bool has_control; /* is the jack itself present? */
pa_bool_t plugged_in; /* is this jack currently plugged in? */ bool plugged_in; /* is this jack currently plugged in? */
snd_hctl_elem_t *hctl_elem; /* Jack detection handle */ snd_hctl_elem_t *hctl_elem; /* Jack detection handle */
pa_available_t state_unplugged, state_plugged; pa_available_t state_unplugged, state_plugged;
@ -186,15 +186,15 @@ struct pa_alsa_path {
int eld_device; int eld_device;
pa_proplist *proplist; pa_proplist *proplist;
pa_bool_t probed:1; bool probed:1;
pa_bool_t supported:1; bool supported:1;
pa_bool_t has_mute:1; bool has_mute:1;
pa_bool_t has_volume:1; bool has_volume:1;
pa_bool_t has_dB:1; bool has_dB:1;
bool mute_during_activation:1; bool mute_during_activation:1;
/* These two are used during probing only */ /* These two are used during probing only */
pa_bool_t has_req_any:1; bool has_req_any:1;
pa_bool_t req_any_present:1; bool req_any_present:1;
long min_volume, max_volume; long min_volume, max_volume;
double min_dB, max_dB; double min_dB, max_dB;
@ -226,12 +226,12 @@ void pa_alsa_element_dump(pa_alsa_element *e);
pa_alsa_path *pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa_direction_t direction); pa_alsa_path *pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa_direction_t direction);
pa_alsa_path *pa_alsa_path_synthesize(const char *element, pa_alsa_direction_t direction); pa_alsa_path *pa_alsa_path_synthesize(const char *element, pa_alsa_direction_t direction);
int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_bool_t ignore_dB); int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, bool ignore_dB);
void pa_alsa_path_dump(pa_alsa_path *p); void pa_alsa_path_dump(pa_alsa_path *p);
int pa_alsa_path_get_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v); int pa_alsa_path_get_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v);
int pa_alsa_path_get_mute(pa_alsa_path *path, snd_mixer_t *m, pa_bool_t *muted); int pa_alsa_path_get_mute(pa_alsa_path *path, snd_mixer_t *m, bool *muted);
int pa_alsa_path_set_volume(pa_alsa_path *path, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t deferred_volume, pa_bool_t write_to_hw); int pa_alsa_path_set_volume(pa_alsa_path *path, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, bool deferred_volume, bool write_to_hw);
int pa_alsa_path_set_mute(pa_alsa_path *path, snd_mixer_t *m, pa_bool_t muted); int pa_alsa_path_set_mute(pa_alsa_path *path, snd_mixer_t *m, bool muted);
int pa_alsa_path_select(pa_alsa_path *p, pa_alsa_setting *s, snd_mixer_t *m, bool device_is_muted); int pa_alsa_path_select(pa_alsa_path *p, pa_alsa_setting *s, snd_mixer_t *m, bool device_is_muted);
void pa_alsa_path_set_callback(pa_alsa_path *p, snd_mixer_t *m, snd_mixer_elem_callback_t cb, void *userdata); void pa_alsa_path_set_callback(pa_alsa_path *p, snd_mixer_t *m, snd_mixer_elem_callback_t cb, void *userdata);
void pa_alsa_path_free(pa_alsa_path *p); void pa_alsa_path_free(pa_alsa_path *p);
@ -282,7 +282,7 @@ struct pa_alsa_profile {
char *description; char *description;
unsigned priority; unsigned priority;
pa_bool_t supported:1; bool supported:1;
char **input_mapping_names; char **input_mapping_names;
char **output_mapping_names; char **output_mapping_names;
@ -314,9 +314,9 @@ struct pa_alsa_profile_set {
pa_hashmap *input_paths; pa_hashmap *input_paths;
pa_hashmap *output_paths; pa_hashmap *output_paths;
pa_bool_t auto_profiles; bool auto_profiles;
pa_bool_t ignore_dB:1; bool ignore_dB:1;
pa_bool_t probed:1; bool probed:1;
}; };
void pa_alsa_mapping_dump(pa_alsa_mapping *m); void pa_alsa_mapping_dump(pa_alsa_mapping *m);

View file

@ -136,9 +136,9 @@ struct userdata {
char *device_name; /* name of the PCM device */ char *device_name; /* name of the PCM device */
char *control_device; /* name of the control device */ char *control_device; /* name of the control device */
pa_bool_t use_mmap:1, use_tsched:1, deferred_volume:1, fixed_latency_range:1; bool use_mmap:1, use_tsched:1, deferred_volume:1, fixed_latency_range:1;
pa_bool_t first, after_rewind; bool first, after_rewind;
pa_rtpoll_item *alsa_rtpoll_item; pa_rtpoll_item *alsa_rtpoll_item;
@ -162,11 +162,11 @@ struct userdata {
static void userdata_free(struct userdata *u); static void userdata_free(struct userdata *u);
/* FIXME: Is there a better way to do this than device names? */ /* FIXME: Is there a better way to do this than device names? */
static pa_bool_t is_iec958(struct userdata *u) { static bool is_iec958(struct userdata *u) {
return (strncmp("iec958", u->device_name, 6) == 0); return (strncmp("iec958", u->device_name, 6) == 0);
} }
static pa_bool_t is_hdmi(struct userdata *u) { static bool is_hdmi(struct userdata *u) {
return (strncmp("hdmi", u->device_name, 4) == 0); return (strncmp("hdmi", u->device_name, 4) == 0);
} }
@ -176,7 +176,7 @@ static pa_hook_result_t reserve_cb(pa_reserve_wrapper *r, void *forced, struct u
pa_log_debug("Suspending sink %s, because another application requested us to release the device.", u->sink->name); pa_log_debug("Suspending sink %s, because another application requested us to release the device.", u->sink->name);
if (pa_sink_suspend(u->sink, TRUE, PA_SUSPEND_APPLICATION) < 0) if (pa_sink_suspend(u->sink, true, PA_SUSPEND_APPLICATION) < 0)
return PA_HOOK_CANCEL; return PA_HOOK_CANCEL;
return PA_HOOK_OK; return PA_HOOK_OK;
@ -445,14 +445,14 @@ static int try_recover(struct userdata *u, const char *call, int err) {
return -1; return -1;
} }
u->first = TRUE; u->first = true;
u->since_start = 0; u->since_start = 0;
return 0; return 0;
} }
static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t on_timeout) { static size_t check_left_to_play(struct userdata *u, size_t n_bytes, bool on_timeout) {
size_t left_to_play; size_t left_to_play;
pa_bool_t underrun = FALSE; bool underrun = false;
/* We use <= instead of < for this check here because an underrun /* We use <= instead of < for this check here because an underrun
* only happens after the last sample was processed, not already when * only happens after the last sample was processed, not already when
@ -465,7 +465,7 @@ static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t o
/* We got a dropout. What a mess! */ /* We got a dropout. What a mess! */
left_to_play = 0; left_to_play = 0;
underrun = TRUE; underrun = true;
#if 0 #if 0
PA_DEBUG_TRAP; PA_DEBUG_TRAP;
@ -484,13 +484,13 @@ static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t o
#endif #endif
if (u->use_tsched) { if (u->use_tsched) {
pa_bool_t reset_not_before = TRUE; bool reset_not_before = true;
if (!u->first && !u->after_rewind) { if (!u->first && !u->after_rewind) {
if (underrun || left_to_play < u->watermark_inc_threshold) if (underrun || left_to_play < u->watermark_inc_threshold)
increase_watermark(u); increase_watermark(u);
else if (left_to_play > u->watermark_dec_threshold) { else if (left_to_play > u->watermark_dec_threshold) {
reset_not_before = FALSE; reset_not_before = false;
/* We decrease the watermark only if have actually /* We decrease the watermark only if have actually
* been woken up by a timeout. If something else woke * been woken up by a timeout. If something else woke
@ -508,8 +508,8 @@ static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t o
return left_to_play; return left_to_play;
} }
static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled, pa_bool_t on_timeout) { static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bool on_timeout) {
pa_bool_t work_done = FALSE; bool work_done = false;
pa_usec_t max_sleep_usec = 0, process_usec = 0; pa_usec_t max_sleep_usec = 0, process_usec = 0;
size_t left_to_play, input_underrun; size_t left_to_play, input_underrun;
unsigned j = 0; unsigned j = 0;
@ -524,7 +524,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
snd_pcm_sframes_t n; snd_pcm_sframes_t n;
size_t n_bytes; size_t n_bytes;
int r; int r;
pa_bool_t after_avail = TRUE; bool after_avail = true;
/* First we determine how many samples are missing to fill the /* First we determine how many samples are missing to fill the
* buffer up to 100% */ * buffer up to 100% */
@ -544,7 +544,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
#endif #endif
left_to_play = check_left_to_play(u, n_bytes, on_timeout); left_to_play = check_left_to_play(u, n_bytes, on_timeout);
on_timeout = FALSE; on_timeout = false;
if (u->use_tsched) if (u->use_tsched)
@ -589,7 +589,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
} }
n_bytes -= u->hwbuf_unused; n_bytes -= u->hwbuf_unused;
polled = FALSE; polled = false;
#ifdef DEBUG_TIMING #ifdef DEBUG_TIMING
pa_log_debug("Filling up"); pa_log_debug("Filling up");
@ -626,7 +626,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
break; break;
pa_assert(frames > 0); pa_assert(frames > 0);
after_avail = FALSE; after_avail = false;
/* Check these are multiples of 8 bit */ /* Check these are multiples of 8 bit */
pa_assert((areas[0].first & 7) == 0); pa_assert((areas[0].first & 7) == 0);
@ -639,7 +639,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
p = (uint8_t*) areas[0].addr + (offset * u->frame_size); p = (uint8_t*) areas[0].addr + (offset * u->frame_size);
written = frames * u->frame_size; written = frames * u->frame_size;
chunk.memblock = pa_memblock_new_fixed(u->core->mempool, p, written, TRUE); chunk.memblock = pa_memblock_new_fixed(u->core->mempool, p, written, true);
chunk.length = pa_memblock_get_length(chunk.memblock); chunk.length = pa_memblock_get_length(chunk.memblock);
chunk.index = 0; chunk.index = 0;
@ -657,7 +657,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
return r; return r;
} }
work_done = TRUE; work_done = true;
u->write_count += written; u->write_count += written;
u->since_start += written; u->since_start += written;
@ -693,8 +693,8 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
return work_done ? 1 : 0; return work_done ? 1 : 0;
} }
static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled, pa_bool_t on_timeout) { static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bool on_timeout) {
pa_bool_t work_done = FALSE; bool work_done = false;
pa_usec_t max_sleep_usec = 0, process_usec = 0; pa_usec_t max_sleep_usec = 0, process_usec = 0;
size_t left_to_play, input_underrun; size_t left_to_play, input_underrun;
unsigned j = 0; unsigned j = 0;
@ -709,7 +709,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
snd_pcm_sframes_t n; snd_pcm_sframes_t n;
size_t n_bytes; size_t n_bytes;
int r; int r;
pa_bool_t after_avail = TRUE; bool after_avail = true;
if (PA_UNLIKELY((n = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->sink->sample_spec)) < 0)) { if (PA_UNLIKELY((n = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->sink->sample_spec)) < 0)) {
@ -726,7 +726,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
#endif #endif
left_to_play = check_left_to_play(u, n_bytes, on_timeout); left_to_play = check_left_to_play(u, n_bytes, on_timeout);
on_timeout = FALSE; on_timeout = false;
if (u->use_tsched) if (u->use_tsched)
@ -764,7 +764,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
} }
n_bytes -= u->hwbuf_unused; n_bytes -= u->hwbuf_unused;
polled = FALSE; polled = false;
for (;;) { for (;;) {
snd_pcm_sframes_t frames; snd_pcm_sframes_t frames;
@ -802,7 +802,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
break; break;
pa_assert(frames > 0); pa_assert(frames > 0);
after_avail = FALSE; after_avail = false;
written = frames * u->frame_size; written = frames * u->frame_size;
u->memchunk.index += written; u->memchunk.index += written;
@ -813,7 +813,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
pa_memchunk_reset(&u->memchunk); pa_memchunk_reset(&u->memchunk);
} }
work_done = TRUE; work_done = true;
u->write_count += written; u->write_count += written;
u->since_start += written; u->since_start += written;
@ -862,7 +862,7 @@ static void update_smoother(struct userdata *u) {
/* Let's update the time smoother */ /* Let's update the time smoother */
if (PA_UNLIKELY((err = pa_alsa_safe_delay(u->pcm_handle, status, &delay, u->hwbuf_size, &u->sink->sample_spec, FALSE)) < 0)) { if (PA_UNLIKELY((err = pa_alsa_safe_delay(u->pcm_handle, status, &delay, u->hwbuf_size, &u->sink->sample_spec, false)) < 0)) {
pa_log_warn("Failed to query DSP status data: %s", pa_alsa_strerror(err)); pa_log_warn("Failed to query DSP status data: %s", pa_alsa_strerror(err));
return; return;
} }
@ -1020,7 +1020,7 @@ static int update_sw_params(struct userdata *u) {
/* Called from IO Context on unsuspend or from main thread when creating sink */ /* Called from IO Context on unsuspend or from main thread when creating sink */
static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_sample_spec *ss, static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_sample_spec *ss,
pa_bool_t in_thread) { bool in_thread) {
u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, ss), u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, ss),
&u->sink->sample_spec); &u->sink->sample_spec);
@ -1056,7 +1056,7 @@ static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_samp
static int unsuspend(struct userdata *u) { static int unsuspend(struct userdata *u) {
pa_sample_spec ss; pa_sample_spec ss;
int err; int err;
pa_bool_t b, d; bool b, d;
snd_pcm_uframes_t period_size, buffer_size; snd_pcm_uframes_t period_size, buffer_size;
char *device_name = NULL; char *device_name = NULL;
@ -1088,7 +1088,7 @@ static int unsuspend(struct userdata *u) {
b = u->use_mmap; b = u->use_mmap;
d = u->use_tsched; d = u->use_tsched;
if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &period_size, &buffer_size, 0, &b, &d, TRUE)) < 0) { if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &period_size, &buffer_size, 0, &b, &d, true)) < 0) {
pa_log("Failed to set hardware parameters: %s", pa_alsa_strerror(err)); pa_log("Failed to set hardware parameters: %s", pa_alsa_strerror(err));
goto fail; goto fail;
} }
@ -1118,16 +1118,16 @@ static int unsuspend(struct userdata *u) {
goto fail; goto fail;
u->write_count = 0; u->write_count = 0;
pa_smoother_reset(u->smoother, pa_rtclock_now(), TRUE); pa_smoother_reset(u->smoother, pa_rtclock_now(), true);
u->smoother_interval = SMOOTHER_MIN_INTERVAL; u->smoother_interval = SMOOTHER_MIN_INTERVAL;
u->last_smoother_update = 0; u->last_smoother_update = 0;
u->first = TRUE; u->first = true;
u->since_start = 0; u->since_start = 0;
/* reset the watermark to the value defined when sink was created */ /* reset the watermark to the value defined when sink was created */
if (u->use_tsched) if (u->use_tsched)
reset_watermark(u, u->tsched_watermark_ref, &u->sink->sample_spec, TRUE); reset_watermark(u, u->tsched_watermark_ref, &u->sink->sample_spec, true);
pa_log_info("Resumed successfully..."); pa_log_info("Resumed successfully...");
@ -1238,13 +1238,13 @@ static int ctl_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
return 0; return 0;
if (u->sink->suspend_cause & PA_SUSPEND_SESSION) { if (u->sink->suspend_cause & PA_SUSPEND_SESSION) {
pa_sink_set_mixer_dirty(u->sink, TRUE); pa_sink_set_mixer_dirty(u->sink, true);
return 0; return 0;
} }
if (mask & SND_CTL_EVENT_MASK_VALUE) { if (mask & SND_CTL_EVENT_MASK_VALUE) {
pa_sink_get_volume(u->sink, TRUE); pa_sink_get_volume(u->sink, true);
pa_sink_get_mute(u->sink, TRUE); pa_sink_get_mute(u->sink, true);
} }
return 0; return 0;
@ -1260,7 +1260,7 @@ static int io_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
return 0; return 0;
if (u->sink->suspend_cause & PA_SUSPEND_SESSION) { if (u->sink->suspend_cause & PA_SUSPEND_SESSION) {
pa_sink_set_mixer_dirty(u->sink, TRUE); pa_sink_set_mixer_dirty(u->sink, true);
return 0; return 0;
} }
@ -1307,7 +1307,7 @@ static void sink_set_volume_cb(pa_sink *s) {
struct userdata *u = s->userdata; struct userdata *u = s->userdata;
pa_cvolume r; pa_cvolume r;
char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX]; char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX];
pa_bool_t deferred_volume = !!(s->flags & PA_SINK_DEFERRED_VOLUME); bool deferred_volume = !!(s->flags & PA_SINK_DEFERRED_VOLUME);
pa_assert(u); pa_assert(u);
pa_assert(u->mixer_path); pa_assert(u->mixer_path);
@ -1326,7 +1326,7 @@ static void sink_set_volume_cb(pa_sink *s) {
if (u->mixer_path->has_dB) { if (u->mixer_path->has_dB) {
pa_cvolume new_soft_volume; pa_cvolume new_soft_volume;
pa_bool_t accurate_enough; bool accurate_enough;
char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX]; char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX];
/* Match exactly what the user requested by software */ /* Match exactly what the user requested by software */
@ -1373,11 +1373,11 @@ static void sink_write_volume_cb(pa_sink *s) {
/* Shift up by the base volume */ /* Shift up by the base volume */
pa_sw_cvolume_divide_scalar(&hw_vol, &hw_vol, s->base_volume); pa_sw_cvolume_divide_scalar(&hw_vol, &hw_vol, s->base_volume);
if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &hw_vol, TRUE, TRUE) < 0) if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &hw_vol, true, true) < 0)
pa_log_error("Writing HW volume failed"); pa_log_error("Writing HW volume failed");
else { else {
pa_cvolume tmp_vol; pa_cvolume tmp_vol;
pa_bool_t accurate_enough; bool accurate_enough;
/* Shift down by the base volume, so that 0dB becomes maximum volume */ /* Shift down by the base volume, so that 0dB becomes maximum volume */
pa_sw_cvolume_multiply_scalar(&hw_vol, &hw_vol, s->base_volume); pa_sw_cvolume_multiply_scalar(&hw_vol, &hw_vol, s->base_volume);
@ -1405,7 +1405,7 @@ static void sink_write_volume_cb(pa_sink *s) {
static void sink_get_mute_cb(pa_sink *s) { static void sink_get_mute_cb(pa_sink *s) {
struct userdata *u = s->userdata; struct userdata *u = s->userdata;
pa_bool_t b; bool b;
pa_assert(u); pa_assert(u);
pa_assert(u->mixer_path); pa_assert(u->mixer_path);
@ -1447,7 +1447,7 @@ static void mixer_volume_init(struct userdata *u) {
pa_sink_set_write_volume_callback(u->sink, NULL); pa_sink_set_write_volume_callback(u->sink, NULL);
if (u->mixer_path->has_dB) { if (u->mixer_path->has_dB) {
pa_sink_enable_decibel_volume(u->sink, TRUE); pa_sink_enable_decibel_volume(u->sink, true);
pa_log_info("Hardware volume ranges from %0.2f dB to %0.2f dB.", u->mixer_path->min_dB, u->mixer_path->max_dB); pa_log_info("Hardware volume ranges from %0.2f dB to %0.2f dB.", u->mixer_path->min_dB, u->mixer_path->max_dB);
u->sink->base_volume = pa_sw_volume_from_dB(-u->mixer_path->max_dB); u->sink->base_volume = pa_sw_volume_from_dB(-u->mixer_path->max_dB);
@ -1455,7 +1455,7 @@ static void mixer_volume_init(struct userdata *u) {
pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(u->sink->base_volume)); pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(u->sink->base_volume));
} else { } else {
pa_sink_enable_decibel_volume(u->sink, FALSE); pa_sink_enable_decibel_volume(u->sink, false);
pa_log_info("Hardware volume ranges from %li to %li.", u->mixer_path->min_volume, u->mixer_path->max_volume); pa_log_info("Hardware volume ranges from %li to %li.", u->mixer_path->min_volume, u->mixer_path->max_volume);
u->sink->base_volume = PA_VOLUME_NORM; u->sink->base_volume = PA_VOLUME_NORM;
@ -1483,7 +1483,7 @@ static int sink_set_port_ucm_cb(pa_sink *s, pa_device_port *p) {
pa_assert(p); pa_assert(p);
pa_assert(u->ucm_context); pa_assert(u->ucm_context);
return pa_alsa_ucm_set_port(u->ucm_context, p, TRUE); return pa_alsa_ucm_set_port(u->ucm_context, p, true);
} }
static int sink_set_port_cb(pa_sink *s, pa_device_port *p) { static int sink_set_port_cb(pa_sink *s, pa_device_port *p) {
@ -1555,7 +1555,7 @@ static pa_idxset* sink_get_formats(pa_sink *s) {
return ret; return ret;
} }
static pa_bool_t sink_set_formats(pa_sink *s, pa_idxset *formats) { static bool sink_set_formats(pa_sink *s, pa_idxset *formats) {
struct userdata *u = s->userdata; struct userdata *u = s->userdata;
pa_format_info *f, *g; pa_format_info *f, *g;
uint32_t idx, n; uint32_t idx, n;
@ -1566,7 +1566,7 @@ static pa_bool_t sink_set_formats(pa_sink *s, pa_idxset *formats) {
PA_IDXSET_FOREACH(f, formats, idx) { PA_IDXSET_FOREACH(f, formats, idx) {
if (is_iec958(u) && f->encoding == PA_ENCODING_EAC3_IEC61937) if (is_iec958(u) && f->encoding == PA_ENCODING_EAC3_IEC61937)
/* EAC3 cannot be sent over over S/PDIF */ /* EAC3 cannot be sent over over S/PDIF */
return FALSE; return false;
} }
pa_idxset_free(u->formats, (pa_free_cb_t) pa_format_info_free); pa_idxset_free(u->formats, (pa_free_cb_t) pa_format_info_free);
@ -1598,35 +1598,35 @@ static pa_bool_t sink_set_formats(pa_sink *s, pa_idxset *formats) {
} }
} }
return TRUE; return true;
} }
static pa_bool_t sink_update_rate_cb(pa_sink *s, uint32_t rate) { static bool sink_update_rate_cb(pa_sink *s, uint32_t rate) {
struct userdata *u = s->userdata; struct userdata *u = s->userdata;
int i; int i;
pa_bool_t supported = FALSE; bool supported = false;
pa_assert(u); pa_assert(u);
for (i = 0; u->rates[i]; i++) { for (i = 0; u->rates[i]; i++) {
if (u->rates[i] == rate) { if (u->rates[i] == rate) {
supported = TRUE; supported = true;
break; break;
} }
} }
if (!supported) { if (!supported) {
pa_log_info("Sink does not support sample rate of %d Hz", rate); pa_log_info("Sink does not support sample rate of %d Hz", rate);
return FALSE; return false;
} }
if (!PA_SINK_IS_OPENED(s->state)) { if (!PA_SINK_IS_OPENED(s->state)) {
pa_log_info("Updating rate for device %s, new rate is %d",u->device_name, rate); pa_log_info("Updating rate for device %s, new rate is %d",u->device_name, rate);
u->sink->sample_spec.rate = rate; u->sink->sample_spec.rate = rate;
return TRUE; return true;
} }
return FALSE; return false;
} }
static int process_rewind(struct userdata *u) { static int process_rewind(struct userdata *u) {
@ -1687,7 +1687,7 @@ static int process_rewind(struct userdata *u) {
pa_log_debug("Rewound %lu bytes.", (unsigned long) rewind_nbytes); pa_log_debug("Rewound %lu bytes.", (unsigned long) rewind_nbytes);
pa_sink_process_rewind(u->sink, rewind_nbytes); pa_sink_process_rewind(u->sink, rewind_nbytes);
u->after_rewind = TRUE; u->after_rewind = true;
return 0; return 0;
} }
} else } else
@ -1727,7 +1727,7 @@ static void thread_func(void *userdata) {
if (PA_SINK_IS_OPENED(u->sink->thread_info.state)) { if (PA_SINK_IS_OPENED(u->sink->thread_info.state)) {
int work_done; int work_done;
pa_usec_t sleep_usec = 0; pa_usec_t sleep_usec = 0;
pa_bool_t on_timeout = pa_rtpoll_timer_elapsed(u->rtpoll); bool on_timeout = pa_rtpoll_timer_elapsed(u->rtpoll);
if (u->use_mmap) if (u->use_mmap)
work_done = mmap_write(u, &sleep_usec, revents & POLLOUT, on_timeout); work_done = mmap_write(u, &sleep_usec, revents & POLLOUT, on_timeout);
@ -1745,9 +1745,9 @@ static void thread_func(void *userdata) {
pa_log_info("Starting playback."); pa_log_info("Starting playback.");
snd_pcm_start(u->pcm_handle); snd_pcm_start(u->pcm_handle);
pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE); pa_smoother_resume(u->smoother, pa_rtclock_now(), true);
u->first = FALSE; u->first = false;
} }
update_smoother(u); update_smoother(u);
@ -1789,7 +1789,7 @@ static void thread_func(void *userdata) {
rtpoll_sleep = PA_MIN(sleep_usec, cusec); rtpoll_sleep = PA_MIN(sleep_usec, cusec);
} }
u->after_rewind = FALSE; u->after_rewind = false;
} }
@ -1812,7 +1812,7 @@ static void thread_func(void *userdata) {
pa_rtpoll_set_timer_disabled(u->rtpoll); pa_rtpoll_set_timer_disabled(u->rtpoll);
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (rtpoll_sleep > 0) { if (rtpoll_sleep > 0) {
@ -1851,7 +1851,7 @@ static void thread_func(void *userdata) {
if (pa_alsa_recover_from_poll(u->pcm_handle, revents) < 0) if (pa_alsa_recover_from_poll(u->pcm_handle, revents) < 0)
goto fail; goto fail;
u->first = TRUE; u->first = true;
u->since_start = 0; u->since_start = 0;
revents = 0; revents = 0;
} else if (revents && u->use_tsched && pa_log_ratelimit(PA_LOG_DEBUG)) } else if (revents && u->use_tsched && pa_log_ratelimit(PA_LOG_DEBUG))
@ -1881,15 +1881,15 @@ static void set_sink_name(pa_sink_new_data *data, pa_modargs *ma, const char *de
if ((n = pa_modargs_get_value(ma, "sink_name", NULL))) { if ((n = pa_modargs_get_value(ma, "sink_name", NULL))) {
pa_sink_new_data_set_name(data, n); pa_sink_new_data_set_name(data, n);
data->namereg_fail = TRUE; data->namereg_fail = true;
return; return;
} }
if ((n = pa_modargs_get_value(ma, "name", NULL))) if ((n = pa_modargs_get_value(ma, "name", NULL)))
data->namereg_fail = TRUE; data->namereg_fail = true;
else { else {
n = device_id ? device_id : device_name; n = device_id ? device_id : device_name;
data->namereg_fail = FALSE; data->namereg_fail = false;
} }
if (mapping) if (mapping)
@ -1901,7 +1901,7 @@ static void set_sink_name(pa_sink_new_data *data, pa_modargs *ma, const char *de
pa_xfree(t); pa_xfree(t);
} }
static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char *element, pa_bool_t ignore_dB) { static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char *element, bool ignore_dB) {
snd_hctl_t *hctl; snd_hctl_t *hctl;
if (!mapping && !element) if (!mapping && !element)
@ -1940,8 +1940,8 @@ fail:
} }
} }
static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { static int setup_mixer(struct userdata *u, bool ignore_dB) {
pa_bool_t need_mixer_callback = FALSE; bool need_mixer_callback = false;
pa_assert(u); pa_assert(u);
@ -1982,7 +1982,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) {
PA_HASHMAP_FOREACH(p, u->mixer_path_set->paths, state) { PA_HASHMAP_FOREACH(p, u->mixer_path_set->paths, state) {
if (p->has_volume || p->has_mute) if (p->has_volume || p->has_mute)
need_mixer_callback = TRUE; need_mixer_callback = true;
} }
} }
else if (u->mixer_path) else if (u->mixer_path)
@ -2028,7 +2028,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark, rewind_safeguard; uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark, rewind_safeguard;
snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames; snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames;
size_t frame_size; size_t frame_size;
pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE, namereg_fail = FALSE, deferred_volume = FALSE, set_formats = FALSE, fixed_latency_range = FALSE; bool use_mmap = true, b, use_tsched = true, d, ignore_dB = false, namereg_fail = false, deferred_volume = false, set_formats = false, fixed_latency_range = false;
pa_sink_new_data data; pa_sink_new_data data;
pa_alsa_profile_set *profile_set = NULL; pa_alsa_profile_set *profile_set = NULL;
void *state = NULL; void *state = NULL;
@ -2113,7 +2113,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
u->use_tsched = use_tsched; u->use_tsched = use_tsched;
u->deferred_volume = deferred_volume; u->deferred_volume = deferred_volume;
u->fixed_latency_range = fixed_latency_range; u->fixed_latency_range = fixed_latency_range;
u->first = TRUE; u->first = true;
u->rewind_safeguard = rewind_safeguard; u->rewind_safeguard = rewind_safeguard;
u->rtpoll = pa_rtpoll_new(); u->rtpoll = pa_rtpoll_new();
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
@ -2121,11 +2121,11 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
u->smoother = pa_smoother_new( u->smoother = pa_smoother_new(
SMOOTHER_ADJUST_USEC, SMOOTHER_ADJUST_USEC,
SMOOTHER_WINDOW_USEC, SMOOTHER_WINDOW_USEC,
TRUE, true,
TRUE, true,
5, 5,
pa_rtclock_now(), pa_rtclock_now(),
TRUE); true);
u->smoother_interval = SMOOTHER_MIN_INTERVAL; u->smoother_interval = SMOOTHER_MIN_INTERVAL;
/* use ucm */ /* use ucm */
@ -2192,7 +2192,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
&ss, &map, &ss, &map,
SND_PCM_STREAM_PLAYBACK, SND_PCM_STREAM_PLAYBACK,
&period_frames, &buffer_frames, tsched_frames, &period_frames, &buffer_frames, tsched_frames,
&b, &d, FALSE))) &b, &d, false)))
goto fail; goto fail;
} }
@ -2209,12 +2209,12 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
if (use_mmap && !b) { if (use_mmap && !b) {
pa_log_info("Device doesn't support mmap(), falling back to UNIX read/write mode."); pa_log_info("Device doesn't support mmap(), falling back to UNIX read/write mode.");
u->use_mmap = use_mmap = FALSE; u->use_mmap = use_mmap = false;
} }
if (use_tsched && (!b || !d)) { if (use_tsched && (!b || !d)) {
pa_log_info("Cannot enable timer-based scheduling, falling back to sound IRQ scheduling."); pa_log_info("Cannot enable timer-based scheduling, falling back to sound IRQ scheduling.");
u->use_tsched = use_tsched = FALSE; u->use_tsched = use_tsched = false;
} }
if (u->use_mmap) if (u->use_mmap)
@ -2228,7 +2228,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
} }
if (is_iec958(u) || is_hdmi(u)) if (is_iec958(u) || is_hdmi(u))
set_formats = TRUE; set_formats = true;
u->rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate); u->rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate);
if (!u->rates) { if (!u->rates) {
@ -2290,7 +2290,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
} }
if (u->ucm_context) if (u->ucm_context)
pa_alsa_ucm_add_ports(&data.ports, data.proplist, u->ucm_context, TRUE, card); pa_alsa_ucm_add_ports(&data.ports, data.proplist, u->ucm_context, true, card);
else if (u->mixer_path_set) else if (u->mixer_path_set)
pa_alsa_add_ports(&data, u->mixer_path_set, card); pa_alsa_add_ports(&data, u->mixer_path_set, card);
@ -2352,7 +2352,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
if (u->use_tsched) { if (u->use_tsched) {
u->tsched_watermark_ref = tsched_watermark; u->tsched_watermark_ref = tsched_watermark;
reset_watermark(u, u->tsched_watermark_ref, &ss, FALSE); reset_watermark(u, u->tsched_watermark_ref, &ss, false);
} else } else
pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(u->hwbuf_size, &ss)); pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(u->hwbuf_size, &ss));
@ -2362,7 +2362,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
goto fail; goto fail;
if (u->ucm_context) { if (u->ucm_context) {
if (u->sink->active_port && pa_alsa_ucm_set_port(u->ucm_context, u->sink->active_port, TRUE) < 0) if (u->sink->active_port && pa_alsa_ucm_set_port(u->ucm_context, u->sink->active_port, true) < 0)
goto fail; goto fail;
} else if (setup_mixer(u, ignore_dB) < 0) } else if (setup_mixer(u, ignore_dB) < 0)
goto fail; goto fail;

View file

@ -123,9 +123,9 @@ struct userdata {
char *device_name; /* name of the PCM device */ char *device_name; /* name of the PCM device */
char *control_device; /* name of the control device */ char *control_device; /* name of the control device */
pa_bool_t use_mmap:1, use_tsched:1, deferred_volume:1, fixed_latency_range:1; bool use_mmap:1, use_tsched:1, deferred_volume:1, fixed_latency_range:1;
pa_bool_t first; bool first;
pa_rtpoll_item *alsa_rtpoll_item; pa_rtpoll_item *alsa_rtpoll_item;
@ -151,7 +151,7 @@ static pa_hook_result_t reserve_cb(pa_reserve_wrapper *r, void *forced, struct u
pa_log_debug("Suspending source %s, because another application requested us to release the device.", u->source->name); pa_log_debug("Suspending source %s, because another application requested us to release the device.", u->source->name);
if (pa_source_suspend(u->source, TRUE, PA_SUSPEND_APPLICATION) < 0) if (pa_source_suspend(u->source, true, PA_SUSPEND_APPLICATION) < 0)
return PA_HOOK_CANCEL; return PA_HOOK_CANCEL;
return PA_HOOK_OK; return PA_HOOK_OK;
@ -420,14 +420,14 @@ static int try_recover(struct userdata *u, const char *call, int err) {
return -1; return -1;
} }
u->first = TRUE; u->first = true;
return 0; return 0;
} }
static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t on_timeout) { static size_t check_left_to_record(struct userdata *u, size_t n_bytes, bool on_timeout) {
size_t left_to_record; size_t left_to_record;
size_t rec_space = u->hwbuf_size - u->hwbuf_unused; size_t rec_space = u->hwbuf_size - u->hwbuf_unused;
pa_bool_t overrun = FALSE; bool overrun = false;
/* We use <= instead of < for this check here because an overrun /* We use <= instead of < for this check here because an overrun
* only happens after the last sample was processed, not already when * only happens after the last sample was processed, not already when
@ -440,7 +440,7 @@ static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t
/* We got a dropout. What a mess! */ /* We got a dropout. What a mess! */
left_to_record = 0; left_to_record = 0;
overrun = TRUE; overrun = true;
#ifdef DEBUG_TIMING #ifdef DEBUG_TIMING
PA_DEBUG_TRAP; PA_DEBUG_TRAP;
@ -455,12 +455,12 @@ static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t
#endif #endif
if (u->use_tsched) { if (u->use_tsched) {
pa_bool_t reset_not_before = TRUE; bool reset_not_before = true;
if (overrun || left_to_record < u->watermark_inc_threshold) if (overrun || left_to_record < u->watermark_inc_threshold)
increase_watermark(u); increase_watermark(u);
else if (left_to_record > u->watermark_dec_threshold) { else if (left_to_record > u->watermark_dec_threshold) {
reset_not_before = FALSE; reset_not_before = false;
/* We decrease the watermark only if have actually /* We decrease the watermark only if have actually
* been woken up by a timeout. If something else woke * been woken up by a timeout. If something else woke
@ -477,8 +477,8 @@ static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t
return left_to_record; return left_to_record;
} }
static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled, pa_bool_t on_timeout) { static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bool on_timeout) {
pa_bool_t work_done = FALSE; bool work_done = false;
pa_usec_t max_sleep_usec = 0, process_usec = 0; pa_usec_t max_sleep_usec = 0, process_usec = 0;
size_t left_to_record; size_t left_to_record;
unsigned j = 0; unsigned j = 0;
@ -493,7 +493,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
snd_pcm_sframes_t n; snd_pcm_sframes_t n;
size_t n_bytes; size_t n_bytes;
int r; int r;
pa_bool_t after_avail = TRUE; bool after_avail = true;
if (PA_UNLIKELY((n = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->source->sample_spec)) < 0)) { if (PA_UNLIKELY((n = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->source->sample_spec)) < 0)) {
@ -510,7 +510,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
#endif #endif
left_to_record = check_left_to_record(u, n_bytes, on_timeout); left_to_record = check_left_to_record(u, n_bytes, on_timeout);
on_timeout = FALSE; on_timeout = false;
if (u->use_tsched) if (u->use_tsched)
if (!polled && if (!polled &&
@ -547,7 +547,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
break; break;
} }
polled = FALSE; polled = false;
#ifdef DEBUG_TIMING #ifdef DEBUG_TIMING
pa_log_debug("Reading"); pa_log_debug("Reading");
@ -583,7 +583,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
break; break;
pa_assert(frames > 0); pa_assert(frames > 0);
after_avail = FALSE; after_avail = false;
/* Check these are multiples of 8 bit */ /* Check these are multiples of 8 bit */
pa_assert((areas[0].first & 7) == 0); pa_assert((areas[0].first & 7) == 0);
@ -595,7 +595,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
p = (uint8_t*) areas[0].addr + (offset * u->frame_size); p = (uint8_t*) areas[0].addr + (offset * u->frame_size);
chunk.memblock = pa_memblock_new_fixed(u->core->mempool, p, frames * u->frame_size, TRUE); chunk.memblock = pa_memblock_new_fixed(u->core->mempool, p, frames * u->frame_size, true);
chunk.length = pa_memblock_get_length(chunk.memblock); chunk.length = pa_memblock_get_length(chunk.memblock);
chunk.index = 0; chunk.index = 0;
@ -610,7 +610,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
return r; return r;
} }
work_done = TRUE; work_done = true;
u->read_count += frames * u->frame_size; u->read_count += frames * u->frame_size;
@ -638,8 +638,8 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
return work_done ? 1 : 0; return work_done ? 1 : 0;
} }
static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled, pa_bool_t on_timeout) { static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bool on_timeout) {
int work_done = FALSE; int work_done = false;
pa_usec_t max_sleep_usec = 0, process_usec = 0; pa_usec_t max_sleep_usec = 0, process_usec = 0;
size_t left_to_record; size_t left_to_record;
unsigned j = 0; unsigned j = 0;
@ -654,7 +654,7 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
snd_pcm_sframes_t n; snd_pcm_sframes_t n;
size_t n_bytes; size_t n_bytes;
int r; int r;
pa_bool_t after_avail = TRUE; bool after_avail = true;
if (PA_UNLIKELY((n = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->source->sample_spec)) < 0)) { if (PA_UNLIKELY((n = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->source->sample_spec)) < 0)) {
@ -666,7 +666,7 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
n_bytes = (size_t) n * u->frame_size; n_bytes = (size_t) n * u->frame_size;
left_to_record = check_left_to_record(u, n_bytes, on_timeout); left_to_record = check_left_to_record(u, n_bytes, on_timeout);
on_timeout = FALSE; on_timeout = false;
if (u->use_tsched) if (u->use_tsched)
if (!polled && if (!polled &&
@ -696,7 +696,7 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
break; break;
} }
polled = FALSE; polled = false;
for (;;) { for (;;) {
void *p; void *p;
@ -734,7 +734,7 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
} }
pa_assert(frames > 0); pa_assert(frames > 0);
after_avail = FALSE; after_avail = false;
chunk.index = 0; chunk.index = 0;
chunk.length = (size_t) frames * u->frame_size; chunk.length = (size_t) frames * u->frame_size;
@ -742,7 +742,7 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
pa_source_post(u->source, &chunk); pa_source_post(u->source, &chunk);
pa_memblock_unref(chunk.memblock); pa_memblock_unref(chunk.memblock);
work_done = TRUE; work_done = true;
u->read_count += frames * u->frame_size; u->read_count += frames * u->frame_size;
@ -783,7 +783,7 @@ static void update_smoother(struct userdata *u) {
/* Let's update the time smoother */ /* Let's update the time smoother */
if (PA_UNLIKELY((err = pa_alsa_safe_delay(u->pcm_handle, status, &delay, u->hwbuf_size, &u->source->sample_spec, TRUE)) < 0)) { if (PA_UNLIKELY((err = pa_alsa_safe_delay(u->pcm_handle, status, &delay, u->hwbuf_size, &u->source->sample_spec, true)) < 0)) {
pa_log_warn("Failed to get delay: %s", pa_alsa_strerror(err)); pa_log_warn("Failed to get delay: %s", pa_alsa_strerror(err));
return; return;
} }
@ -913,7 +913,7 @@ static int update_sw_params(struct userdata *u) {
/* Called from IO Context on unsuspend or from main thread when creating source */ /* Called from IO Context on unsuspend or from main thread when creating source */
static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_sample_spec *ss, static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_sample_spec *ss,
pa_bool_t in_thread) { bool in_thread) {
u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, ss), u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, ss),
&u->source->sample_spec); &u->source->sample_spec);
@ -949,7 +949,7 @@ static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_samp
static int unsuspend(struct userdata *u) { static int unsuspend(struct userdata *u) {
pa_sample_spec ss; pa_sample_spec ss;
int err; int err;
pa_bool_t b, d; bool b, d;
snd_pcm_uframes_t period_size, buffer_size; snd_pcm_uframes_t period_size, buffer_size;
pa_assert(u); pa_assert(u);
@ -972,7 +972,7 @@ static int unsuspend(struct userdata *u) {
b = u->use_mmap; b = u->use_mmap;
d = u->use_tsched; d = u->use_tsched;
if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &period_size, &buffer_size, 0, &b, &d, TRUE)) < 0) { if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &period_size, &buffer_size, 0, &b, &d, true)) < 0) {
pa_log("Failed to set hardware parameters: %s", pa_alsa_strerror(err)); pa_log("Failed to set hardware parameters: %s", pa_alsa_strerror(err));
goto fail; goto fail;
} }
@ -1004,15 +1004,15 @@ static int unsuspend(struct userdata *u) {
/* FIXME: We need to reload the volume somehow */ /* FIXME: We need to reload the volume somehow */
u->read_count = 0; u->read_count = 0;
pa_smoother_reset(u->smoother, pa_rtclock_now(), TRUE); pa_smoother_reset(u->smoother, pa_rtclock_now(), true);
u->smoother_interval = SMOOTHER_MIN_INTERVAL; u->smoother_interval = SMOOTHER_MIN_INTERVAL;
u->last_smoother_update = 0; u->last_smoother_update = 0;
u->first = TRUE; u->first = true;
/* reset the watermark to the value defined when source was created */ /* reset the watermark to the value defined when source was created */
if (u->use_tsched) if (u->use_tsched)
reset_watermark(u, u->tsched_watermark_ref, &u->source->sample_spec, TRUE); reset_watermark(u, u->tsched_watermark_ref, &u->source->sample_spec, true);
pa_log_info("Resumed successfully..."); pa_log_info("Resumed successfully...");
@ -1120,13 +1120,13 @@ static int ctl_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
return 0; return 0;
if (u->source->suspend_cause & PA_SUSPEND_SESSION) { if (u->source->suspend_cause & PA_SUSPEND_SESSION) {
pa_source_set_mixer_dirty(u->source, TRUE); pa_source_set_mixer_dirty(u->source, true);
return 0; return 0;
} }
if (mask & SND_CTL_EVENT_MASK_VALUE) { if (mask & SND_CTL_EVENT_MASK_VALUE) {
pa_source_get_volume(u->source, TRUE); pa_source_get_volume(u->source, true);
pa_source_get_mute(u->source, TRUE); pa_source_get_mute(u->source, true);
} }
return 0; return 0;
@ -1142,7 +1142,7 @@ static int io_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
return 0; return 0;
if (u->source->suspend_cause & PA_SUSPEND_SESSION) { if (u->source->suspend_cause & PA_SUSPEND_SESSION) {
pa_source_set_mixer_dirty(u->source, TRUE); pa_source_set_mixer_dirty(u->source, true);
return 0; return 0;
} }
@ -1189,7 +1189,7 @@ static void source_set_volume_cb(pa_source *s) {
struct userdata *u = s->userdata; struct userdata *u = s->userdata;
pa_cvolume r; pa_cvolume r;
char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX]; char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX];
pa_bool_t deferred_volume = !!(s->flags & PA_SOURCE_DEFERRED_VOLUME); bool deferred_volume = !!(s->flags & PA_SOURCE_DEFERRED_VOLUME);
pa_assert(u); pa_assert(u);
pa_assert(u->mixer_path); pa_assert(u->mixer_path);
@ -1208,7 +1208,7 @@ static void source_set_volume_cb(pa_source *s) {
if (u->mixer_path->has_dB) { if (u->mixer_path->has_dB) {
pa_cvolume new_soft_volume; pa_cvolume new_soft_volume;
pa_bool_t accurate_enough; bool accurate_enough;
char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX]; char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX];
/* Match exactly what the user requested by software */ /* Match exactly what the user requested by software */
@ -1255,11 +1255,11 @@ static void source_write_volume_cb(pa_source *s) {
/* Shift up by the base volume */ /* Shift up by the base volume */
pa_sw_cvolume_divide_scalar(&hw_vol, &hw_vol, s->base_volume); pa_sw_cvolume_divide_scalar(&hw_vol, &hw_vol, s->base_volume);
if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &hw_vol, TRUE, TRUE) < 0) if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &hw_vol, true, true) < 0)
pa_log_error("Writing HW volume failed"); pa_log_error("Writing HW volume failed");
else { else {
pa_cvolume tmp_vol; pa_cvolume tmp_vol;
pa_bool_t accurate_enough; bool accurate_enough;
/* Shift down by the base volume, so that 0dB becomes maximum volume */ /* Shift down by the base volume, so that 0dB becomes maximum volume */
pa_sw_cvolume_multiply_scalar(&hw_vol, &hw_vol, s->base_volume); pa_sw_cvolume_multiply_scalar(&hw_vol, &hw_vol, s->base_volume);
@ -1287,7 +1287,7 @@ static void source_write_volume_cb(pa_source *s) {
static void source_get_mute_cb(pa_source *s) { static void source_get_mute_cb(pa_source *s) {
struct userdata *u = s->userdata; struct userdata *u = s->userdata;
pa_bool_t b; bool b;
pa_assert(u); pa_assert(u);
pa_assert(u->mixer_path); pa_assert(u->mixer_path);
@ -1329,7 +1329,7 @@ static void mixer_volume_init(struct userdata *u) {
pa_source_set_write_volume_callback(u->source, NULL); pa_source_set_write_volume_callback(u->source, NULL);
if (u->mixer_path->has_dB) { if (u->mixer_path->has_dB) {
pa_source_enable_decibel_volume(u->source, TRUE); pa_source_enable_decibel_volume(u->source, true);
pa_log_info("Hardware volume ranges from %0.2f dB to %0.2f dB.", u->mixer_path->min_dB, u->mixer_path->max_dB); pa_log_info("Hardware volume ranges from %0.2f dB to %0.2f dB.", u->mixer_path->min_dB, u->mixer_path->max_dB);
u->source->base_volume = pa_sw_volume_from_dB(-u->mixer_path->max_dB); u->source->base_volume = pa_sw_volume_from_dB(-u->mixer_path->max_dB);
@ -1337,7 +1337,7 @@ static void mixer_volume_init(struct userdata *u) {
pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(u->source->base_volume)); pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(u->source->base_volume));
} else { } else {
pa_source_enable_decibel_volume(u->source, FALSE); pa_source_enable_decibel_volume(u->source, false);
pa_log_info("Hardware volume ranges from %li to %li.", u->mixer_path->min_volume, u->mixer_path->max_volume); pa_log_info("Hardware volume ranges from %li to %li.", u->mixer_path->min_volume, u->mixer_path->max_volume);
u->source->base_volume = PA_VOLUME_NORM; u->source->base_volume = PA_VOLUME_NORM;
@ -1365,7 +1365,7 @@ static int source_set_port_ucm_cb(pa_source *s, pa_device_port *p) {
pa_assert(p); pa_assert(p);
pa_assert(u->ucm_context); pa_assert(u->ucm_context);
return pa_alsa_ucm_set_port(u->ucm_context, p, FALSE); return pa_alsa_ucm_set_port(u->ucm_context, p, false);
} }
static int source_set_port_cb(pa_source *s, pa_device_port *p) { static int source_set_port_cb(pa_source *s, pa_device_port *p) {
@ -1409,32 +1409,32 @@ static void source_update_requested_latency_cb(pa_source *s) {
update_sw_params(u); update_sw_params(u);
} }
static pa_bool_t source_update_rate_cb(pa_source *s, uint32_t rate) { static bool source_update_rate_cb(pa_source *s, uint32_t rate) {
struct userdata *u = s->userdata; struct userdata *u = s->userdata;
int i; int i;
pa_bool_t supported = FALSE; bool supported = false;
pa_assert(u); pa_assert(u);
for (i = 0; u->rates[i]; i++) { for (i = 0; u->rates[i]; i++) {
if (u->rates[i] == rate) { if (u->rates[i] == rate) {
supported = TRUE; supported = true;
break; break;
} }
} }
if (!supported) { if (!supported) {
pa_log_info("Source does not support sample rate of %d Hz", rate); pa_log_info("Source does not support sample rate of %d Hz", rate);
return FALSE; return false;
} }
if (!PA_SOURCE_IS_OPENED(s->state)) { if (!PA_SOURCE_IS_OPENED(s->state)) {
pa_log_info("Updating rate for device %s, new rate is %d", u->device_name, rate); pa_log_info("Updating rate for device %s, new rate is %d", u->device_name, rate);
u->source->sample_spec.rate = rate; u->source->sample_spec.rate = rate;
return TRUE; return true;
} }
return FALSE; return false;
} }
static void thread_func(void *userdata) { static void thread_func(void *userdata) {
@ -1462,15 +1462,15 @@ static void thread_func(void *userdata) {
if (PA_SOURCE_IS_OPENED(u->source->thread_info.state)) { if (PA_SOURCE_IS_OPENED(u->source->thread_info.state)) {
int work_done; int work_done;
pa_usec_t sleep_usec = 0; pa_usec_t sleep_usec = 0;
pa_bool_t on_timeout = pa_rtpoll_timer_elapsed(u->rtpoll); bool on_timeout = pa_rtpoll_timer_elapsed(u->rtpoll);
if (u->first) { if (u->first) {
pa_log_info("Starting capture."); pa_log_info("Starting capture.");
snd_pcm_start(u->pcm_handle); snd_pcm_start(u->pcm_handle);
pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE); pa_smoother_resume(u->smoother, pa_rtclock_now(), true);
u->first = FALSE; u->first = false;
} }
if (u->use_mmap) if (u->use_mmap)
@ -1524,7 +1524,7 @@ static void thread_func(void *userdata) {
pa_rtpoll_set_timer_disabled(u->rtpoll); pa_rtpoll_set_timer_disabled(u->rtpoll);
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (rtpoll_sleep > 0) { if (rtpoll_sleep > 0) {
@ -1563,7 +1563,7 @@ static void thread_func(void *userdata) {
if (pa_alsa_recover_from_poll(u->pcm_handle, revents) < 0) if (pa_alsa_recover_from_poll(u->pcm_handle, revents) < 0)
goto fail; goto fail;
u->first = TRUE; u->first = true;
revents = 0; revents = 0;
} else if (revents && u->use_tsched && pa_log_ratelimit(PA_LOG_DEBUG)) } else if (revents && u->use_tsched && pa_log_ratelimit(PA_LOG_DEBUG))
pa_log_debug("Wakeup from ALSA!"); pa_log_debug("Wakeup from ALSA!");
@ -1592,15 +1592,15 @@ static void set_source_name(pa_source_new_data *data, pa_modargs *ma, const char
if ((n = pa_modargs_get_value(ma, "source_name", NULL))) { if ((n = pa_modargs_get_value(ma, "source_name", NULL))) {
pa_source_new_data_set_name(data, n); pa_source_new_data_set_name(data, n);
data->namereg_fail = TRUE; data->namereg_fail = true;
return; return;
} }
if ((n = pa_modargs_get_value(ma, "name", NULL))) if ((n = pa_modargs_get_value(ma, "name", NULL)))
data->namereg_fail = TRUE; data->namereg_fail = true;
else { else {
n = device_id ? device_id : device_name; n = device_id ? device_id : device_name;
data->namereg_fail = FALSE; data->namereg_fail = false;
} }
if (mapping) if (mapping)
@ -1612,7 +1612,7 @@ static void set_source_name(pa_source_new_data *data, pa_modargs *ma, const char
pa_xfree(t); pa_xfree(t);
} }
static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char *element, pa_bool_t ignore_dB) { static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char *element, bool ignore_dB) {
snd_hctl_t *hctl; snd_hctl_t *hctl;
if (!mapping && !element) if (!mapping && !element)
@ -1651,8 +1651,8 @@ fail:
} }
} }
static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { static int setup_mixer(struct userdata *u, bool ignore_dB) {
pa_bool_t need_mixer_callback = FALSE; bool need_mixer_callback = false;
pa_assert(u); pa_assert(u);
@ -1692,7 +1692,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) {
PA_HASHMAP_FOREACH(p, u->mixer_path_set->paths, state) { PA_HASHMAP_FOREACH(p, u->mixer_path_set->paths, state) {
if (p->has_volume || p->has_mute) if (p->has_volume || p->has_mute)
need_mixer_callback = TRUE; need_mixer_callback = true;
} }
} }
else if (u->mixer_path) else if (u->mixer_path)
@ -1738,7 +1738,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark; uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark;
snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames; snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames;
size_t frame_size; size_t frame_size;
pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE, namereg_fail = FALSE, deferred_volume = FALSE, fixed_latency_range = FALSE; bool use_mmap = true, b, use_tsched = true, d, ignore_dB = false, namereg_fail = false, deferred_volume = false, fixed_latency_range = false;
pa_source_new_data data; pa_source_new_data data;
pa_alsa_profile_set *profile_set = NULL; pa_alsa_profile_set *profile_set = NULL;
void *state = NULL; void *state = NULL;
@ -1817,18 +1817,18 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
u->use_tsched = use_tsched; u->use_tsched = use_tsched;
u->deferred_volume = deferred_volume; u->deferred_volume = deferred_volume;
u->fixed_latency_range = fixed_latency_range; u->fixed_latency_range = fixed_latency_range;
u->first = TRUE; u->first = true;
u->rtpoll = pa_rtpoll_new(); u->rtpoll = pa_rtpoll_new();
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
u->smoother = pa_smoother_new( u->smoother = pa_smoother_new(
SMOOTHER_ADJUST_USEC, SMOOTHER_ADJUST_USEC,
SMOOTHER_WINDOW_USEC, SMOOTHER_WINDOW_USEC,
TRUE, true,
TRUE, true,
5, 5,
pa_rtclock_now(), pa_rtclock_now(),
TRUE); true);
u->smoother_interval = SMOOTHER_MIN_INTERVAL; u->smoother_interval = SMOOTHER_MIN_INTERVAL;
/* use ucm */ /* use ucm */
@ -1895,7 +1895,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
&ss, &map, &ss, &map,
SND_PCM_STREAM_CAPTURE, SND_PCM_STREAM_CAPTURE,
&period_frames, &buffer_frames, tsched_frames, &period_frames, &buffer_frames, tsched_frames,
&b, &d, FALSE))) &b, &d, false)))
goto fail; goto fail;
} }
@ -1912,12 +1912,12 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
if (use_mmap && !b) { if (use_mmap && !b) {
pa_log_info("Device doesn't support mmap(), falling back to UNIX read/write mode."); pa_log_info("Device doesn't support mmap(), falling back to UNIX read/write mode.");
u->use_mmap = use_mmap = FALSE; u->use_mmap = use_mmap = false;
} }
if (use_tsched && (!b || !d)) { if (use_tsched && (!b || !d)) {
pa_log_info("Cannot enable timer-based scheduling, falling back to sound IRQ scheduling."); pa_log_info("Cannot enable timer-based scheduling, falling back to sound IRQ scheduling.");
u->use_tsched = use_tsched = FALSE; u->use_tsched = use_tsched = false;
} }
if (u->use_mmap) if (u->use_mmap)
@ -1989,7 +1989,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
} }
if (u->ucm_context) if (u->ucm_context)
pa_alsa_ucm_add_ports(&data.ports, data.proplist, u->ucm_context, FALSE, card); pa_alsa_ucm_add_ports(&data.ports, data.proplist, u->ucm_context, false, card);
else if (u->mixer_path_set) else if (u->mixer_path_set)
pa_alsa_add_ports(&data, u->mixer_path_set, card); pa_alsa_add_ports(&data, u->mixer_path_set, card);
@ -2042,7 +2042,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
if (u->use_tsched) { if (u->use_tsched) {
u->tsched_watermark_ref = tsched_watermark; u->tsched_watermark_ref = tsched_watermark;
reset_watermark(u, u->tsched_watermark_ref, &ss, FALSE); reset_watermark(u, u->tsched_watermark_ref, &ss, false);
} }
else else
pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(u->hwbuf_size, &ss)); pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(u->hwbuf_size, &ss));
@ -2053,7 +2053,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
goto fail; goto fail;
if (u->ucm_context) { if (u->ucm_context) {
if (u->source->active_port && pa_alsa_ucm_set_port(u->ucm_context, u->source->active_port, FALSE) < 0) if (u->source->active_port && pa_alsa_ucm_set_port(u->ucm_context, u->source->active_port, false) < 0)
goto fail; goto fail;
} else if (setup_mixer(u, ignore_dB) < 0) } else if (setup_mixer(u, ignore_dB) < 0)
goto fail; goto fail;

View file

@ -451,10 +451,10 @@ static void add_media_role(const char *name, pa_alsa_ucm_device *list, const cha
static char *modifier_name_to_role(const char *mod_name, bool *is_sink) { static char *modifier_name_to_role(const char *mod_name, bool *is_sink) {
char *sub = NULL, *tmp; char *sub = NULL, *tmp;
*is_sink = FALSE; *is_sink = false;
if (pa_startswith(mod_name, "Play")) { if (pa_startswith(mod_name, "Play")) {
*is_sink = TRUE; *is_sink = true;
sub = pa_xstrdup(mod_name + 4); sub = pa_xstrdup(mod_name + 4);
} else if (pa_startswith(mod_name, "Capture")) } else if (pa_startswith(mod_name, "Capture"))
sub = pa_xstrdup(mod_name + 7); sub = pa_xstrdup(mod_name + 7);
@ -476,7 +476,7 @@ static char *modifier_name_to_role(const char *mod_name, bool *is_sink) {
static void ucm_set_media_roles(pa_alsa_ucm_modifier *modifier, pa_alsa_ucm_device *list, const char *mod_name) { static void ucm_set_media_roles(pa_alsa_ucm_modifier *modifier, pa_alsa_ucm_device *list, const char *mod_name) {
int i; int i;
bool is_sink = FALSE; bool is_sink = false;
char *sub = NULL; char *sub = NULL;
const char *role_name; const char *role_name;
@ -729,7 +729,7 @@ static int ucm_port_contains(const char *port_name, const char *dev_name, bool i
int len; int len;
if (!port_name || !dev_name) if (!port_name || !dev_name)
return FALSE; return false;
port_name += is_sink ? strlen(PA_UCM_PRE_TAG_OUTPUT) : strlen(PA_UCM_PRE_TAG_INPUT); port_name += is_sink ? strlen(PA_UCM_PRE_TAG_OUTPUT) : strlen(PA_UCM_PRE_TAG_INPUT);
@ -1203,9 +1203,9 @@ static int ucm_create_mapping(
} }
if (sink) if (sink)
ret = ucm_create_mapping_direction(ucm, ps, p, device, verb_name, device_name, sink, TRUE); ret = ucm_create_mapping_direction(ucm, ps, p, device, verb_name, device_name, sink, true);
if (ret == 0 && source) if (ret == 0 && source)
ret = ucm_create_mapping_direction(ucm, ps, p, device, verb_name, device_name, source, FALSE); ret = ucm_create_mapping_direction(ucm, ps, p, device, verb_name, device_name, source, false);
return ret; return ret;
} }
@ -1260,7 +1260,7 @@ static int ucm_create_profile(
p->output_mappings = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); p->output_mappings = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
p->input_mappings = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); p->input_mappings = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
p->supported = TRUE; p->supported = true;
pa_hashmap_put(ps->profiles, p->name, p); pa_hashmap_put(ps->profiles, p->name, p);
/* TODO: get profile priority from ucm info or policy management */ /* TODO: get profile priority from ucm info or policy management */
@ -1305,9 +1305,9 @@ static int ucm_create_profile(
source = pa_proplist_gets(mod->proplist, PA_ALSA_PROP_UCM_SOURCE); source = pa_proplist_gets(mod->proplist, PA_ALSA_PROP_UCM_SOURCE);
if (sink) if (sink)
ucm_create_mapping_for_modifier(ucm, ps, p, mod, verb_name, name, sink, TRUE); ucm_create_mapping_for_modifier(ucm, ps, p, mod, verb_name, name, sink, true);
else if (source) else if (source)
ucm_create_mapping_for_modifier(ucm, ps, p, mod, verb_name, name, source, FALSE); ucm_create_mapping_for_modifier(ucm, ps, p, mod, verb_name, name, source, false);
} }
pa_alsa_profile_dump(p); pa_alsa_profile_dump(p);
@ -1405,7 +1405,7 @@ static void ucm_probe_profile_set(pa_alsa_ucm_config *ucm, pa_alsa_profile_set *
if ((snd_use_case_set(ucm->ucm_mgr, "_verb", p->name)) < 0) { if ((snd_use_case_set(ucm->ucm_mgr, "_verb", p->name)) < 0) {
pa_log("Failed to set verb %s", p->name); pa_log("Failed to set verb %s", p->name);
p->supported = FALSE; p->supported = false;
continue; continue;
} }
@ -1418,7 +1418,7 @@ static void ucm_probe_profile_set(pa_alsa_ucm_config *ucm, pa_alsa_profile_set *
m->output_pcm = mapping_open_pcm(ucm, m, SND_PCM_STREAM_PLAYBACK); m->output_pcm = mapping_open_pcm(ucm, m, SND_PCM_STREAM_PLAYBACK);
if (!m->output_pcm) { if (!m->output_pcm) {
p->supported = FALSE; p->supported = false;
break; break;
} }
} }
@ -1433,7 +1433,7 @@ static void ucm_probe_profile_set(pa_alsa_ucm_config *ucm, pa_alsa_profile_set *
m->input_pcm = mapping_open_pcm(ucm, m, SND_PCM_STREAM_CAPTURE); m->input_pcm = mapping_open_pcm(ucm, m, SND_PCM_STREAM_CAPTURE);
if (!m->input_pcm) { if (!m->input_pcm) {
p->supported = FALSE; p->supported = false;
break; break;
} }
} }
@ -1488,7 +1488,7 @@ pa_alsa_profile_set* pa_alsa_ucm_add_profile_set(pa_alsa_ucm_config *ucm, pa_cha
} }
ucm_probe_profile_set(ucm, ps); ucm_probe_profile_set(ucm, ps);
ps->probed = TRUE; ps->probed = true;
return ps; return ps;
} }

View file

@ -191,17 +191,17 @@ int pa_alsa_set_hw_params(
snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *period_size,
snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *buffer_size,
snd_pcm_uframes_t tsched_size, snd_pcm_uframes_t tsched_size,
pa_bool_t *use_mmap, bool *use_mmap,
pa_bool_t *use_tsched, bool *use_tsched,
pa_bool_t require_exact_channel_number) { bool require_exact_channel_number) {
int ret = -1; int ret = -1;
snd_pcm_hw_params_t *hwparams, *hwparams_copy; snd_pcm_hw_params_t *hwparams, *hwparams_copy;
int dir; int dir;
snd_pcm_uframes_t _period_size = period_size ? *period_size : 0; snd_pcm_uframes_t _period_size = period_size ? *period_size : 0;
snd_pcm_uframes_t _buffer_size = buffer_size ? *buffer_size : 0; snd_pcm_uframes_t _buffer_size = buffer_size ? *buffer_size : 0;
pa_bool_t _use_mmap = use_mmap && *use_mmap; bool _use_mmap = use_mmap && *use_mmap;
pa_bool_t _use_tsched = use_tsched && *use_tsched; bool _use_tsched = use_tsched && *use_tsched;
pa_sample_spec _ss = *ss; pa_sample_spec _ss = *ss;
pa_assert(pcm_handle); pa_assert(pcm_handle);
@ -231,7 +231,7 @@ int pa_alsa_set_hw_params(
goto finish; goto finish;
} }
_use_mmap = FALSE; _use_mmap = false;
} }
} else if ((ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) { } else if ((ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
@ -240,10 +240,10 @@ int pa_alsa_set_hw_params(
} }
if (!_use_mmap) if (!_use_mmap)
_use_tsched = FALSE; _use_tsched = false;
if (!pa_alsa_pcm_is_hw(pcm_handle)) if (!pa_alsa_pcm_is_hw(pcm_handle))
_use_tsched = FALSE; _use_tsched = false;
#if (SND_LIB_VERSION >= ((1<<16)|(0<<8)|24)) /* API additions in 1.0.24 */ #if (SND_LIB_VERSION >= ((1<<16)|(0<<8)|24)) /* API additions in 1.0.24 */
if (_use_tsched) { if (_use_tsched) {
@ -251,7 +251,7 @@ int pa_alsa_set_hw_params(
/* try to disable period wakeups if hardware can do so */ /* try to disable period wakeups if hardware can do so */
if (snd_pcm_hw_params_can_disable_period_wakeup(hwparams)) { if (snd_pcm_hw_params_can_disable_period_wakeup(hwparams)) {
if ((ret = snd_pcm_hw_params_set_period_wakeup(pcm_handle, hwparams, FALSE)) < 0) if ((ret = snd_pcm_hw_params_set_period_wakeup(pcm_handle, hwparams, false)) < 0)
/* don't bail, keep going with default mode with period wakeups */ /* don't bail, keep going with default mode with period wakeups */
pa_log_debug("snd_pcm_hw_params_set_period_wakeup() failed: %s", pa_alsa_strerror(ret)); pa_log_debug("snd_pcm_hw_params_set_period_wakeup() failed: %s", pa_alsa_strerror(ret));
else else
@ -426,7 +426,7 @@ finish:
return ret; return ret;
} }
int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min, pa_bool_t period_event) { int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min, bool period_event) {
snd_pcm_sw_params_t *swparams; snd_pcm_sw_params_t *swparams;
snd_pcm_uframes_t boundary; snd_pcm_uframes_t boundary;
int err; int err;
@ -487,8 +487,8 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto(
snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *period_size,
snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *buffer_size,
snd_pcm_uframes_t tsched_size, snd_pcm_uframes_t tsched_size,
pa_bool_t *use_mmap, bool *use_mmap,
pa_bool_t *use_tsched, bool *use_tsched,
pa_alsa_profile_set *ps, pa_alsa_profile_set *ps,
pa_alsa_mapping **mapping) { pa_alsa_mapping **mapping) {
@ -578,7 +578,7 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto(
tsched_size, tsched_size,
use_mmap, use_mmap,
use_tsched, use_tsched,
FALSE); false);
pa_xfree(d); pa_xfree(d);
if (pcm_handle && mapping) if (pcm_handle && mapping)
@ -596,8 +596,8 @@ snd_pcm_t *pa_alsa_open_by_device_id_mapping(
snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *period_size,
snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *buffer_size,
snd_pcm_uframes_t tsched_size, snd_pcm_uframes_t tsched_size,
pa_bool_t *use_mmap, bool *use_mmap,
pa_bool_t *use_tsched, bool *use_tsched,
pa_alsa_mapping *m) { pa_alsa_mapping *m) {
snd_pcm_t *pcm_handle; snd_pcm_t *pcm_handle;
@ -648,14 +648,14 @@ snd_pcm_t *pa_alsa_open_by_device_string(
snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *period_size,
snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *buffer_size,
snd_pcm_uframes_t tsched_size, snd_pcm_uframes_t tsched_size,
pa_bool_t *use_mmap, bool *use_mmap,
pa_bool_t *use_tsched, bool *use_tsched,
pa_bool_t require_exact_channel_number) { bool require_exact_channel_number) {
int err; int err;
char *d; char *d;
snd_pcm_t *pcm_handle; snd_pcm_t *pcm_handle;
pa_bool_t reformat = FALSE; bool reformat = false;
pa_assert(device); pa_assert(device);
pa_assert(ss); pa_assert(ss);
@ -688,7 +688,7 @@ snd_pcm_t *pa_alsa_open_by_device_string(
require_exact_channel_number)) < 0) { require_exact_channel_number)) < 0) {
if (!reformat) { if (!reformat) {
reformat = TRUE; reformat = true;
snd_pcm_close(pcm_handle); snd_pcm_close(pcm_handle);
continue; continue;
@ -702,7 +702,7 @@ snd_pcm_t *pa_alsa_open_by_device_string(
pa_xfree(d); pa_xfree(d);
d = t; d = t;
reformat = FALSE; reformat = false;
snd_pcm_close(pcm_handle); snd_pcm_close(pcm_handle);
continue; continue;
@ -741,9 +741,9 @@ snd_pcm_t *pa_alsa_open_by_template(
snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *period_size,
snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *buffer_size,
snd_pcm_uframes_t tsched_size, snd_pcm_uframes_t tsched_size,
pa_bool_t *use_mmap, bool *use_mmap,
pa_bool_t *use_tsched, bool *use_tsched,
pa_bool_t require_exact_channel_number) { bool require_exact_channel_number) {
snd_pcm_t *pcm_handle; snd_pcm_t *pcm_handle;
char **i; char **i;
@ -862,18 +862,18 @@ void pa_alsa_refcnt_dec(void) {
} }
} }
pa_bool_t pa_alsa_init_description(pa_proplist *p) { bool pa_alsa_init_description(pa_proplist *p) {
const char *d, *k; const char *d, *k;
pa_assert(p); pa_assert(p);
if (pa_device_init_description(p)) if (pa_device_init_description(p))
return TRUE; return true;
if (!(d = pa_proplist_gets(p, "alsa.card_name"))) if (!(d = pa_proplist_gets(p, "alsa.card_name")))
d = pa_proplist_gets(p, "alsa.name"); d = pa_proplist_gets(p, "alsa.name");
if (!d) if (!d)
return FALSE; return false;
k = pa_proplist_gets(p, PA_PROP_DEVICE_PROFILE_DESCRIPTION); k = pa_proplist_gets(p, PA_PROP_DEVICE_PROFILE_DESCRIPTION);
@ -882,7 +882,7 @@ pa_bool_t pa_alsa_init_description(pa_proplist *p) {
else if (d) else if (d)
pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, d); pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, d);
return FALSE; return false;
} }
void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) { void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) {
@ -1142,7 +1142,7 @@ snd_pcm_sframes_t pa_alsa_safe_avail(snd_pcm_t *pcm, size_t hwbuf_size, const pa
} }
int pa_alsa_safe_delay(snd_pcm_t *pcm, snd_pcm_status_t *status, snd_pcm_sframes_t *delay, size_t hwbuf_size, const pa_sample_spec *ss, int pa_alsa_safe_delay(snd_pcm_t *pcm, snd_pcm_status_t *status, snd_pcm_sframes_t *delay, size_t hwbuf_size, const pa_sample_spec *ss,
pa_bool_t capture) { bool capture) {
ssize_t k; ssize_t k;
size_t abs_k; size_t abs_k;
int err; int err;
@ -1333,7 +1333,7 @@ unsigned int *pa_alsa_get_supported_rates(snd_pcm_t *pcm, unsigned int fallback_
64000, 88200, 96000, 64000, 88200, 96000,
128000, 176400, 192000, 128000, 176400, 192000,
384000 }; 384000 };
pa_bool_t supported[PA_ELEMENTSOF(all_rates)] = { FALSE, }; bool supported[PA_ELEMENTSOF(all_rates)] = { false, };
snd_pcm_hw_params_t *hwparams; snd_pcm_hw_params_t *hwparams;
unsigned int i, j, n, *rates = NULL; unsigned int i, j, n, *rates = NULL;
int ret; int ret;
@ -1347,7 +1347,7 @@ unsigned int *pa_alsa_get_supported_rates(snd_pcm_t *pcm, unsigned int fallback_
for (i = 0, n = 0; i < PA_ELEMENTSOF(all_rates); i++) { for (i = 0, n = 0; i < PA_ELEMENTSOF(all_rates); i++) {
if (snd_pcm_hw_params_test_rate(pcm, hwparams, all_rates[i], 0) == 0) { if (snd_pcm_hw_params_test_rate(pcm, hwparams, all_rates[i], 0) == 0) {
supported[i] = TRUE; supported[i] = true;
n++; n++;
} }
} }
@ -1377,26 +1377,26 @@ unsigned int *pa_alsa_get_supported_rates(snd_pcm_t *pcm, unsigned int fallback_
return rates; return rates;
} }
pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm) { bool pa_alsa_pcm_is_hw(snd_pcm_t *pcm) {
snd_pcm_info_t* info; snd_pcm_info_t* info;
snd_pcm_info_alloca(&info); snd_pcm_info_alloca(&info);
pa_assert(pcm); pa_assert(pcm);
if (snd_pcm_info(pcm, info) < 0) if (snd_pcm_info(pcm, info) < 0)
return FALSE; return false;
return snd_pcm_info_get_card(info) >= 0; return snd_pcm_info_get_card(info) >= 0;
} }
pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm) { bool pa_alsa_pcm_is_modem(snd_pcm_t *pcm) {
snd_pcm_info_t* info; snd_pcm_info_t* info;
snd_pcm_info_alloca(&info); snd_pcm_info_alloca(&info);
pa_assert(pcm); pa_assert(pcm);
if (snd_pcm_info(pcm, info) < 0) if (snd_pcm_info(pcm, info) < 0)
return FALSE; return false;
return snd_pcm_info_get_class(info) == SND_PCM_CLASS_MODEM; return snd_pcm_info_get_class(info) == SND_PCM_CLASS_MODEM;
} }
@ -1428,26 +1428,26 @@ const char* pa_alsa_strerror(int errnum) {
return translated; return translated;
} }
pa_bool_t pa_alsa_may_tsched(pa_bool_t want) { bool pa_alsa_may_tsched(bool want) {
if (!want) if (!want)
return FALSE; return false;
if (!pa_rtclock_hrtimer()) { if (!pa_rtclock_hrtimer()) {
/* We cannot depend on being woken up in time when the timers /* We cannot depend on being woken up in time when the timers
are inaccurate, so let's fallback to classic IO based playback are inaccurate, so let's fallback to classic IO based playback
then. */ then. */
pa_log_notice("Disabling timer-based scheduling because high-resolution timers are not available from the kernel."); pa_log_notice("Disabling timer-based scheduling because high-resolution timers are not available from the kernel.");
return FALSE; } return false; }
if (pa_running_in_vm()) { if (pa_running_in_vm()) {
/* We cannot depend on being woken up when we ask for in a VM, /* We cannot depend on being woken up when we ask for in a VM,
* so let's fallback to classic IO based playback then. */ * so let's fallback to classic IO based playback then. */
pa_log_notice("Disabling timer-based scheduling because running inside a VM."); pa_log_notice("Disabling timer-based scheduling because running inside a VM.");
return FALSE; return false;
} }
return TRUE; return true;
} }
snd_hctl_elem_t* pa_alsa_find_jack(snd_hctl_t *hctl, const char* jack_name) { snd_hctl_elem_t* pa_alsa_find_jack(snd_hctl_t *hctl, const char* jack_name) {

View file

@ -41,14 +41,14 @@ int pa_alsa_set_hw_params(
snd_pcm_uframes_t *period_size, /* modified at return */ snd_pcm_uframes_t *period_size, /* modified at return */
snd_pcm_uframes_t *buffer_size, /* modified at return */ snd_pcm_uframes_t *buffer_size, /* modified at return */
snd_pcm_uframes_t tsched_size, snd_pcm_uframes_t tsched_size,
pa_bool_t *use_mmap, /* modified at return */ bool *use_mmap, /* modified at return */
pa_bool_t *use_tsched, /* modified at return */ bool *use_tsched, /* modified at return */
pa_bool_t require_exact_channel_number); bool require_exact_channel_number);
int pa_alsa_set_sw_params( int pa_alsa_set_sw_params(
snd_pcm_t *pcm, snd_pcm_t *pcm,
snd_pcm_uframes_t avail_min, snd_pcm_uframes_t avail_min,
pa_bool_t period_event); bool period_event);
/* Picks a working mapping from the profile set based on the specified ss/map */ /* Picks a working mapping from the profile set based on the specified ss/map */
snd_pcm_t *pa_alsa_open_by_device_id_auto( snd_pcm_t *pa_alsa_open_by_device_id_auto(
@ -60,8 +60,8 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto(
snd_pcm_uframes_t *period_size, /* modified at return */ snd_pcm_uframes_t *period_size, /* modified at return */
snd_pcm_uframes_t *buffer_size, /* modified at return */ snd_pcm_uframes_t *buffer_size, /* modified at return */
snd_pcm_uframes_t tsched_size, snd_pcm_uframes_t tsched_size,
pa_bool_t *use_mmap, /* modified at return */ bool *use_mmap, /* modified at return */
pa_bool_t *use_tsched, /* modified at return */ bool *use_tsched, /* modified at return */
pa_alsa_profile_set *ps, pa_alsa_profile_set *ps,
pa_alsa_mapping **mapping); /* modified at return */ pa_alsa_mapping **mapping); /* modified at return */
@ -75,8 +75,8 @@ snd_pcm_t *pa_alsa_open_by_device_id_mapping(
snd_pcm_uframes_t *period_size, /* modified at return */ snd_pcm_uframes_t *period_size, /* modified at return */
snd_pcm_uframes_t *buffer_size, /* modified at return */ snd_pcm_uframes_t *buffer_size, /* modified at return */
snd_pcm_uframes_t tsched_size, snd_pcm_uframes_t tsched_size,
pa_bool_t *use_mmap, /* modified at return */ bool *use_mmap, /* modified at return */
pa_bool_t *use_tsched, /* modified at return */ bool *use_tsched, /* modified at return */
pa_alsa_mapping *mapping); pa_alsa_mapping *mapping);
/* Opens the explicit ALSA device */ /* Opens the explicit ALSA device */
@ -89,9 +89,9 @@ snd_pcm_t *pa_alsa_open_by_device_string(
snd_pcm_uframes_t *period_size, /* modified at return */ snd_pcm_uframes_t *period_size, /* modified at return */
snd_pcm_uframes_t *buffer_size, /* modified at return */ snd_pcm_uframes_t *buffer_size, /* modified at return */
snd_pcm_uframes_t tsched_size, snd_pcm_uframes_t tsched_size,
pa_bool_t *use_mmap, /* modified at return */ bool *use_mmap, /* modified at return */
pa_bool_t *use_tsched, /* modified at return */ bool *use_tsched, /* modified at return */
pa_bool_t require_exact_channel_number); bool require_exact_channel_number);
/* Opens the explicit ALSA device with a fallback list */ /* Opens the explicit ALSA device with a fallback list */
snd_pcm_t *pa_alsa_open_by_template( snd_pcm_t *pa_alsa_open_by_template(
@ -104,9 +104,9 @@ snd_pcm_t *pa_alsa_open_by_template(
snd_pcm_uframes_t *period_size, /* modified at return */ snd_pcm_uframes_t *period_size, /* modified at return */
snd_pcm_uframes_t *buffer_size, /* modified at return */ snd_pcm_uframes_t *buffer_size, /* modified at return */
snd_pcm_uframes_t tsched_size, snd_pcm_uframes_t tsched_size,
pa_bool_t *use_mmap, /* modified at return */ bool *use_mmap, /* modified at return */
pa_bool_t *use_tsched, /* modified at return */ bool *use_tsched, /* modified at return */
pa_bool_t require_exact_channel_number); bool require_exact_channel_number);
void pa_alsa_dump(pa_log_level_t level, snd_pcm_t *pcm); void pa_alsa_dump(pa_log_level_t level, snd_pcm_t *pcm);
void pa_alsa_dump_status(snd_pcm_t *pcm); void pa_alsa_dump_status(snd_pcm_t *pcm);
@ -118,14 +118,14 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *
void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card); void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card);
void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm); void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm);
void pa_alsa_init_proplist_ctl(pa_proplist *p, const char *name); void pa_alsa_init_proplist_ctl(pa_proplist *p, const char *name);
pa_bool_t pa_alsa_init_description(pa_proplist *p); bool pa_alsa_init_description(pa_proplist *p);
int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents); int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents);
pa_rtpoll_item* pa_alsa_build_pollfd(snd_pcm_t *pcm, pa_rtpoll *rtpoll); pa_rtpoll_item* pa_alsa_build_pollfd(snd_pcm_t *pcm, pa_rtpoll *rtpoll);
snd_pcm_sframes_t pa_alsa_safe_avail(snd_pcm_t *pcm, size_t hwbuf_size, const pa_sample_spec *ss); snd_pcm_sframes_t pa_alsa_safe_avail(snd_pcm_t *pcm, size_t hwbuf_size, const pa_sample_spec *ss);
int pa_alsa_safe_delay(snd_pcm_t *pcm, snd_pcm_status_t *status, snd_pcm_sframes_t *delay, size_t hwbuf_size, const pa_sample_spec *ss, pa_bool_t capture); int pa_alsa_safe_delay(snd_pcm_t *pcm, snd_pcm_status_t *status, snd_pcm_sframes_t *delay, size_t hwbuf_size, const pa_sample_spec *ss, bool capture);
int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames, size_t hwbuf_size, const pa_sample_spec *ss); int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames, size_t hwbuf_size, const pa_sample_spec *ss);
char *pa_alsa_get_driver_name(int card); char *pa_alsa_get_driver_name(int card);
@ -135,12 +135,12 @@ char *pa_alsa_get_reserve_name(const char *device);
unsigned int *pa_alsa_get_supported_rates(snd_pcm_t *pcm, unsigned int fallback_rate); unsigned int *pa_alsa_get_supported_rates(snd_pcm_t *pcm, unsigned int fallback_rate);
pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm); bool pa_alsa_pcm_is_hw(snd_pcm_t *pcm);
pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm); bool pa_alsa_pcm_is_modem(snd_pcm_t *pcm);
const char* pa_alsa_strerror(int errnum); const char* pa_alsa_strerror(int errnum);
pa_bool_t pa_alsa_may_tsched(pa_bool_t want); bool pa_alsa_may_tsched(bool want);
snd_hctl_elem_t* pa_alsa_find_jack(snd_hctl_t *hctl, const char* jack_name); snd_hctl_elem_t* pa_alsa_find_jack(snd_hctl_t *hctl, const char* jack_name);
snd_hctl_elem_t* pa_alsa_find_eld_ctl(snd_hctl_t *hctl, int device); snd_hctl_elem_t* pa_alsa_find_eld_ctl(snd_hctl_t *hctl, int device);

View file

@ -45,7 +45,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("ALSA Card"); PA_MODULE_DESCRIPTION("ALSA Card");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"name=<name for the card/sink/source, to be prefixed> " "name=<name for the card/sink/source, to be prefixed> "
"card_name=<name for the card> " "card_name=<name for the card> "
@ -122,7 +122,7 @@ struct userdata {
pa_alsa_profile_set *profile_set; pa_alsa_profile_set *profile_set;
/* ucm stuffs */ /* ucm stuffs */
pa_bool_t use_ucm; bool use_ucm;
pa_alsa_ucm_config ucm; pa_alsa_ucm_config ucm;
/* hooks for modifier action */ /* hooks for modifier action */
@ -158,7 +158,7 @@ static void add_profiles(struct userdata *u, pa_hashmap *h, pa_hashmap *ports) {
PA_IDXSET_FOREACH(m, ap->output_mappings, idx) { PA_IDXSET_FOREACH(m, ap->output_mappings, idx) {
if (u->use_ucm) if (u->use_ucm)
pa_alsa_ucm_add_ports_combination(NULL, &m->ucm_context, TRUE, ports, cp, u->core); pa_alsa_ucm_add_ports_combination(NULL, &m->ucm_context, true, ports, cp, u->core);
else else
pa_alsa_path_set_add_ports(m->output_path_set, cp, ports, NULL, u->core); pa_alsa_path_set_add_ports(m->output_path_set, cp, ports, NULL, u->core);
if (m->channel_map.channels > cp->max_sink_channels) if (m->channel_map.channels > cp->max_sink_channels)
@ -171,7 +171,7 @@ static void add_profiles(struct userdata *u, pa_hashmap *h, pa_hashmap *ports) {
PA_IDXSET_FOREACH(m, ap->input_mappings, idx) { PA_IDXSET_FOREACH(m, ap->input_mappings, idx) {
if (u->use_ucm) if (u->use_ucm)
pa_alsa_ucm_add_ports_combination(NULL, &m->ucm_context, FALSE, ports, cp, u->core); pa_alsa_ucm_add_ports_combination(NULL, &m->ucm_context, false, ports, cp, u->core);
else else
pa_alsa_path_set_add_ports(m->input_path_set, cp, ports, NULL, u->core); pa_alsa_path_set_add_ports(m->input_path_set, cp, ports, NULL, u->core);
if (m->channel_map.channels > cp->max_source_channels) if (m->channel_map.channels > cp->max_source_channels)
@ -256,7 +256,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
am->sink = pa_alsa_sink_new(c->module, u->modargs, __FILE__, c, am); am->sink = pa_alsa_sink_new(c->module, u->modargs, __FILE__, c, am);
if (sink_inputs && am->sink) { if (sink_inputs && am->sink) {
pa_sink_move_all_finish(am->sink, sink_inputs, FALSE); pa_sink_move_all_finish(am->sink, sink_inputs, false);
sink_inputs = NULL; sink_inputs = NULL;
} }
} }
@ -268,7 +268,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
am->source = pa_alsa_source_new(c->module, u->modargs, __FILE__, c, am); am->source = pa_alsa_source_new(c->module, u->modargs, __FILE__, c, am);
if (source_outputs && am->source) { if (source_outputs && am->source) {
pa_source_move_all_finish(am->source, source_outputs, FALSE); pa_source_move_all_finish(am->source, source_outputs, false);
source_outputs = NULL; source_outputs = NULL;
} }
} }
@ -349,7 +349,7 @@ static void report_port_state(pa_device_port *p, struct userdata *u) {
static int report_jack_state(snd_hctl_elem_t *elem, unsigned int mask) { static int report_jack_state(snd_hctl_elem_t *elem, unsigned int mask) {
struct userdata *u = snd_hctl_elem_get_callback_private(elem); struct userdata *u = snd_hctl_elem_get_callback_private(elem);
snd_ctl_elem_value_t *elem_value; snd_ctl_elem_value_t *elem_value;
pa_bool_t plugged_in; bool plugged_in;
void *state; void *state;
pa_alsa_jack *jack; pa_alsa_jack *jack;
pa_device_port *port; pa_device_port *port;
@ -502,7 +502,7 @@ static void init_jacks(struct userdata *u) {
jack->hctl_elem = pa_alsa_find_jack(u->hctl_handle, jack->alsa_name); jack->hctl_elem = pa_alsa_find_jack(u->hctl_handle, jack->alsa_name);
if (!jack->hctl_elem) { if (!jack->hctl_elem) {
pa_log_warn("Jack '%s' seems to have disappeared.", jack->alsa_name); pa_log_warn("Jack '%s' seems to have disappeared.", jack->alsa_name);
jack->has_control = FALSE; jack->has_control = false;
continue; continue;
} }
snd_hctl_elem_set_callback_private(jack->hctl_elem, u); snd_hctl_elem_set_callback_private(jack->hctl_elem, u);
@ -525,15 +525,15 @@ static void set_card_name(pa_card_new_data *data, pa_modargs *ma, const char *de
if ((n = pa_modargs_get_value(ma, "card_name", NULL))) { if ((n = pa_modargs_get_value(ma, "card_name", NULL))) {
pa_card_new_data_set_name(data, n); pa_card_new_data_set_name(data, n);
data->namereg_fail = TRUE; data->namereg_fail = true;
return; return;
} }
if ((n = pa_modargs_get_value(ma, "name", NULL))) if ((n = pa_modargs_get_value(ma, "name", NULL)))
data->namereg_fail = TRUE; data->namereg_fail = true;
else { else {
n = device_id; n = device_id;
data->namereg_fail = FALSE; data->namereg_fail = false;
} }
t = pa_sprintf_malloc("alsa_card.%s", n); t = pa_sprintf_malloc("alsa_card.%s", n);
@ -604,13 +604,13 @@ static pa_hook_result_t source_output_unlink_hook_callback(pa_core *c, pa_source
int pa__init(pa_module *m) { int pa__init(pa_module *m) {
pa_card_new_data data; pa_card_new_data data;
pa_modargs *ma; pa_modargs *ma;
pa_bool_t ignore_dB = FALSE; bool ignore_dB = false;
struct userdata *u; struct userdata *u;
pa_reserve_wrapper *reserve = NULL; pa_reserve_wrapper *reserve = NULL;
const char *description; const char *description;
const char *profile = NULL; const char *profile = NULL;
char *fn = NULL; char *fn = NULL;
pa_bool_t namereg_fail = FALSE; bool namereg_fail = false;
pa_alsa_refcnt_inc(); pa_alsa_refcnt_inc();
@ -632,7 +632,7 @@ int pa__init(pa_module *m) {
u->device_id = pa_xstrdup(pa_modargs_get_value(ma, "device_id", DEFAULT_DEVICE_ID)); u->device_id = pa_xstrdup(pa_modargs_get_value(ma, "device_id", DEFAULT_DEVICE_ID));
u->modargs = ma; u->modargs = ma;
u->use_ucm = TRUE; u->use_ucm = true;
u->ucm.core = m->core; u->ucm.core = m->core;
if ((u->alsa_card_index = snd_card_get_index(u->device_id)) < 0) { if ((u->alsa_card_index = snd_card_get_index(u->device_id)) < 0) {
@ -673,7 +673,7 @@ int pa__init(pa_module *m) {
(pa_hook_cb_t) source_output_unlink_hook_callback, u); (pa_hook_cb_t) source_output_unlink_hook_callback, u);
} }
else { else {
u->use_ucm = FALSE; u->use_ucm = false;
#ifdef HAVE_UDEV #ifdef HAVE_UDEV
fn = pa_udev_get_property(u->alsa_card_index, "PULSE_PROFILE_SET"); fn = pa_udev_get_property(u->alsa_card_index, "PULSE_PROFILE_SET");
#endif #endif

View file

@ -35,7 +35,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("ALSA Sink"); PA_MODULE_DESCRIPTION("ALSA Sink");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"name=<name of the sink, to be prefixed> " "name=<name of the sink, to be prefixed> "
"sink_name=<name for the sink> " "sink_name=<name for the sink> "

View file

@ -44,7 +44,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("ALSA Source"); PA_MODULE_DESCRIPTION("ALSA Source");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"name=<name for the source, to be prefixed> " "name=<name for the source, to be prefixed> "
"source_name=<name for the source> " "source_name=<name for the source> "

View file

@ -336,7 +336,7 @@ static void handle_set_active_profile(DBusConnection *conn, DBusMessage *msg, DB
return; return;
} }
if ((r = pa_card_set_profile(c->card, pa_dbusiface_card_profile_get_name(new_active), TRUE)) < 0) { if ((r = pa_card_set_profile(c->card, pa_dbusiface_card_profile_get_name(new_active), true)) < 0) {
pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED,
"Internal error in PulseAudio: pa_card_set_profile() failed with error code %i.", r); "Internal error in PulseAudio: pa_card_set_profile() failed with error code %i.", r);
return; return;

View file

@ -364,7 +364,7 @@ static void handle_remove_properties(DBusConnection *conn, DBusMessage *msg, voi
pa_dbusiface_client *c = userdata; pa_dbusiface_client *c = userdata;
char **keys = NULL; char **keys = NULL;
int n_keys = 0; int n_keys = 0;
pa_bool_t changed = FALSE; bool changed = false;
int i = 0; int i = 0;
pa_assert(conn); pa_assert(conn);

View file

@ -365,7 +365,7 @@ static dbus_bool_t get_is_local(DBusConnection *conn) {
pa_assert(conn); pa_assert(conn);
if (!dbus_connection_get_socket(conn, &conn_fd)) if (!dbus_connection_get_socket(conn, &conn_fd))
return FALSE; return false;
return pa_socket_is_local(conn_fd); return pa_socket_is_local(conn_fd);
} }
@ -1407,9 +1407,9 @@ static void handle_upload_sample(DBusConnection *conn, DBusMessage *msg, void *u
sample->volume.channels = n_channels; sample->volume.channels = n_channels;
for (i = 0; i < n_volume_entries; ++i) for (i = 0; i < n_volume_entries; ++i)
sample->volume.values[i] = default_volume[i]; sample->volume.values[i] = default_volume[i];
sample->volume_is_set = TRUE; sample->volume_is_set = true;
} else { } else {
sample->volume_is_set = FALSE; sample->volume_is_set = false;
} }
dbus_sample = pa_dbusiface_sample_new(c, sample); dbus_sample = pa_dbusiface_sample_new(c, sample);
@ -1427,17 +1427,17 @@ finish:
pa_memblock_unref(chunk.memblock); pa_memblock_unref(chunk.memblock);
} }
static pa_bool_t contains_space(const char *string) { static bool contains_space(const char *string) {
const char *p; const char *p;
pa_assert(string); pa_assert(string);
for (p = string; *p; ++p) { for (p = string; *p; ++p) {
if (isspace(*p)) if (isspace(*p))
return TRUE; return true;
} }
return FALSE; return false;
} }
static void handle_load_module(DBusConnection *conn, DBusMessage *msg, void *userdata) { static void handle_load_module(DBusConnection *conn, DBusMessage *msg, void *userdata) {
@ -1530,7 +1530,7 @@ static void handle_exit(DBusConnection *conn, DBusMessage *msg, void *userdata)
pa_dbus_send_empty_reply(conn, msg); pa_dbus_send_empty_reply(conn, msg);
pa_core_exit(c->core, FALSE, 0); pa_core_exit(c->core, false, 0);
} }
static void handle_listen_for_signal(DBusConnection *conn, DBusMessage *msg, void *userdata) { static void handle_listen_for_signal(DBusConnection *conn, DBusMessage *msg, void *userdata) {

View file

@ -440,29 +440,29 @@ static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessag
} }
if (d->type == PA_DEVICE_TYPE_SINK) if (d->type == PA_DEVICE_TYPE_SINK)
pa_sink_set_volume(d->sink, &new_vol, TRUE, TRUE); pa_sink_set_volume(d->sink, &new_vol, true, true);
else else
pa_source_set_volume(d->source, &new_vol, TRUE, TRUE); pa_source_set_volume(d->source, &new_vol, true, true);
pa_dbus_send_empty_reply(conn, msg); pa_dbus_send_empty_reply(conn, msg);
} }
static void handle_get_has_flat_volume(DBusConnection *conn, DBusMessage *msg, void *userdata) { static void handle_get_has_flat_volume(DBusConnection *conn, DBusMessage *msg, void *userdata) {
pa_dbusiface_device *d = userdata; pa_dbusiface_device *d = userdata;
dbus_bool_t has_flat_volume = FALSE; dbus_bool_t has_flat_volume = false;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
pa_assert(d); pa_assert(d);
has_flat_volume = (d->type == PA_DEVICE_TYPE_SINK) ? (d->sink->flags & PA_SINK_FLAT_VOLUME) : FALSE; has_flat_volume = (d->type == PA_DEVICE_TYPE_SINK) ? (d->sink->flags & PA_SINK_FLAT_VOLUME) : false;
pa_dbus_send_basic_variant_reply(conn, msg, DBUS_TYPE_BOOLEAN, &has_flat_volume); pa_dbus_send_basic_variant_reply(conn, msg, DBUS_TYPE_BOOLEAN, &has_flat_volume);
} }
static void handle_get_has_convertible_to_decibel_volume(DBusConnection *conn, DBusMessage *msg, void *userdata) { static void handle_get_has_convertible_to_decibel_volume(DBusConnection *conn, DBusMessage *msg, void *userdata) {
pa_dbusiface_device *d = userdata; pa_dbusiface_device *d = userdata;
dbus_bool_t has_convertible_to_decibel_volume = FALSE; dbus_bool_t has_convertible_to_decibel_volume = false;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
@ -513,7 +513,7 @@ static void handle_get_mute(DBusConnection *conn, DBusMessage *msg, void *userda
static void handle_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, void *userdata) { static void handle_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, void *userdata) {
pa_dbusiface_device *d = userdata; pa_dbusiface_device *d = userdata;
dbus_bool_t mute = FALSE; dbus_bool_t mute = false;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
@ -523,16 +523,16 @@ static void handle_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMessageI
dbus_message_iter_get_basic(iter, &mute); dbus_message_iter_get_basic(iter, &mute);
if (d->type == PA_DEVICE_TYPE_SINK) if (d->type == PA_DEVICE_TYPE_SINK)
pa_sink_set_mute(d->sink, mute, TRUE); pa_sink_set_mute(d->sink, mute, true);
else else
pa_source_set_mute(d->source, mute, TRUE); pa_source_set_mute(d->source, mute, true);
pa_dbus_send_empty_reply(conn, msg); pa_dbus_send_empty_reply(conn, msg);
} }
static void handle_get_has_hardware_volume(DBusConnection *conn, DBusMessage *msg, void *userdata) { static void handle_get_has_hardware_volume(DBusConnection *conn, DBusMessage *msg, void *userdata) {
pa_dbusiface_device *d = userdata; pa_dbusiface_device *d = userdata;
dbus_bool_t has_hardware_volume = FALSE; dbus_bool_t has_hardware_volume = false;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
@ -547,7 +547,7 @@ static void handle_get_has_hardware_volume(DBusConnection *conn, DBusMessage *ms
static void handle_get_has_hardware_mute(DBusConnection *conn, DBusMessage *msg, void *userdata) { static void handle_get_has_hardware_mute(DBusConnection *conn, DBusMessage *msg, void *userdata) {
pa_dbusiface_device *d = userdata; pa_dbusiface_device *d = userdata;
dbus_bool_t has_hardware_mute = FALSE; dbus_bool_t has_hardware_mute = false;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
@ -577,7 +577,7 @@ static void handle_get_configured_latency(DBusConnection *conn, DBusMessage *msg
static void handle_get_has_dynamic_latency(DBusConnection *conn, DBusMessage *msg, void *userdata) { static void handle_get_has_dynamic_latency(DBusConnection *conn, DBusMessage *msg, void *userdata) {
pa_dbusiface_device *d = userdata; pa_dbusiface_device *d = userdata;
dbus_bool_t has_dynamic_latency = FALSE; dbus_bool_t has_dynamic_latency = false;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
@ -617,7 +617,7 @@ static void handle_get_latency(DBusConnection *conn, DBusMessage *msg, void *use
static void handle_get_is_hardware_device(DBusConnection *conn, DBusMessage *msg, void *userdata) { static void handle_get_is_hardware_device(DBusConnection *conn, DBusMessage *msg, void *userdata) {
pa_dbusiface_device *d = userdata; pa_dbusiface_device *d = userdata;
dbus_bool_t is_hardware_device = FALSE; dbus_bool_t is_hardware_device = false;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
@ -632,7 +632,7 @@ static void handle_get_is_hardware_device(DBusConnection *conn, DBusMessage *msg
static void handle_get_is_network_device(DBusConnection *conn, DBusMessage *msg, void *userdata) { static void handle_get_is_network_device(DBusConnection *conn, DBusMessage *msg, void *userdata) {
pa_dbusiface_device *d = userdata; pa_dbusiface_device *d = userdata;
dbus_bool_t is_network_device = FALSE; dbus_bool_t is_network_device = false;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
@ -753,13 +753,13 @@ static void handle_set_active_port(DBusConnection *conn, DBusMessage *msg, DBusM
} }
if (d->type == PA_DEVICE_TYPE_SINK) { if (d->type == PA_DEVICE_TYPE_SINK) {
if ((r = pa_sink_set_port(d->sink, pa_dbusiface_device_port_get_name(new_active), TRUE)) < 0) { if ((r = pa_sink_set_port(d->sink, pa_dbusiface_device_port_get_name(new_active), true)) < 0) {
pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED,
"Internal error in PulseAudio: pa_sink_set_port() failed with error code %i.", r); "Internal error in PulseAudio: pa_sink_set_port() failed with error code %i.", r);
return; return;
} }
} else { } else {
if ((r = pa_source_set_port(d->source, pa_dbusiface_device_port_get_name(new_active), TRUE)) < 0) { if ((r = pa_source_set_port(d->source, pa_dbusiface_device_port_get_name(new_active), true)) < 0) {
pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED,
"Internal error in PulseAudio: pa_source_set_port() failed with error code %i.", r); "Internal error in PulseAudio: pa_source_set_port() failed with error code %i.", r);
return; return;
@ -796,17 +796,17 @@ static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdat
pa_channel_map *channel_map = NULL; pa_channel_map *channel_map = NULL;
dbus_uint32_t channels[PA_CHANNELS_MAX]; dbus_uint32_t channels[PA_CHANNELS_MAX];
dbus_uint32_t volume[PA_CHANNELS_MAX]; dbus_uint32_t volume[PA_CHANNELS_MAX];
dbus_bool_t has_flat_volume = FALSE; dbus_bool_t has_flat_volume = false;
dbus_bool_t has_convertible_to_decibel_volume = FALSE; dbus_bool_t has_convertible_to_decibel_volume = false;
dbus_uint32_t base_volume = 0; dbus_uint32_t base_volume = 0;
dbus_uint32_t volume_steps = 0; dbus_uint32_t volume_steps = 0;
dbus_bool_t has_hardware_volume = FALSE; dbus_bool_t has_hardware_volume = false;
dbus_bool_t has_hardware_mute = FALSE; dbus_bool_t has_hardware_mute = false;
dbus_uint64_t configured_latency = 0; dbus_uint64_t configured_latency = 0;
dbus_bool_t has_dynamic_latency = FALSE; dbus_bool_t has_dynamic_latency = false;
dbus_uint64_t latency = 0; dbus_uint64_t latency = 0;
dbus_bool_t is_hardware_device = FALSE; dbus_bool_t is_hardware_device = false;
dbus_bool_t is_network_device = FALSE; dbus_bool_t is_network_device = false;
dbus_uint32_t state = 0; dbus_uint32_t state = 0;
const char **ports = NULL; const char **ports = NULL;
unsigned n_ports = 0; unsigned n_ports = 0;
@ -847,7 +847,7 @@ static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdat
sample_format = d->source->sample_spec.format; sample_format = d->source->sample_spec.format;
sample_rate = d->source->sample_spec.rate; sample_rate = d->source->sample_spec.rate;
channel_map = &d->source->channel_map; channel_map = &d->source->channel_map;
has_flat_volume = FALSE; has_flat_volume = false;
has_convertible_to_decibel_volume = d->source->flags & PA_SOURCE_DECIBEL_VOLUME; has_convertible_to_decibel_volume = d->source->flags & PA_SOURCE_DECIBEL_VOLUME;
base_volume = d->source->base_volume; base_volume = d->source->base_volume;
volume_steps = d->source->n_volume_steps; volume_steps = d->source->n_volume_steps;
@ -922,7 +922,7 @@ static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdat
static void handle_suspend(DBusConnection *conn, DBusMessage *msg, void *userdata) { static void handle_suspend(DBusConnection *conn, DBusMessage *msg, void *userdata) {
pa_dbusiface_device *d = userdata; pa_dbusiface_device *d = userdata;
dbus_bool_t suspend = FALSE; dbus_bool_t suspend = false;
pa_client *client; pa_client *client;
pa_assert(conn); pa_assert(conn);
@ -1074,7 +1074,7 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
pa_dbusiface_device *d = userdata; pa_dbusiface_device *d = userdata;
DBusMessage *signal_msg = NULL; DBusMessage *signal_msg = NULL;
const pa_cvolume *new_volume = NULL; const pa_cvolume *new_volume = NULL;
pa_bool_t new_mute = FALSE; bool new_mute = false;
pa_sink_state_t new_sink_state = 0; pa_sink_state_t new_sink_state = 0;
pa_source_state_t new_source_state = 0; pa_source_state_t new_source_state = 0;
pa_device_port *new_active_port = NULL; pa_device_port *new_active_port = NULL;
@ -1096,8 +1096,8 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
&& ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE))); && ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE)));
new_volume = (d->type == PA_DEVICE_TYPE_SINK) new_volume = (d->type == PA_DEVICE_TYPE_SINK)
? pa_sink_get_volume(d->sink, FALSE) ? pa_sink_get_volume(d->sink, false)
: pa_source_get_volume(d->source, FALSE); : pa_source_get_volume(d->source, false);
if (!pa_cvolume_equal(&d->volume, new_volume)) { if (!pa_cvolume_equal(&d->volume, new_volume)) {
dbus_uint32_t volume[PA_CHANNELS_MAX]; dbus_uint32_t volume[PA_CHANNELS_MAX];
@ -1120,7 +1120,7 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
signal_msg = NULL; signal_msg = NULL;
} }
new_mute = (d->type == PA_DEVICE_TYPE_SINK) ? pa_sink_get_mute(d->sink, FALSE) : pa_source_get_mute(d->source, FALSE); new_mute = (d->type == PA_DEVICE_TYPE_SINK) ? pa_sink_get_mute(d->sink, false) : pa_source_get_mute(d->source, false);
if (d->mute != new_mute) { if (d->mute != new_mute) {
d->mute = new_mute; d->mute = new_mute;
@ -1211,8 +1211,8 @@ pa_dbusiface_device *pa_dbusiface_device_new_sink(pa_dbusiface_core *core, pa_si
d->sink = pa_sink_ref(sink); d->sink = pa_sink_ref(sink);
d->type = PA_DEVICE_TYPE_SINK; d->type = PA_DEVICE_TYPE_SINK;
d->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, SINK_OBJECT_NAME, sink->index); d->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, SINK_OBJECT_NAME, sink->index);
d->volume = *pa_sink_get_volume(sink, FALSE); d->volume = *pa_sink_get_volume(sink, false);
d->mute = pa_sink_get_mute(sink, FALSE); d->mute = pa_sink_get_mute(sink, false);
d->sink_state = pa_sink_get_state(sink); d->sink_state = pa_sink_get_state(sink);
d->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); d->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
d->next_port_index = 0; d->next_port_index = 0;
@ -1245,8 +1245,8 @@ pa_dbusiface_device *pa_dbusiface_device_new_source(pa_dbusiface_core *core, pa_
d->source = pa_source_ref(source); d->source = pa_source_ref(source);
d->type = PA_DEVICE_TYPE_SOURCE; d->type = PA_DEVICE_TYPE_SOURCE;
d->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, SOURCE_OBJECT_NAME, source->index); d->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, SOURCE_OBJECT_NAME, source->index);
d->volume = *pa_source_get_volume(source, FALSE); d->volume = *pa_source_get_volume(source, false);
d->mute = pa_source_get_mute(source, FALSE); d->mute = pa_source_get_mute(source, false);
d->source_state = pa_source_get_state(source); d->source_state = pa_source_get_state(source);
d->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); d->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
d->next_port_index = 0; d->next_port_index = 0;

View file

@ -261,7 +261,7 @@ static void handle_unload(DBusConnection *conn, DBusMessage *msg, void *userdata
return; return;
} }
pa_module_unload_request(m->module, FALSE); pa_module_unload_request(m->module, false);
pa_dbus_send_empty_reply(conn, msg); pa_dbus_send_empty_reply(conn, msg);
} }

View file

@ -56,7 +56,7 @@ struct pa_dbusiface_stream {
dbus_bool_t mute; dbus_bool_t mute;
pa_proplist *proplist; pa_proplist *proplist;
pa_bool_t has_volume; bool has_volume;
pa_dbus_protocol *dbus_protocol; pa_dbus_protocol *dbus_protocol;
pa_subscription *subscription; pa_subscription *subscription;
@ -356,7 +356,7 @@ static void handle_get_volume(DBusConnection *conn, DBusMessage *msg, void *user
static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, void *userdata) { static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, void *userdata) {
pa_dbusiface_stream *s = userdata; pa_dbusiface_stream *s = userdata;
pa_bool_t volume_writable = TRUE; bool volume_writable = true;
DBusMessageIter array_iter; DBusMessageIter array_iter;
int stream_channels = 0; int stream_channels = 0;
dbus_uint32_t *volume = NULL; dbus_uint32_t *volume = NULL;
@ -369,7 +369,7 @@ static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessag
pa_assert(iter); pa_assert(iter);
pa_assert(s); pa_assert(s);
volume_writable = (s->type == STREAM_TYPE_PLAYBACK) ? s->sink_input->volume_writable : FALSE; volume_writable = (s->type == STREAM_TYPE_PLAYBACK) ? s->sink_input->volume_writable : false;
if (!s->has_volume || !volume_writable) { if (!s->has_volume || !volume_writable) {
char *str = stream_to_string(s); char *str = stream_to_string(s);
@ -405,7 +405,7 @@ static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessag
new_vol.values[i] = volume[i]; new_vol.values[i] = volume[i];
} }
pa_sink_input_set_volume(s->sink_input, &new_vol, TRUE, TRUE); pa_sink_input_set_volume(s->sink_input, &new_vol, true, true);
pa_dbus_send_empty_reply(conn, msg); pa_dbus_send_empty_reply(conn, msg);
} }
@ -427,7 +427,7 @@ static void handle_get_mute(DBusConnection *conn, DBusMessage *msg, void *userda
static void handle_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, void *userdata) { static void handle_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, void *userdata) {
pa_dbusiface_stream *s = userdata; pa_dbusiface_stream *s = userdata;
dbus_bool_t mute = FALSE; dbus_bool_t mute = false;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
@ -441,7 +441,7 @@ static void handle_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMessageI
return; return;
} }
pa_sink_input_set_mute(s->sink_input, mute, TRUE); pa_sink_input_set_mute(s->sink_input, mute, true);
pa_dbus_send_empty_reply(conn, msg); pa_dbus_send_empty_reply(conn, msg);
} }
@ -621,7 +621,7 @@ static void handle_move(DBusConnection *conn, DBusMessage *msg, void *userdata)
return; return;
} }
if (pa_sink_input_move_to(s->sink_input, sink, TRUE) < 0) { if (pa_sink_input_move_to(s->sink_input, sink, true) < 0) {
pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED,
"Moving playback stream %u to sink %s failed.", s->sink_input->index, sink->name); "Moving playback stream %u to sink %s failed.", s->sink_input->index, sink->name);
return; return;
@ -634,7 +634,7 @@ static void handle_move(DBusConnection *conn, DBusMessage *msg, void *userdata)
return; return;
} }
if (pa_source_output_move_to(s->source_output, source, TRUE) < 0) { if (pa_source_output_move_to(s->source_output, source, true) < 0) {
pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED,
"Moving record stream %u to source %s failed.", s->source_output->index, source->name); "Moving record stream %u to source %s failed.", s->source_output->index, source->name);
return; return;
@ -736,12 +736,12 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
} }
if (s->type == STREAM_TYPE_PLAYBACK) { if (s->type == STREAM_TYPE_PLAYBACK) {
pa_bool_t new_mute = FALSE; bool new_mute = false;
if (s->has_volume) { if (s->has_volume) {
pa_cvolume new_volume; pa_cvolume new_volume;
pa_sink_input_get_volume(s->sink_input, &new_volume, TRUE); pa_sink_input_get_volume(s->sink_input, &new_volume, true);
if (!pa_cvolume_equal(&s->volume, &new_volume)) { if (!pa_cvolume_equal(&s->volume, &new_volume)) {
dbus_uint32_t volume[PA_CHANNELS_MAX]; dbus_uint32_t volume[PA_CHANNELS_MAX];
@ -857,7 +857,7 @@ pa_dbusiface_stream *pa_dbusiface_stream_new_playback(pa_dbusiface_core *core, p
s->has_volume = pa_sink_input_is_volume_readable(sink_input); s->has_volume = pa_sink_input_is_volume_readable(sink_input);
if (s->has_volume) if (s->has_volume)
pa_sink_input_get_volume(sink_input, &s->volume, TRUE); pa_sink_input_get_volume(sink_input, &s->volume, true);
else else
pa_cvolume_init(&s->volume); pa_cvolume_init(&s->volume);
@ -889,9 +889,9 @@ pa_dbusiface_stream *pa_dbusiface_stream_new_record(pa_dbusiface_core *core, pa_
s->source = pa_source_ref(source_output->source); s->source = pa_source_ref(source_output->source);
s->sample_rate = source_output->sample_spec.rate; s->sample_rate = source_output->sample_spec.rate;
pa_cvolume_init(&s->volume); pa_cvolume_init(&s->volume);
s->mute = FALSE; s->mute = false;
s->proplist = pa_proplist_copy(source_output->proplist); s->proplist = pa_proplist_copy(source_output->proplist);
s->has_volume = FALSE; s->has_volume = false;
s->dbus_protocol = pa_dbus_protocol_get(source_output->core); s->dbus_protocol = pa_dbus_protocol_get(source_output->core);
s->subscription = pa_subscription_new(source_output->core, PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT, subscription_cb, s); s->subscription = pa_subscription_new(source_output->core, PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT, subscription_cb, s);
s->send_event_slot = pa_hook_connect(&source_output->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_SEND_EVENT], s->send_event_slot = pa_hook_connect(&source_output->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_SEND_EVENT],

View file

@ -50,7 +50,7 @@ PA_MODULE_USAGE(
"access=local|remote|local,remote " "access=local|remote|local,remote "
"tcp_port=<port number> " "tcp_port=<port number> "
"tcp_listen=<hostname>"); "tcp_listen=<hostname>");
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_AUTHOR("Tanu Kaskinen"); PA_MODULE_AUTHOR("Tanu Kaskinen");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
@ -64,8 +64,8 @@ struct connection;
struct userdata { struct userdata {
pa_module *module; pa_module *module;
pa_bool_t local_access; bool local_access;
pa_bool_t remote_access; bool remote_access;
uint32_t tcp_port; uint32_t tcp_port;
char *tcp_listen; char *tcp_listen;
@ -152,7 +152,7 @@ static void client_send_event_cb(pa_client *c, const char *name, pa_proplist *da
static dbus_bool_t user_check_cb(DBusConnection *connection, unsigned long uid, void *data) { static dbus_bool_t user_check_cb(DBusConnection *connection, unsigned long uid, void *data) {
pa_log_debug("Allowing connection by user %lu.", uid); pa_log_debug("Allowing connection by user %lu.", uid);
return TRUE; return true;
} }
static DBusHandlerResult disconnection_filter_cb(DBusConnection *connection, DBusMessage *message, void *user_data) { static DBusHandlerResult disconnection_filter_cb(DBusConnection *connection, DBusMessage *message, void *user_data) {
@ -198,12 +198,12 @@ static void connection_new_cb(DBusServer *dbus_server, DBusConnection *new_conne
/* FIXME: Here we allow anyone from anywhere to access the server, /* FIXME: Here we allow anyone from anywhere to access the server,
* anonymously. Access control should be configurable. */ * anonymously. Access control should be configurable. */
dbus_connection_set_unix_user_function(new_connection, user_check_cb, NULL, NULL); dbus_connection_set_unix_user_function(new_connection, user_check_cb, NULL, NULL);
dbus_connection_set_allow_anonymous(new_connection, TRUE); dbus_connection_set_allow_anonymous(new_connection, true);
} }
c = pa_xnew(struct connection, 1); c = pa_xnew(struct connection, 1);
c->server = s; c->server = s;
c->wrap_conn = pa_dbus_wrap_connection_new_from_existing(s->userdata->module->core->mainloop, TRUE, new_connection); c->wrap_conn = pa_dbus_wrap_connection_new_from_existing(s->userdata->module->core->mainloop, true, new_connection);
c->client = client; c->client = client;
c->client->kill = client_kill_cb; c->client->kill = client_kill_cb;
@ -302,7 +302,7 @@ static dbus_bool_t watch_add_cb(DBusWatch *watch, void *data) {
dbus_watch_set_data(watch, ev, NULL); dbus_watch_set_data(watch, ev, NULL);
return TRUE; return true;
} }
/* Called by D-Bus when a D-Bus fd watch event is removed. */ /* Called by D-Bus when a D-Bus fd watch event is removed. */
@ -342,7 +342,7 @@ static dbus_bool_t timeout_add_cb(DBusTimeout *timeout, void *data) {
pa_assert(s); pa_assert(s);
if (!dbus_timeout_get_enabled(timeout)) if (!dbus_timeout_get_enabled(timeout))
return FALSE; return false;
mainloop = s->userdata->module->core->mainloop; mainloop = s->userdata->module->core->mainloop;
@ -353,7 +353,7 @@ static dbus_bool_t timeout_add_cb(DBusTimeout *timeout, void *data) {
dbus_timeout_set_data(timeout, ev, NULL); dbus_timeout_set_data(timeout, ev, NULL);
return TRUE; return true;
} }
/* Called by D-Bus when a D-Bus timer event is removed. */ /* Called by D-Bus when a D-Bus timer event is removed. */
@ -482,7 +482,7 @@ static struct server *start_tcp_server(struct userdata *u) {
return s; return s;
} }
static int get_access_arg(pa_modargs *ma, pa_bool_t *local_access, pa_bool_t *remote_access) { static int get_access_arg(pa_modargs *ma, bool *local_access, bool *remote_access) {
const char *value = NULL; const char *value = NULL;
pa_assert(ma); pa_assert(ma);
@ -493,14 +493,14 @@ static int get_access_arg(pa_modargs *ma, pa_bool_t *local_access, pa_bool_t *re
return 0; return 0;
if (pa_streq(value, "local")) { if (pa_streq(value, "local")) {
*local_access = TRUE; *local_access = true;
*remote_access = FALSE; *remote_access = false;
} else if (pa_streq(value, "remote")) { } else if (pa_streq(value, "remote")) {
*local_access = FALSE; *local_access = false;
*remote_access = TRUE; *remote_access = true;
} else if (pa_streq(value, "local,remote")) { } else if (pa_streq(value, "local,remote")) {
*local_access = TRUE; *local_access = true;
*remote_access = TRUE; *remote_access = true;
} else } else
return -1; return -1;
@ -536,8 +536,8 @@ int pa__init(pa_module *m) {
m->userdata = u = pa_xnew0(struct userdata, 1); m->userdata = u = pa_xnew0(struct userdata, 1);
u->module = m; u->module = m;
u->local_access = TRUE; u->local_access = true;
u->remote_access = FALSE; u->remote_access = false;
u->tcp_port = PA_DBUS_DEFAULT_PORT; u->tcp_port = PA_DBUS_DEFAULT_PORT;
if (get_access_arg(ma, &u->local_access, &u->remote_access) < 0) { if (get_access_arg(ma, &u->local_access, &u->remote_access) < 0) {

View file

@ -56,7 +56,7 @@ static void pa_adrian_ec_fixate_spec(pa_sample_spec *rec_ss, pa_channel_map *rec
*rec_map = *out_map; *rec_map = *out_map;
} }
pa_bool_t pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec, bool pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *rec_ss, pa_channel_map *rec_map,
pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *play_ss, pa_channel_map *play_map,
pa_sample_spec *out_ss, pa_channel_map *out_map, pa_sample_spec *out_ss, pa_channel_map *out_map,
@ -93,12 +93,12 @@ pa_bool_t pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec,
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) {

View file

@ -68,7 +68,7 @@ struct pa_echo_canceller_params {
void *apm; void *apm;
uint32_t blocksize; uint32_t blocksize;
pa_sample_spec sample_spec; pa_sample_spec sample_spec;
pa_bool_t agc; bool agc;
} webrtc; } webrtc;
#endif #endif
/* each canceller-specific structure goes here */ /* each canceller-specific structure goes here */
@ -76,14 +76,14 @@ struct pa_echo_canceller_params {
/* Set this if canceller can do drift compensation. Also see set_drift() /* Set this if canceller can do drift compensation. Also see set_drift()
* below */ * below */
pa_bool_t drift_compensation; bool drift_compensation;
}; };
typedef struct pa_echo_canceller pa_echo_canceller; typedef struct pa_echo_canceller pa_echo_canceller;
struct pa_echo_canceller { struct pa_echo_canceller {
/* Initialise canceller engine. */ /* Initialise canceller engine. */
pa_bool_t (*init) (pa_core *c, bool (*init) (pa_core *c,
pa_echo_canceller *ec, pa_echo_canceller *ec,
pa_sample_spec *rec_ss, pa_sample_spec *rec_ss,
pa_channel_map *rec_map, pa_channel_map *rec_map,
@ -138,7 +138,7 @@ void pa_echo_canceller_set_capture_volume(pa_echo_canceller *ec, pa_cvolume *v);
uint32_t pa_echo_canceller_blocksize_power2(unsigned rate, unsigned ms); uint32_t pa_echo_canceller_blocksize_power2(unsigned rate, unsigned ms);
/* Null canceller functions */ /* Null canceller functions */
pa_bool_t pa_null_ec_init(pa_core *c, pa_echo_canceller *ec, bool pa_null_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *rec_ss, pa_channel_map *rec_map,
pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *play_ss, pa_channel_map *play_map,
pa_sample_spec *out_ss, pa_channel_map *out_map, pa_sample_spec *out_ss, pa_channel_map *out_map,
@ -148,7 +148,7 @@ void pa_null_ec_done(pa_echo_canceller *ec);
#ifdef HAVE_SPEEX #ifdef HAVE_SPEEX
/* Speex canceller functions */ /* Speex canceller functions */
pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec, bool pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *rec_ss, pa_channel_map *rec_map,
pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *play_ss, pa_channel_map *play_map,
pa_sample_spec *out_ss, pa_channel_map *out_map, pa_sample_spec *out_ss, pa_channel_map *out_map,
@ -159,7 +159,7 @@ void pa_speex_ec_done(pa_echo_canceller *ec);
#ifdef HAVE_ADRIAN_EC #ifdef HAVE_ADRIAN_EC
/* Adrian Andre's echo canceller */ /* Adrian Andre's echo canceller */
pa_bool_t pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec, bool pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *rec_ss, pa_channel_map *rec_map,
pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *play_ss, pa_channel_map *play_map,
pa_sample_spec *out_ss, pa_channel_map *out_map, pa_sample_spec *out_ss, pa_channel_map *out_map,
@ -171,7 +171,7 @@ void pa_adrian_ec_done(pa_echo_canceller *ec);
#ifdef HAVE_WEBRTC #ifdef HAVE_WEBRTC
/* WebRTC canceller functions */ /* WebRTC canceller functions */
PA_C_DECL_BEGIN PA_C_DECL_BEGIN
pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec, bool pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *rec_ss, pa_channel_map *rec_map,
pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *play_ss, pa_channel_map *play_map,
pa_sample_spec *out_ss, pa_channel_map *out_map, pa_sample_spec *out_ss, pa_channel_map *out_map,

View file

@ -58,7 +58,7 @@
PA_MODULE_AUTHOR("Wim Taymans"); PA_MODULE_AUTHOR("Wim Taymans");
PA_MODULE_DESCRIPTION("Echo Cancellation"); PA_MODULE_DESCRIPTION("Echo Cancellation");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
_("source_name=<name for the source> " _("source_name=<name for the source> "
"source_properties=<properties for the source> " "source_properties=<properties for the source> "
@ -140,8 +140,8 @@ static const pa_echo_canceller ec_table[] = {
#define DEFAULT_CHANNELS 1 #define DEFAULT_CHANNELS 1
#define DEFAULT_ADJUST_TIME_USEC (1*PA_USEC_PER_SEC) #define DEFAULT_ADJUST_TIME_USEC (1*PA_USEC_PER_SEC)
#define DEFAULT_ADJUST_TOLERANCE (5*PA_USEC_PER_MSEC) #define DEFAULT_ADJUST_TOLERANCE (5*PA_USEC_PER_MSEC)
#define DEFAULT_SAVE_AEC FALSE #define DEFAULT_SAVE_AEC false
#define DEFAULT_AUTOLOADED FALSE #define DEFAULT_AUTOLOADED false
#define MEMBLOCKQ_MAXLENGTH (16*1024*1024) #define MEMBLOCKQ_MAXLENGTH (16*1024*1024)
@ -206,29 +206,29 @@ struct userdata {
pa_core *core; pa_core *core;
pa_module *module; pa_module *module;
pa_bool_t autoloaded; bool autoloaded;
pa_bool_t dead; bool dead;
pa_bool_t save_aec; bool save_aec;
pa_echo_canceller *ec; pa_echo_canceller *ec;
uint32_t source_output_blocksize; uint32_t source_output_blocksize;
uint32_t source_blocksize; uint32_t source_blocksize;
uint32_t sink_blocksize; uint32_t sink_blocksize;
pa_bool_t need_realign; bool need_realign;
/* to wakeup the source I/O thread */ /* to wakeup the source I/O thread */
pa_asyncmsgq *asyncmsgq; pa_asyncmsgq *asyncmsgq;
pa_rtpoll_item *rtpoll_item_read, *rtpoll_item_write; pa_rtpoll_item *rtpoll_item_read, *rtpoll_item_write;
pa_source *source; pa_source *source;
pa_bool_t source_auto_desc; bool source_auto_desc;
pa_source_output *source_output; pa_source_output *source_output;
pa_memblockq *source_memblockq; /* echo canceler needs fixed sized chunks */ pa_memblockq *source_memblockq; /* echo canceler needs fixed sized chunks */
size_t source_skip; size_t source_skip;
pa_sink *sink; pa_sink *sink;
pa_bool_t sink_auto_desc; bool sink_auto_desc;
pa_sink_input *sink_input; pa_sink_input *sink_input;
pa_memblockq *sink_memblockq; pa_memblockq *sink_memblockq;
int64_t send_counter; /* updated in sink IO thread */ int64_t send_counter; /* updated in sink IO thread */
@ -250,7 +250,7 @@ struct userdata {
FILE *canceled_file; FILE *canceled_file;
FILE *drift_file; FILE *drift_file;
pa_bool_t use_volume_sharing; bool use_volume_sharing;
struct { struct {
pa_cvolume current_volume; pa_cvolume current_volume;
@ -479,9 +479,9 @@ static int source_set_state_cb(pa_source *s, pa_source_state_t state) {
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) {
pa_source_output_cork(u->source_output, TRUE); pa_source_output_cork(u->source_output, true);
} }
return 0; return 0;
@ -504,9 +504,9 @@ static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) {
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) {
pa_sink_input_cork(u->sink_input, TRUE); pa_sink_input_cork(u->sink_input, true);
} }
return 0; return 0;
@ -565,7 +565,7 @@ static void sink_request_rewind_cb(pa_sink *s) {
/* Just hand this one over to the master sink */ /* Just hand this one over to the master sink */
pa_sink_input_request_rewind(u->sink_input, pa_sink_input_request_rewind(u->sink_input,
s->thread_info.rewind_nbytes, TRUE, FALSE, FALSE); s->thread_info.rewind_nbytes, true, false, false);
} }
/* Called from main context */ /* Called from main context */
@ -579,7 +579,7 @@ static void source_set_volume_cb(pa_source *s) {
!PA_SOURCE_OUTPUT_IS_LINKED(pa_source_output_get_state(u->source_output))) !PA_SOURCE_OUTPUT_IS_LINKED(pa_source_output_get_state(u->source_output)))
return; return;
pa_source_output_set_volume(u->source_output, &s->real_volume, s->save_volume, TRUE); pa_source_output_set_volume(u->source_output, &s->real_volume, s->save_volume, true);
} }
/* Called from main context */ /* Called from main context */
@ -593,7 +593,7 @@ static void sink_set_volume_cb(pa_sink *s) {
!PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input))) !PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input)))
return; return;
pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, TRUE); pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, true);
} }
/* Called from main context. */ /* Called from main context. */
@ -608,7 +608,7 @@ static void source_get_volume_cb(pa_source *s) {
!PA_SOURCE_OUTPUT_IS_LINKED(pa_source_output_get_state(u->source_output))) !PA_SOURCE_OUTPUT_IS_LINKED(pa_source_output_get_state(u->source_output)))
return; return;
pa_source_output_get_volume(u->source_output, &v, TRUE); pa_source_output_get_volume(u->source_output, &v, true);
if (pa_cvolume_equal(&s->real_volume, &v)) if (pa_cvolume_equal(&s->real_volume, &v))
/* no change */ /* no change */
@ -1003,7 +1003,7 @@ static void source_output_process_rewind_cb(pa_source_output *o, size_t nbytes)
pa_memblockq_rewind(u->sink_memblockq, nbytes); pa_memblockq_rewind(u->sink_memblockq, nbytes);
/* manipulate write index */ /* manipulate write index */
pa_memblockq_seek(u->source_memblockq, -nbytes, PA_SEEK_RELATIVE, TRUE); pa_memblockq_seek(u->source_memblockq, -nbytes, PA_SEEK_RELATIVE, true);
pa_log_debug("Source rewind (%lld) %lld", (long long) nbytes, pa_log_debug("Source rewind (%lld) %lld", (long long) nbytes,
(long long) pa_memblockq_get_length (u->source_memblockq)); (long long) pa_memblockq_get_length (u->source_memblockq));
@ -1058,7 +1058,7 @@ static int source_output_process_msg_cb(pa_msgobject *obj, int code, void *data,
if (u->source_output->source->thread_info.state == PA_SOURCE_RUNNING) if (u->source_output->source->thread_info.state == PA_SOURCE_RUNNING)
pa_memblockq_push_align(u->sink_memblockq, chunk); pa_memblockq_push_align(u->sink_memblockq, chunk);
else else
pa_memblockq_flush_write(u->sink_memblockq, TRUE); pa_memblockq_flush_write(u->sink_memblockq, true);
u->recv_counter += (int64_t) chunk->length; u->recv_counter += (int64_t) chunk->length;
@ -1069,9 +1069,9 @@ static int source_output_process_msg_cb(pa_msgobject *obj, int code, void *data,
/* manipulate write index, never go past what we have */ /* manipulate write index, never go past what we have */
if (PA_SOURCE_IS_OPENED(u->source_output->source->thread_info.state)) if (PA_SOURCE_IS_OPENED(u->source_output->source->thread_info.state))
pa_memblockq_seek(u->sink_memblockq, -offset, PA_SEEK_RELATIVE, TRUE); pa_memblockq_seek(u->sink_memblockq, -offset, PA_SEEK_RELATIVE, true);
else else
pa_memblockq_flush_write(u->sink_memblockq, TRUE); pa_memblockq_flush_write(u->sink_memblockq, true);
pa_log_debug("Sink rewind (%lld)", (long long) offset); pa_log_debug("Sink rewind (%lld)", (long long) offset);
@ -1363,7 +1363,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
if (PA_SINK_INPUT_IS_LINKED(state) && if (PA_SINK_INPUT_IS_LINKED(state) &&
i->thread_info.state == PA_SINK_INPUT_INIT) { i->thread_info.state == PA_SINK_INPUT_INIT) {
pa_log_debug("Requesting rewind due to state change."); pa_log_debug("Requesting rewind due to state change.");
pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); pa_sink_input_request_rewind(i, 0, false, true, true);
} }
} }
@ -1375,7 +1375,7 @@ static void source_output_kill_cb(pa_source_output *o) {
pa_assert_ctl_context(); pa_assert_ctl_context();
pa_assert_se(u = o->userdata); pa_assert_se(u = o->userdata);
u->dead = TRUE; u->dead = true;
/* The order here matters! We first kill the source output, followed /* The order here matters! We first kill the source output, followed
* by the source. That means the source callbacks must be protected * by the source. That means the source callbacks must be protected
@ -1391,7 +1391,7 @@ static void source_output_kill_cb(pa_source_output *o) {
pa_log_debug("Source output kill %d", o->index); pa_log_debug("Source output kill %d", o->index);
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from main context */ /* Called from main context */
@ -1401,7 +1401,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
pa_assert_se(u = i->userdata); pa_assert_se(u = i->userdata);
u->dead = TRUE; u->dead = true;
/* The order here matters! We first kill the sink input, followed /* The order here matters! We first kill the sink input, followed
* by the sink. That means the sink callbacks must be protected * by the sink. That means the sink callbacks must be protected
@ -1417,11 +1417,11 @@ static void sink_input_kill_cb(pa_sink_input *i) {
pa_log_debug("Sink input kill %d", i->index); pa_log_debug("Sink input kill %d", i->index);
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from main context. */ /* Called from main context. */
static pa_bool_t source_output_may_move_to_cb(pa_source_output *o, pa_source *dest) { static bool source_output_may_move_to_cb(pa_source_output *o, pa_source *dest) {
struct userdata *u; struct userdata *u;
pa_source_output_assert_ref(o); pa_source_output_assert_ref(o);
@ -1429,20 +1429,20 @@ static pa_bool_t source_output_may_move_to_cb(pa_source_output *o, pa_source *de
pa_assert_se(u = o->userdata); pa_assert_se(u = o->userdata);
if (u->dead || u->autoloaded) if (u->dead || u->autoloaded)
return FALSE; return false;
return (u->source != dest) && (u->sink != dest->monitor_of); return (u->source != dest) && (u->sink != dest->monitor_of);
} }
/* Called from main context */ /* Called from main context */
static pa_bool_t sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) { static bool sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) {
struct userdata *u; struct userdata *u;
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
pa_assert_se(u = i->userdata); pa_assert_se(u = i->userdata);
if (u->dead || u->autoloaded) if (u->dead || u->autoloaded)
return FALSE; return false;
return u->sink != dest; return u->sink != dest;
} }
@ -1539,9 +1539,9 @@ static int canceller_process_msg_cb(pa_msgobject *o, int code, void *userdata, i
pa_cvolume *v = (pa_cvolume *) userdata; pa_cvolume *v = (pa_cvolume *) userdata;
if (u->use_volume_sharing) if (u->use_volume_sharing)
pa_source_set_volume(u->source, v, TRUE, FALSE); pa_source_set_volume(u->source, v, true, false);
else else
pa_source_output_set_volume(u->source_output, v, FALSE, TRUE); pa_source_output_set_volume(u->source_output, v, false, true);
break; break;
} }
@ -1698,9 +1698,9 @@ int pa__init(pa_module*m) {
u->core = m->core; u->core = m->core;
u->module = m; u->module = m;
m->userdata = u; m->userdata = u;
u->dead = FALSE; u->dead = false;
u->use_volume_sharing = TRUE; u->use_volume_sharing = true;
if (pa_modargs_get_value_boolean(ma, "use_volume_sharing", &u->use_volume_sharing) < 0) { if (pa_modargs_get_value_boolean(ma, "use_volume_sharing", &u->use_volume_sharing) < 0) {
pa_log("use_volume_sharing= expects a boolean argument"); pa_log("use_volume_sharing= expects a boolean argument");
goto fail; goto fail;
@ -1744,7 +1744,7 @@ int pa__init(pa_module*m) {
goto fail; goto fail;
u->asyncmsgq = pa_asyncmsgq_new(0); u->asyncmsgq = pa_asyncmsgq_new(0);
u->need_realign = TRUE; u->need_realign = true;
source_output_ss = source_ss; source_output_ss = source_ss;
source_output_map = source_map; source_output_map = source_map;
@ -1815,7 +1815,7 @@ int pa__init(pa_module*m) {
if (!u->use_volume_sharing) { if (!u->use_volume_sharing) {
pa_source_set_get_volume_callback(u->source, source_get_volume_cb); pa_source_set_get_volume_callback(u->source, source_get_volume_cb);
pa_source_set_set_volume_callback(u->source, source_set_volume_cb); pa_source_set_set_volume_callback(u->source, source_set_volume_cb);
pa_source_enable_decibel_volume(u->source, TRUE); pa_source_enable_decibel_volume(u->source, true);
} }
u->source->userdata = u; u->source->userdata = u;
@ -1865,7 +1865,7 @@ int pa__init(pa_module*m) {
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb); pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
if (!u->use_volume_sharing) { if (!u->use_volume_sharing) {
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb); pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
pa_sink_enable_decibel_volume(u->sink, TRUE); pa_sink_enable_decibel_volume(u->sink, true);
} }
u->sink->userdata = u; u->sink->userdata = u;
@ -1875,7 +1875,7 @@ int pa__init(pa_module*m) {
pa_source_output_new_data_init(&source_output_data); pa_source_output_new_data_init(&source_output_data);
source_output_data.driver = __FILE__; source_output_data.driver = __FILE__;
source_output_data.module = m; source_output_data.module = m;
pa_source_output_new_data_set_source(&source_output_data, source_master, FALSE); pa_source_output_new_data_set_source(&source_output_data, source_master, false);
source_output_data.destination_source = u->source; source_output_data.destination_source = u->source;
pa_proplist_sets(source_output_data.proplist, PA_PROP_MEDIA_NAME, "Echo-Cancel Source Stream"); pa_proplist_sets(source_output_data.proplist, PA_PROP_MEDIA_NAME, "Echo-Cancel Source Stream");
@ -1910,7 +1910,7 @@ int pa__init(pa_module*m) {
pa_sink_input_new_data_init(&sink_input_data); pa_sink_input_new_data_init(&sink_input_data);
sink_input_data.driver = __FILE__; sink_input_data.driver = __FILE__;
sink_input_data.module = m; sink_input_data.module = m;
pa_sink_input_new_data_set_sink(&sink_input_data, sink_master, FALSE); pa_sink_input_new_data_set_sink(&sink_input_data, sink_master, false);
sink_input_data.origin_sink = u->sink; sink_input_data.origin_sink = u->sink;
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Echo-Cancel Sink Stream"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Echo-Cancel Sink Stream");
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
@ -2029,7 +2029,7 @@ void pa__done(pa_module*m) {
if (!(u = m->userdata)) if (!(u = m->userdata))
return; return;
u->dead = TRUE; u->dead = true;
/* See comments in source_output_kill_cb() above regarding /* See comments in source_output_kill_cb() above regarding
* destruction order! */ * destruction order! */

View file

@ -25,7 +25,7 @@ PA_C_DECL_BEGIN
#include "echo-cancel.h" #include "echo-cancel.h"
PA_C_DECL_END PA_C_DECL_END
pa_bool_t pa_null_ec_init(pa_core *c, pa_echo_canceller *ec, bool pa_null_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *rec_ss, pa_channel_map *rec_map,
pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *play_ss, pa_channel_map *play_map,
pa_sample_spec *out_ss, pa_channel_map *out_map, pa_sample_spec *out_ss, pa_channel_map *out_map,
@ -43,7 +43,7 @@ pa_bool_t pa_null_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec_snprint(strss_source, sizeof(strss_source), out_ss), pa_sample_spec_snprint(strss_source, sizeof(strss_source), out_ss),
pa_sample_spec_snprint(strss_sink, sizeof(strss_sink), play_ss)); pa_sample_spec_snprint(strss_sink, sizeof(strss_sink), play_ss));
return TRUE; return true;
} }
void pa_null_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) { void pa_null_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) {

View file

@ -33,9 +33,9 @@
#define DEFAULT_FRAME_SIZE_MS 20 #define DEFAULT_FRAME_SIZE_MS 20
/* should be between 100-500 ms */ /* should be between 100-500 ms */
#define DEFAULT_FILTER_SIZE_MS 200 #define DEFAULT_FILTER_SIZE_MS 200
#define DEFAULT_AGC_ENABLED TRUE #define DEFAULT_AGC_ENABLED true
#define DEFAULT_DENOISE_ENABLED TRUE #define DEFAULT_DENOISE_ENABLED true
#define DEFAULT_ECHO_SUPPRESS_ENABLED TRUE #define DEFAULT_ECHO_SUPPRESS_ENABLED true
#define DEFAULT_ECHO_SUPPRESS_ATTENUATION 0 #define DEFAULT_ECHO_SUPPRESS_ATTENUATION 0
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -60,10 +60,10 @@ static void pa_speex_ec_fixate_spec(pa_sample_spec *rec_ss, pa_channel_map *rec_
*rec_map = *out_map; *rec_map = *out_map;
} }
static pa_bool_t pa_speex_ec_preprocessor_init(pa_echo_canceller *ec, pa_sample_spec *out_ss, uint32_t nframes, pa_modargs *ma) { static bool pa_speex_ec_preprocessor_init(pa_echo_canceller *ec, pa_sample_spec *out_ss, uint32_t nframes, pa_modargs *ma) {
pa_bool_t agc; bool agc;
pa_bool_t denoise; bool denoise;
pa_bool_t echo_suppress; bool echo_suppress;
int32_t echo_suppress_attenuation; int32_t echo_suppress_attenuation;
int32_t echo_suppress_attenuation_active; int32_t echo_suppress_attenuation_active;
@ -140,13 +140,13 @@ static pa_bool_t pa_speex_ec_preprocessor_init(pa_echo_canceller *ec, pa_sample_
} else } else
pa_log_info("All preprocessing options are disabled"); pa_log_info("All preprocessing options are disabled");
return TRUE; return true;
fail: fail:
return FALSE; return false;
} }
pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec, bool pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *rec_ss, pa_channel_map *rec_map,
pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *play_ss, pa_channel_map *play_map,
pa_sample_spec *out_ss, pa_channel_map *out_map, pa_sample_spec *out_ss, pa_channel_map *out_map,
@ -189,7 +189,7 @@ pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec,
goto fail; goto fail;
pa_modargs_free(ma); pa_modargs_free(ma);
return TRUE; return true;
fail: fail:
if (ma) if (ma)
@ -202,7 +202,7 @@ fail:
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;
} }
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) {

View file

@ -40,14 +40,14 @@ PA_C_DECL_END
#define BLOCK_SIZE_US 10000 #define BLOCK_SIZE_US 10000
#define DEFAULT_HIGH_PASS_FILTER TRUE #define DEFAULT_HIGH_PASS_FILTER true
#define DEFAULT_NOISE_SUPPRESSION TRUE #define DEFAULT_NOISE_SUPPRESSION true
#define DEFAULT_ANALOG_GAIN_CONTROL TRUE #define DEFAULT_ANALOG_GAIN_CONTROL true
#define DEFAULT_DIGITAL_GAIN_CONTROL FALSE #define DEFAULT_DIGITAL_GAIN_CONTROL false
#define DEFAULT_MOBILE FALSE #define DEFAULT_MOBILE false
#define DEFAULT_ROUTING_MODE "speakerphone" #define DEFAULT_ROUTING_MODE "speakerphone"
#define DEFAULT_COMFORT_NOISE TRUE #define DEFAULT_COMFORT_NOISE true
#define DEFAULT_DRIFT_COMPENSATION FALSE #define DEFAULT_DRIFT_COMPENSATION false
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"high_pass_filter", "high_pass_filter",
@ -76,13 +76,13 @@ static int routing_mode_from_string(const char *rmode) {
return -1; return -1;
} }
pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec, bool pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *rec_ss, pa_channel_map *rec_map,
pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *play_ss, pa_channel_map *play_map,
pa_sample_spec *out_ss, pa_channel_map *out_map, pa_sample_spec *out_ss, pa_channel_map *out_map,
uint32_t *nframes, const char *args) { uint32_t *nframes, const char *args) {
webrtc::AudioProcessing *apm = NULL; webrtc::AudioProcessing *apm = NULL;
pa_bool_t hpf, ns, agc, dgc, mobile, cn; bool hpf, ns, agc, dgc, mobile, cn;
int rm = -1; int rm = -1;
pa_modargs *ma; pa_modargs *ma;
@ -109,7 +109,7 @@ pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
goto fail; goto fail;
} }
dgc = agc ? FALSE : DEFAULT_DIGITAL_GAIN_CONTROL; dgc = agc ? false : DEFAULT_DIGITAL_GAIN_CONTROL;
if (pa_modargs_get_value_boolean(ma, "digital_gain_control", &dgc) < 0) { if (pa_modargs_get_value_boolean(ma, "digital_gain_control", &dgc) < 0) {
pa_log("Failed to parse digital_gain_control value"); pa_log("Failed to parse digital_gain_control value");
goto fail; goto fail;
@ -197,17 +197,17 @@ pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
if (mobile && rm <= webrtc::EchoControlMobile::kEarpiece) { if (mobile && rm <= webrtc::EchoControlMobile::kEarpiece) {
/* Maybe this should be a knob, but we've got a lot of knobs already */ /* Maybe this should be a knob, but we've got a lot of knobs already */
apm->gain_control()->set_mode(webrtc::GainControl::kFixedDigital); apm->gain_control()->set_mode(webrtc::GainControl::kFixedDigital);
ec->params.priv.webrtc.agc = FALSE; ec->params.priv.webrtc.agc = false;
} else if (dgc) { } else if (dgc) {
apm->gain_control()->set_mode(webrtc::GainControl::kAdaptiveDigital); apm->gain_control()->set_mode(webrtc::GainControl::kAdaptiveDigital);
ec->params.priv.webrtc.agc = FALSE; ec->params.priv.webrtc.agc = false;
} else { } else {
apm->gain_control()->set_mode(webrtc::GainControl::kAdaptiveAnalog); apm->gain_control()->set_mode(webrtc::GainControl::kAdaptiveAnalog);
if (apm->gain_control()->set_analog_level_limits(0, PA_VOLUME_NORM-1) != apm->kNoError) { if (apm->gain_control()->set_analog_level_limits(0, PA_VOLUME_NORM-1) != apm->kNoError) {
pa_log("Failed to initialise AGC"); pa_log("Failed to initialise AGC");
goto fail; goto fail;
} }
ec->params.priv.webrtc.agc = TRUE; ec->params.priv.webrtc.agc = true;
} }
apm->gain_control()->Enable(true); apm->gain_control()->Enable(true);
@ -221,7 +221,7 @@ pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
*nframes = ec->params.priv.webrtc.blocksize / pa_frame_size(out_ss); *nframes = ec->params.priv.webrtc.blocksize / pa_frame_size(out_ss);
pa_modargs_free(ma); pa_modargs_free(ma);
return TRUE; return true;
fail: fail:
if (ma) if (ma)
@ -229,7 +229,7 @@ fail:
if (apm) if (apm)
webrtc::AudioProcessing::Destroy(apm); webrtc::AudioProcessing::Destroy(apm);
return FALSE; return false;
} }
void pa_webrtc_ec_play(pa_echo_canceller *ec, const uint8_t *play) { void pa_webrtc_ec_play(pa_echo_canceller *ec, const uint8_t *play) {

View file

@ -45,7 +45,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("GConf Adapter"); PA_MODULE_DESCRIPTION("GConf Adapter");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
#define MAX_MODULES 10 #define MAX_MODULES 10
#define BUF_MAX 2048 #define BUF_MAX 2048
@ -143,7 +143,7 @@ static void unload_one_module(struct module_info *m, unsigned i) {
return; return;
pa_log_debug("Unloading module #%i", m->items[i].index); pa_log_debug("Unloading module #%i", m->items[i].index);
pa_module_unload_by_index(u->core, m->items[i].index, TRUE); pa_module_unload_by_index(u->core, m->items[i].index, true);
m->items[i].index = PA_INVALID_INDEX; m->items[i].index = PA_INVALID_INDEX;
pa_xfree(m->items[i].name); pa_xfree(m->items[i].name);
pa_xfree(m->items[i].args); pa_xfree(m->items[i].args);
@ -166,7 +166,7 @@ static void load_module(
unsigned i, unsigned i,
const char *name, const char *name,
const char *args, const char *args,
pa_bool_t is_new) { bool is_new) {
struct userdata *u; struct userdata *u;
pa_module *mod; pa_module *mod;
@ -324,7 +324,7 @@ static void io_event_cb(
u->io_event = NULL; u->io_event = NULL;
} }
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
} }

View file

@ -60,7 +60,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("JACK Sink"); PA_MODULE_DESCRIPTION("JACK Sink");
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
@ -94,7 +94,7 @@ struct userdata {
jack_nframes_t frames_in_buffer; jack_nframes_t frames_in_buffer;
jack_nframes_t saved_frame_time; jack_nframes_t saved_frame_time;
pa_bool_t saved_frame_time_valid; bool saved_frame_time_valid;
}; };
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -154,7 +154,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
u->frames_in_buffer = (jack_nframes_t) offset; u->frames_in_buffer = (jack_nframes_t) offset;
u->saved_frame_time = * (jack_nframes_t*) data; u->saved_frame_time = * (jack_nframes_t*) data;
u->saved_frame_time_valid = TRUE; u->saved_frame_time_valid = true;
return 0; return 0;
@ -232,7 +232,7 @@ static void thread_func(void *userdata) {
if (PA_UNLIKELY(u->sink->thread_info.rewind_requested)) if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
pa_sink_process_rewind(u->sink, 0); pa_sink_process_rewind(u->sink, 0);
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)
@ -293,7 +293,7 @@ int pa__init(pa_module*m) {
jack_status_t status; jack_status_t status;
const char *server_name, *client_name; const char *server_name, *client_name;
uint32_t channels = 0; uint32_t channels = 0;
pa_bool_t do_connect = TRUE; bool do_connect = true;
unsigned i; unsigned i;
const char **ports = NULL, **p; const char **ports = NULL, **p;
pa_sink_new_data data; pa_sink_new_data data;
@ -320,7 +320,7 @@ int pa__init(pa_module*m) {
m->userdata = u = pa_xnew0(struct userdata, 1); m->userdata = u = pa_xnew0(struct userdata, 1);
u->core = m->core; u->core = m->core;
u->module = m; u->module = m;
u->saved_frame_time_valid = FALSE; u->saved_frame_time_valid = false;
u->rtpoll = pa_rtpoll_new(); u->rtpoll = pa_rtpoll_new();
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);

View file

@ -51,7 +51,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("JACK Source"); PA_MODULE_DESCRIPTION("JACK Source");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"source_name=<name for the source> " "source_name=<name for the source> "
"source_properties=<properties for the source> " "source_properties=<properties for the source> "
@ -81,7 +81,7 @@ struct userdata {
pa_thread *thread; pa_thread *thread;
jack_nframes_t saved_frame_time; jack_nframes_t saved_frame_time;
pa_bool_t saved_frame_time_valid; bool saved_frame_time_valid;
}; };
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -115,7 +115,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
pa_source_post(u->source, chunk); pa_source_post(u->source, chunk);
u->saved_frame_time = (jack_nframes_t) offset; u->saved_frame_time = (jack_nframes_t) offset;
u->saved_frame_time_valid = TRUE; u->saved_frame_time_valid = true;
return 0; return 0;
@ -198,7 +198,7 @@ static void thread_func(void *userdata) {
for (;;) { for (;;) {
int ret; int ret;
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)
@ -247,7 +247,7 @@ int pa__init(pa_module*m) {
jack_status_t status; jack_status_t status;
const char *server_name, *client_name; const char *server_name, *client_name;
uint32_t channels = 0; uint32_t channels = 0;
pa_bool_t do_connect = TRUE; bool do_connect = true;
unsigned i; unsigned i;
const char **ports = NULL, **p; const char **ports = NULL, **p;
pa_source_new_data data; pa_source_new_data data;
@ -274,7 +274,7 @@ int pa__init(pa_module*m) {
m->userdata = u = pa_xnew0(struct userdata, 1); m->userdata = u = pa_xnew0(struct userdata, 1);
u->core = m->core; u->core = m->core;
u->module = m; u->module = m;
u->saved_frame_time_valid = FALSE; u->saved_frame_time_valid = false;
u->rtpoll = pa_rtpoll_new(); u->rtpoll = pa_rtpoll_new();
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);

View file

@ -38,7 +38,7 @@
PA_MODULE_AUTHOR("David Henningsson"); PA_MODULE_AUTHOR("David Henningsson");
PA_MODULE_DESCRIPTION("Adds JACK sink/source ports when JACK is started"); PA_MODULE_DESCRIPTION("Adds JACK sink/source ports when JACK is started");
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"channels=<number of channels> " "channels=<number of channels> "
@ -80,9 +80,9 @@ struct userdata {
pa_module *module; pa_module *module;
pa_core *core; pa_core *core;
pa_dbus_connection *connection; pa_dbus_connection *connection;
pa_bool_t filter_added, match_added; bool filter_added, match_added;
pa_bool_t is_service_started; bool is_service_started;
pa_bool_t autoconnect_ports; bool autoconnect_ports;
uint32_t channels; uint32_t channels;
/* Using index here protects us from module unloading without us knowing */ /* Using index here protects us from module unloading without us knowing */
int jack_module_index[JACK_SS_COUNT]; int jack_module_index[JACK_SS_COUNT];
@ -94,7 +94,7 @@ static void ensure_ports_stopped(struct userdata* u) {
for (i = 0; i < JACK_SS_COUNT; i++) for (i = 0; i < JACK_SS_COUNT; i++)
if (u->jack_module_index[i]) { if (u->jack_module_index[i]) {
pa_module_unload_request_by_index(u->core, u->jack_module_index[i], TRUE); pa_module_unload_request_by_index(u->core, u->jack_module_index[i], true);
u->jack_module_index[i] = 0; u->jack_module_index[i] = 0;
pa_log_info("Stopped %s.", modnames[i]); pa_log_info("Stopped %s.", modnames[i]);
} }
@ -125,10 +125,10 @@ static void ensure_ports_started(struct userdata* u) {
} }
} }
static pa_bool_t check_service_started(struct userdata* u) { static bool 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; bool new_status = false;
dbus_bool_t call_result; dbus_bool_t call_result;
pa_assert(u); pa_assert(u);
@ -230,7 +230,7 @@ int pa__init(pa_module *m) {
m->userdata = u = pa_xnew0(struct userdata, 1); m->userdata = u = pa_xnew0(struct userdata, 1);
u->core = m->core; u->core = m->core;
u->module = m; u->module = m;
u->autoconnect_ports = TRUE; u->autoconnect_ports = true;
u->channels = 0; u->channels = 0;
if (pa_modargs_get_value_boolean(ma, "connect", &u->autoconnect_ports) < 0) { if (pa_modargs_get_value_boolean(ma, "connect", &u->autoconnect_ports) < 0) {

View file

@ -50,7 +50,7 @@
PA_MODULE_AUTHOR("Daniel Mack"); PA_MODULE_AUTHOR("Daniel Mack");
PA_MODULE_DESCRIPTION("Mac OS X Bonjour Service Publisher"); PA_MODULE_DESCRIPTION("Mac OS X Bonjour Service Publisher");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
#define SERVICE_TYPE_SINK "_pulse-sink._tcp" #define SERVICE_TYPE_SINK "_pulse-sink._tcp"
#define SERVICE_TYPE_SOURCE "_pulse-source._tcp" #define SERVICE_TYPE_SOURCE "_pulse-source._tcp"
@ -330,7 +330,7 @@ static void service_free(struct service *s) {
pa_xfree(s); pa_xfree(s);
} }
static pa_bool_t shall_ignore(pa_object *o) { static bool shall_ignore(pa_object *o) {
pa_object_assert_ref(o); pa_object_assert_ref(o);
if (pa_sink_isinstance(o)) if (pa_sink_isinstance(o))

View file

@ -40,7 +40,7 @@
PA_MODULE_AUTHOR("Daniel Mack"); PA_MODULE_AUTHOR("Daniel Mack");
PA_MODULE_DESCRIPTION("CoreAudio device detection"); PA_MODULE_DESCRIPTION("CoreAudio device detection");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE("ioproc_frames=<passed on to module-coreaudio-device> "); PA_MODULE_USAGE("ioproc_frames=<passed on to module-coreaudio-device> ");
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -146,11 +146,11 @@ static int ca_update_device_list(struct pa_module *m) {
/* scan for devices which are reported but not in our cached list */ /* scan for devices which are reported but not in our cached list */
for (i = 0; i < num_devices; i++) { for (i = 0; i < num_devices; i++) {
bool found = FALSE; bool found = false;
PA_LLIST_FOREACH(dev, u->devices) PA_LLIST_FOREACH(dev, u->devices)
if (dev->id == device_id[i]) { if (dev->id == device_id[i]) {
found = TRUE; found = true;
break; break;
} }
@ -162,17 +162,17 @@ static int ca_update_device_list(struct pa_module *m) {
scan_removed: scan_removed:
PA_LLIST_FOREACH(dev, u->devices) { PA_LLIST_FOREACH(dev, u->devices) {
bool found = FALSE; bool found = false;
for (i = 0; i < num_devices; i++) for (i = 0; i < num_devices; i++)
if (dev->id == device_id[i]) { if (dev->id == device_id[i]) {
found = TRUE; found = true;
break; break;
} }
if (!found) { if (!found) {
pa_log_debug("object id %d has been removed (module index %d) %p", (unsigned int) dev->id, dev->module_index, dev); pa_log_debug("object id %d has been removed (module index %d) %p", (unsigned int) dev->id, dev->module_index, dev);
pa_module_unload_request_by_index(m->core, dev->module_index, TRUE); pa_module_unload_request_by_index(m->core, dev->module_index, true);
PA_LLIST_REMOVE(ca_device, u->devices, dev); PA_LLIST_REMOVE(ca_device, u->devices, dev);
pa_xfree(dev); pa_xfree(dev);
/* the current list item pointer is not valid anymore, so start over. */ /* the current list item pointer is not valid anymore, so start over. */
@ -265,7 +265,7 @@ void pa__done(pa_module *m) {
while (dev) { while (dev) {
struct ca_device *next = dev->next; struct ca_device *next = dev->next;
pa_module_unload_request_by_index(m->core, dev->module_index, TRUE); pa_module_unload_request_by_index(m->core, dev->module_index, true);
pa_xfree(dev); pa_xfree(dev);
dev = next; dev = next;

View file

@ -57,7 +57,7 @@
PA_MODULE_AUTHOR("Daniel Mack"); PA_MODULE_AUTHOR("Daniel Mack");
PA_MODULE_DESCRIPTION("CoreAudio device"); PA_MODULE_DESCRIPTION("CoreAudio device");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE("object_id=<the CoreAudio device id> " PA_MODULE_USAGE("object_id=<the CoreAudio device id> "
"ioproc_frames=<audio frames per IOProc call> "); "ioproc_frames=<audio frames per IOProc call> ");
@ -86,7 +86,7 @@ struct userdata {
pa_module *module; pa_module *module;
pa_card *card; pa_card *card;
pa_bool_t running; bool running;
char *device_name, *vendor_name; char *device_name, *vendor_name;
@ -105,7 +105,7 @@ struct coreaudio_sink {
char *name; char *name;
unsigned int channel_idx; unsigned int channel_idx;
pa_bool_t active; bool active;
pa_channel_map map; pa_channel_map map;
pa_sample_spec ss; pa_sample_spec ss;
@ -119,7 +119,7 @@ struct coreaudio_source {
char *name; char *name;
unsigned int channel_idx; unsigned int channel_idx;
pa_bool_t active; bool active;
pa_channel_map map; pa_channel_map map;
pa_sample_spec ss; pa_sample_spec ss;
@ -191,13 +191,13 @@ static pa_usec_t get_latency_us(pa_object *o) {
u = sink->userdata; u = sink->userdata;
ss = &sink->ss; ss = &sink->ss;
is_source = FALSE; is_source = false;
} else if (pa_source_isinstance(o)) { } else if (pa_source_isinstance(o)) {
coreaudio_source *source = PA_SOURCE(o)->userdata; coreaudio_source *source = PA_SOURCE(o)->userdata;
u = source->userdata; u = source->userdata;
ss = &source->ss; ss = &source->ss;
is_source = TRUE; is_source = true;
} else } else
pa_assert_not_reached(); pa_assert_not_reached();
@ -256,17 +256,17 @@ static pa_usec_t get_latency_us(pa_object *o) {
static void ca_device_check_device_state(struct userdata *u) { static void ca_device_check_device_state(struct userdata *u) {
coreaudio_sink *ca_sink; coreaudio_sink *ca_sink;
coreaudio_source *ca_source; coreaudio_source *ca_source;
pa_bool_t active = FALSE; bool active = false;
pa_assert(u); pa_assert(u);
for (ca_sink = u->sinks; ca_sink; ca_sink = ca_sink->next) for (ca_sink = u->sinks; ca_sink; ca_sink = ca_sink->next)
if (ca_sink->active) if (ca_sink->active)
active = TRUE; active = true;
for (ca_source = u->sources; ca_source; ca_source = ca_source->next) for (ca_source = u->sources; ca_source; ca_source = ca_source->next)
if (ca_source->active) if (ca_source->active)
active = TRUE; active = true;
if (active && !u->running) if (active && !u->running)
AudioDeviceStart(u->object_id, u->proc_id); AudioDeviceStart(u->object_id, u->proc_id);
@ -291,7 +291,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
pa_assert(sink); pa_assert(sink);
if (PA_SINK_IS_OPENED(sink->pa_sink->thread_info.state)) { if (PA_SINK_IS_OPENED(sink->pa_sink->thread_info.state)) {
audio_chunk.memblock = pa_memblock_new_fixed(u->module->core->mempool, buf->mData, buf->mDataByteSize, FALSE); audio_chunk.memblock = pa_memblock_new_fixed(u->module->core->mempool, buf->mData, buf->mDataByteSize, false);
audio_chunk.length = buf->mDataByteSize; audio_chunk.length = buf->mDataByteSize;
audio_chunk.index = 0; audio_chunk.index = 0;
@ -329,7 +329,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
pa_assert(source); pa_assert(source);
if (PA_SOURCE_IS_OPENED(source->pa_source->thread_info.state)) { if (PA_SOURCE_IS_OPENED(source->pa_source->thread_info.state)) {
audio_chunk.memblock = pa_memblock_new_fixed(u->module->core->mempool, buf->mData, buf->mDataByteSize, TRUE); audio_chunk.memblock = pa_memblock_new_fixed(u->module->core->mempool, buf->mData, buf->mDataByteSize, true);
audio_chunk.length = buf->mDataByteSize; audio_chunk.length = buf->mDataByteSize;
audio_chunk.index = 0; audio_chunk.index = 0;
@ -358,11 +358,11 @@ static int ca_sink_set_state(pa_sink *s, pa_sink_state_t state) {
switch (state) { switch (state) {
case PA_SINK_SUSPENDED: case PA_SINK_SUSPENDED:
case PA_SINK_IDLE: case PA_SINK_IDLE:
sink->active = FALSE; sink->active = false;
break; break;
case PA_SINK_RUNNING: case PA_SINK_RUNNING:
sink->active = TRUE; sink->active = true;
break; break;
case PA_SINK_UNLINKED: case PA_SINK_UNLINKED:
@ -432,7 +432,7 @@ static int ca_device_create_sink(pa_module *m, AudioBuffer *buf, int channel_idx
new_data.card = u->card; new_data.card = u->card;
new_data.driver = __FILE__; new_data.driver = __FILE__;
new_data.module = u->module; new_data.module = u->module;
new_data.namereg_fail = FALSE; new_data.namereg_fail = false;
pa_sink_new_data_set_name(&new_data, ca_sink->name); pa_sink_new_data_set_name(&new_data, ca_sink->name);
pa_sink_new_data_set_channel_map(&new_data, &ca_sink->map); pa_sink_new_data_set_channel_map(&new_data, &ca_sink->map);
pa_sink_new_data_set_sample_spec(&new_data, &ca_sink->ss); pa_sink_new_data_set_sample_spec(&new_data, &ca_sink->ss);
@ -476,11 +476,11 @@ static int ca_source_set_state(pa_source *s, pa_source_state_t state) {
switch (state) { switch (state) {
case PA_SOURCE_SUSPENDED: case PA_SOURCE_SUSPENDED:
case PA_SOURCE_IDLE: case PA_SOURCE_IDLE:
source->active = FALSE; source->active = false;
break; break;
case PA_SOURCE_RUNNING: case PA_SOURCE_RUNNING:
source->active = TRUE; source->active = true;
break; break;
case PA_SOURCE_UNLINKED: case PA_SOURCE_UNLINKED:
@ -550,7 +550,7 @@ static int ca_device_create_source(pa_module *m, AudioBuffer *buf, int channel_i
new_data.card = u->card; new_data.card = u->card;
new_data.driver = __FILE__; new_data.driver = __FILE__;
new_data.module = u->module; new_data.module = u->module;
new_data.namereg_fail = FALSE; new_data.namereg_fail = false;
pa_source_new_data_set_name(&new_data, ca_source->name); pa_source_new_data_set_name(&new_data, ca_source->name);
pa_source_new_data_set_channel_map(&new_data, &ca_source->map); pa_source_new_data_set_channel_map(&new_data, &ca_source->map);
pa_source_new_data_set_sample_spec(&new_data, &ca_source->ss); pa_source_new_data_set_sample_spec(&new_data, &ca_source->ss);
@ -678,7 +678,7 @@ static void thread_func(void *userdata) {
pa_sink_process_rewind(ca_sink->pa_sink, 0); pa_sink_process_rewind(ca_sink->pa_sink, 0);
} }
ret = pa_rtpoll_run(u->rtpoll, TRUE); ret = pa_rtpoll_run(u->rtpoll, true);
if (ret < 0) if (ret < 0)
goto fail; goto fail;
@ -775,10 +775,10 @@ int pa__init(pa_module *m) {
PA_LLIST_HEAD_INIT(coreaudio_sink, u->sinks); PA_LLIST_HEAD_INIT(coreaudio_sink, u->sinks);
/* create sinks */ /* create sinks */
ca_device_create_streams(m, FALSE); ca_device_create_streams(m, false);
/* create sources */ /* create sources */
ca_device_create_streams(m, TRUE); ca_device_create_streams(m, true);
/* create the message thread */ /* create the message thread */
if (!(u->thread = pa_thread_new(u->device_name, thread_func, u))) { if (!(u->thread = pa_thread_new(u->device_name, thread_func, u))) {

View file

@ -37,7 +37,7 @@
PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_AUTHOR("Colin Guthrie");
PA_MODULE_DESCRIPTION(_("Always keeps at least one sink loaded even if it's a null one")); PA_MODULE_DESCRIPTION(_("Always keeps at least one sink loaded even if it's a null one"));
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name of sink>"); "sink_name=<name of sink>");
@ -51,7 +51,7 @@ static const char* const valid_modargs[] = {
struct userdata { struct userdata {
pa_hook_slot *put_slot, *unlink_slot; pa_hook_slot *put_slot, *unlink_slot;
uint32_t null_module; uint32_t null_module;
pa_bool_t ignore; bool ignore;
char *sink_name; char *sink_name;
}; };
@ -76,7 +76,7 @@ static void load_null_sink_if_needed(pa_core *c, pa_sink *sink, struct userdata*
pa_log_debug("Autoloading null-sink as no other sinks detected."); pa_log_debug("Autoloading null-sink as no other sinks detected.");
u->ignore = TRUE; u->ignore = true;
t = pa_sprintf_malloc("sink_name=%s sink_properties='device.description=\"%s\"'", u->sink_name, t = pa_sprintf_malloc("sink_name=%s sink_properties='device.description=\"%s\"'", u->sink_name,
_("Dummy Output")); _("Dummy Output"));
@ -84,7 +84,7 @@ static void load_null_sink_if_needed(pa_core *c, pa_sink *sink, struct userdata*
u->null_module = m ? m->index : PA_INVALID_INDEX; u->null_module = m ? m->index : PA_INVALID_INDEX;
pa_xfree(t); pa_xfree(t);
u->ignore = FALSE; u->ignore = false;
if (!m) if (!m)
pa_log_warn("Unable to load module-null-sink"); pa_log_warn("Unable to load module-null-sink");
@ -115,7 +115,7 @@ static pa_hook_result_t put_hook_callback(pa_core *c, pa_sink *sink, void* userd
pa_log_info("A new sink has been discovered. Unloading null-sink."); pa_log_info("A new sink has been discovered. Unloading null-sink.");
pa_module_unload_request_by_index(c, u->null_module, TRUE); pa_module_unload_request_by_index(c, u->null_module, true);
u->null_module = PA_INVALID_INDEX; u->null_module = PA_INVALID_INDEX;
return PA_HOOK_OK; return PA_HOOK_OK;
@ -160,7 +160,7 @@ int pa__init(pa_module*m) {
u->put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_LATE, (pa_hook_cb_t) put_hook_callback, u); u->put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_LATE, (pa_hook_cb_t) put_hook_callback, u);
u->unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_UNLINK], PA_HOOK_EARLY, (pa_hook_cb_t) unlink_hook_callback, u); u->unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_UNLINK], PA_HOOK_EARLY, (pa_hook_cb_t) unlink_hook_callback, u);
u->null_module = PA_INVALID_INDEX; u->null_module = PA_INVALID_INDEX;
u->ignore = FALSE; u->ignore = false;
pa_modargs_free(ma); pa_modargs_free(ma);
@ -182,7 +182,7 @@ void pa__done(pa_module*m) {
if (u->unlink_slot) if (u->unlink_slot)
pa_hook_slot_free(u->unlink_slot); pa_hook_slot_free(u->unlink_slot);
if (u->null_module != PA_INVALID_INDEX && m->core->state != PA_CORE_SHUTDOWN) if (u->null_module != PA_INVALID_INDEX && m->core->state != PA_CORE_SHUTDOWN)
pa_module_unload_request_by_index(m->core, u->null_module, TRUE); pa_module_unload_request_by_index(m->core, u->null_module, true);
pa_xfree(u->sink_name); pa_xfree(u->sink_name);
pa_xfree(u); pa_xfree(u);

View file

@ -41,7 +41,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Augment the property sets of streams with additional static information"); PA_MODULE_DESCRIPTION("Augment the property sets of streams with additional static information");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
#define STAT_INTERVAL 30 #define STAT_INTERVAL 30
#define MAX_CACHE_SIZE 50 #define MAX_CACHE_SIZE 50
@ -52,7 +52,7 @@ static const char* const valid_modargs[] = {
struct rule { struct rule {
time_t timestamp; time_t timestamp;
pa_bool_t good; bool good;
time_t mtime; time_t mtime;
char *process_name; char *process_name;
char *application_name; char *application_name;
@ -145,13 +145,13 @@ static void update_rule(struct rule *r) {
{ NULL, catch_all, NULL, NULL }, { NULL, catch_all, NULL, NULL },
{ NULL, NULL, NULL, NULL }, { NULL, NULL, NULL, NULL },
}; };
pa_bool_t found = FALSE; bool found = false;
pa_assert(r); pa_assert(r);
fn = pa_sprintf_malloc(DESKTOPFILEDIR PA_PATH_SEP "%s.desktop", r->process_name); fn = pa_sprintf_malloc(DESKTOPFILEDIR PA_PATH_SEP "%s.desktop", r->process_name);
if (stat(fn, &st) == 0) if (stat(fn, &st) == 0)
found = TRUE; found = true;
else { else {
#ifdef DT_DIR #ifdef DT_DIR
DIR *desktopfiles_dir; DIR *desktopfiles_dir;
@ -169,7 +169,7 @@ static void update_rule(struct rule *r) {
fn = pa_sprintf_malloc(DESKTOPFILEDIR PA_PATH_SEP "%s" PA_PATH_SEP "%s.desktop", dir->d_name, r->process_name); fn = pa_sprintf_malloc(DESKTOPFILEDIR 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;
break; break;
} }
} }
@ -178,7 +178,7 @@ static void update_rule(struct rule *r) {
#endif #endif
} }
if (!found) { if (!found) {
r->good = FALSE; r->good = false;
pa_xfree(fn); pa_xfree(fn);
return; return;
} }
@ -194,7 +194,7 @@ static void update_rule(struct rule *r) {
} else } else
pa_log_debug("Found %s.", fn); pa_log_debug("Found %s.", fn);
r->good = TRUE; r->good = true;
r->mtime = st.st_mtime; r->mtime = st.st_mtime;
pa_xfree(r->application_name); pa_xfree(r->application_name);
pa_xfree(r->icon_name); pa_xfree(r->icon_name);

View file

@ -51,7 +51,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Automatically restore profile of cards"); PA_MODULE_DESCRIPTION("Automatically restore profile of cards");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
#define SAVE_INTERVAL (10 * PA_USEC_PER_SEC) #define SAVE_INTERVAL (10 * PA_USEC_PER_SEC)
@ -184,10 +184,10 @@ static bool entrys_equal(struct entry *a, struct entry *b) {
return true; return true;
} }
static pa_bool_t entry_write(struct userdata *u, const char *name, const struct entry *e) { static bool entry_write(struct userdata *u, const char *name, const struct entry *e) {
pa_tagstruct *t; pa_tagstruct *t;
pa_datum key, data; pa_datum key, data;
pa_bool_t r; bool r;
void *state; void *state;
struct port_info *p_info; struct port_info *p_info;
@ -210,7 +210,7 @@ static pa_bool_t entry_write(struct userdata *u, const char *name, const struct
data.data = (void*)pa_tagstruct_data(t, &data.size); data.data = (void*)pa_tagstruct_data(t, &data.size);
r = (pa_database_set(u->database, &key, &data, TRUE) == 0); r = (pa_database_set(u->database, &key, &data, true) == 0);
pa_tagstruct_free(t); pa_tagstruct_free(t);
@ -449,7 +449,7 @@ static pa_hook_result_t card_new_hook_callback(pa_core *c, pa_card_new_data *new
if (!new_data->active_profile) { if (!new_data->active_profile) {
pa_card_new_data_set_profile(new_data, e->profile); pa_card_new_data_set_profile(new_data, e->profile);
pa_log_info("Restored profile '%s' for card %s.", new_data->active_profile, new_data->name); pa_log_info("Restored profile '%s' for card %s.", new_data->active_profile, new_data->name);
new_data->save_profile = TRUE; new_data->save_profile = true;
} else } else
pa_log_debug("Not restoring profile for card %s, because already set.", new_data->name); pa_log_debug("Not restoring profile for card %s, because already set.", new_data->name);
@ -491,10 +491,10 @@ int pa__init(pa_module*m) {
u->port_offset_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) port_offset_change_callback, u); u->port_offset_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) port_offset_change_callback, u);
u->hooks_connected = true; u->hooks_connected = true;
if (!(fname = pa_state_path("card-database", TRUE))) if (!(fname = pa_state_path("card-database", true)))
goto fail; goto fail;
if (!(u->database = pa_database_open(fname, TRUE))) { if (!(u->database = pa_database_open(fname, true))) {
pa_log("Failed to open volume database '%s': %s", fname, pa_cstrerror(errno)); pa_log("Failed to open volume database '%s': %s", fname, pa_cstrerror(errno));
pa_xfree(fname); pa_xfree(fname);
goto fail; goto fail;

View file

@ -42,7 +42,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Command line interface"); PA_MODULE_DESCRIPTION("Command line interface");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE("exit_on_eof=<exit daemon after EOF?>"); PA_MODULE_USAGE("exit_on_eof=<exit daemon after EOF?>");
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -56,7 +56,7 @@ static void eof_and_unload_cb(pa_cli*c, void *userdata) {
pa_assert(c); pa_assert(c);
pa_assert(m); pa_assert(m);
pa_module_unload_request(m, TRUE); pa_module_unload_request(m, true);
} }
static void eof_and_exit_cb(pa_cli*c, void *userdata) { static void eof_and_exit_cb(pa_cli*c, void *userdata) {
@ -65,13 +65,13 @@ static void eof_and_exit_cb(pa_cli*c, void *userdata) {
pa_assert(c); pa_assert(c);
pa_assert(m); pa_assert(m);
pa_core_exit(m->core, FALSE, 0); pa_core_exit(m->core, false, 0);
} }
int pa__init(pa_module*m) { int pa__init(pa_module*m) {
pa_iochannel *io; pa_iochannel *io;
pa_modargs *ma; pa_modargs *ma;
pa_bool_t exit_on_eof = FALSE; bool exit_on_eof = false;
#ifndef OS_IS_WIN32 #ifndef OS_IS_WIN32
int fd; int fd;
#endif #endif
@ -115,7 +115,7 @@ int pa__init(pa_module*m) {
#endif #endif
{ {
io = pa_iochannel_new(m->core->mainloop, STDIN_FILENO, STDOUT_FILENO); io = pa_iochannel_new(m->core->mainloop, STDIN_FILENO, STDOUT_FILENO);
pa_iochannel_set_noclose(io, TRUE); pa_iochannel_set_noclose(io, true);
pa_log_debug("Failed to open /dev/tty, using stdin/stdout fds instead."); pa_log_debug("Failed to open /dev/tty, using stdin/stdout fds instead.");
} }

View file

@ -52,7 +52,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Combine multiple sinks to one"); PA_MODULE_DESCRIPTION("Combine multiple sinks to one");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> " "sink_properties=<properties for the sink> "
@ -90,7 +90,7 @@ struct output {
pa_sink *sink; pa_sink *sink;
pa_sink_input *sink_input; pa_sink_input *sink_input;
pa_bool_t ignore_state_change; bool ignore_state_change;
pa_asyncmsgq *inq, /* Message queue from the sink thread to this sink input */ pa_asyncmsgq *inq, /* Message queue from the sink thread to this sink input */
*outq; /* Message queue from this sink input to the sink thread */ *outq; /* Message queue from this sink input to the sink thread */
@ -121,8 +121,8 @@ struct userdata {
pa_time_event *time_event; pa_time_event *time_event;
pa_usec_t adjust_time; pa_usec_t adjust_time;
pa_bool_t automatic; bool automatic;
pa_bool_t auto_desc; bool auto_desc;
pa_strlist *unlinked_slaves; pa_strlist *unlinked_slaves;
@ -138,7 +138,7 @@ struct userdata {
PA_LLIST_HEAD(struct output, active_outputs); /* managed in IO thread context */ PA_LLIST_HEAD(struct output, active_outputs); /* managed in IO thread context */
pa_atomic_t running; /* we cache that value here, so that every thread can query it cheaply */ pa_atomic_t running; /* we cache that value here, so that every thread can query it cheaply */
pa_usec_t timestamp; pa_usec_t timestamp;
pa_bool_t in_null_mode; bool in_null_mode;
pa_smoother *smoother; pa_smoother *smoother;
uint64_t counter; uint64_t counter;
} thread_info; } thread_info;
@ -304,7 +304,7 @@ static void thread_func(void *userdata) {
pa_thread_mq_install(&u->thread_mq); pa_thread_mq_install(&u->thread_mq);
u->thread_info.timestamp = pa_rtclock_now(); u->thread_info.timestamp = pa_rtclock_now();
u->thread_info.in_null_mode = FALSE; u->thread_info.in_null_mode = false;
for (;;) { for (;;) {
int ret; int ret;
@ -322,14 +322,14 @@ static void thread_func(void *userdata) {
process_render_null(u, now); process_render_null(u, now);
pa_rtpoll_set_timer_absolute(u->rtpoll, u->thread_info.timestamp); pa_rtpoll_set_timer_absolute(u->rtpoll, u->thread_info.timestamp);
u->thread_info.in_null_mode = TRUE; u->thread_info.in_null_mode = true;
} else { } else {
pa_rtpoll_set_timer_disabled(u->rtpoll); pa_rtpoll_set_timer_disabled(u->rtpoll);
u->thread_info.in_null_mode = FALSE; u->thread_info.in_null_mode = false;
} }
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) { if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) {
pa_log_info("pa_rtpoll_run() = %i", ret); pa_log_info("pa_rtpoll_run() = %i", ret);
goto fail; goto fail;
} }
@ -513,7 +513,7 @@ static void sink_input_attach_cb(pa_sink_input *i) {
PA_RTPOLL_EARLY, PA_RTPOLL_EARLY,
o->outq); o->outq);
pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); pa_sink_input_request_rewind(i, 0, false, true, true);
pa_atomic_store(&o->max_request, (int) pa_sink_input_get_max_request(i)); pa_atomic_store(&o->max_request, (int) pa_sink_input_get_max_request(i));
@ -549,7 +549,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
pa_assert_se(o = i->userdata); pa_assert_se(o = i->userdata);
pa_module_unload_request(o->userdata->module, TRUE); pa_module_unload_request(o->userdata->module, true);
pa_idxset_remove_by_data(o->userdata->outputs, o, NULL); pa_idxset_remove_by_data(o->userdata->outputs, o, NULL);
output_free(o); output_free(o);
} }
@ -575,7 +575,7 @@ static int sink_input_process_msg(pa_msgobject *obj, int code, void *data, int64
if (PA_SINK_IS_OPENED(o->sink_input->sink->thread_info.state)) if (PA_SINK_IS_OPENED(o->sink_input->sink->thread_info.state))
pa_memblockq_push_align(o->memblockq, chunk); pa_memblockq_push_align(o->memblockq, chunk);
else else
pa_memblockq_flush_write(o->memblockq, TRUE); pa_memblockq_flush_write(o->memblockq, true);
return 0; return 0;
} }
@ -740,12 +740,12 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
switch (code) { switch (code) {
case PA_SINK_MESSAGE_SET_STATE: { case PA_SINK_MESSAGE_SET_STATE: {
pa_bool_t running = (PA_PTR_TO_UINT(data) == PA_SINK_RUNNING); bool running = (PA_PTR_TO_UINT(data) == PA_SINK_RUNNING);
pa_atomic_store(&u->thread_info.running, running); pa_atomic_store(&u->thread_info.running, running);
if (running) if (running)
pa_smoother_resume(u->thread_info.smoother, pa_rtclock_now(), TRUE); pa_smoother_resume(u->thread_info.smoother, pa_rtclock_now(), true);
else else
pa_smoother_pause(u->thread_info.smoother, pa_rtclock_now()); pa_smoother_pause(u->thread_info.smoother, pa_rtclock_now());
@ -812,7 +812,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
} }
static void update_description(struct userdata *u) { static void update_description(struct userdata *u) {
pa_bool_t first = TRUE; bool first = true;
char *t; char *t;
struct output *o; struct output *o;
uint32_t idx; uint32_t idx;
@ -834,7 +834,7 @@ static void update_description(struct userdata *u) {
if (first) { if (first) {
e = pa_sprintf_malloc("%s %s", t, pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION))); e = pa_sprintf_malloc("%s %s", t, pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)));
first = FALSE; first = false;
} else } else
e = pa_sprintf_malloc("%s, %s", t, pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION))); e = pa_sprintf_malloc("%s, %s", t, pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)));
@ -855,7 +855,7 @@ static int output_create_sink_input(struct output *o) {
return 0; return 0;
pa_sink_input_new_data_init(&data); pa_sink_input_new_data_init(&data);
pa_sink_input_new_data_set_sink(&data, o->sink, FALSE); pa_sink_input_new_data_set_sink(&data, o->sink, false);
data.driver = __FILE__; data.driver = __FILE__;
pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME, "Simultaneous output on %s", pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION))); pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME, "Simultaneous output on %s", pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)));
pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "filter"); pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "filter");
@ -958,7 +958,7 @@ static void output_enable(struct output *o) {
* of the sink might hence be called from here, which might then * of the sink might hence be called from here, which might then
* cause us to be called in a loop. Make sure that state changes * cause us to be called in a loop. Make sure that state changes
* for this output don't cause this loop by setting a flag here */ * for this output don't cause this loop by setting a flag here */
o->ignore_state_change = TRUE; o->ignore_state_change = true;
if (output_create_sink_input(o) >= 0) { if (output_create_sink_input(o) >= 0) {
@ -977,7 +977,7 @@ static void output_enable(struct output *o) {
output_add_within_thread(o); output_add_within_thread(o);
} }
o->ignore_state_change = FALSE; o->ignore_state_change = false;
} }
/* Called from main context */ /* Called from main context */
@ -1000,9 +1000,9 @@ static void output_disable(struct output *o) {
o->sink_input = NULL; o->sink_input = NULL;
/* Finally, drop all queued data */ /* Finally, drop all queued data */
pa_memblockq_flush_write(o->memblockq, TRUE); pa_memblockq_flush_write(o->memblockq, true);
pa_asyncmsgq_flush(o->inq, FALSE); pa_asyncmsgq_flush(o->inq, false);
pa_asyncmsgq_flush(o->outq, FALSE); pa_asyncmsgq_flush(o->outq, false);
} }
/* Called from main context */ /* Called from main context */
@ -1016,25 +1016,25 @@ static void output_verify(struct output *o) {
} }
/* Called from main context */ /* Called from main context */
static pa_bool_t is_suitable_sink(struct userdata *u, pa_sink *s) { static bool is_suitable_sink(struct userdata *u, pa_sink *s) {
const char *t; const char *t;
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
if (s == u->sink) if (s == u->sink)
return FALSE; return false;
if (!(s->flags & PA_SINK_HARDWARE)) if (!(s->flags & PA_SINK_HARDWARE))
return FALSE; return false;
if (!(s->flags & PA_SINK_LATENCY)) if (!(s->flags & PA_SINK_LATENCY))
return FALSE; return false;
if ((t = pa_proplist_gets(s->proplist, PA_PROP_DEVICE_CLASS))) if ((t = pa_proplist_gets(s->proplist, PA_PROP_DEVICE_CLASS)))
if (!pa_streq(t, "sound")) if (!pa_streq(t, "sound"))
return FALSE; return false;
return TRUE; return true;
} }
/* Called from main context */ /* Called from main context */
@ -1166,11 +1166,11 @@ int pa__init(pa_module*m) {
u->thread_info.smoother = pa_smoother_new( u->thread_info.smoother = pa_smoother_new(
PA_USEC_PER_SEC, PA_USEC_PER_SEC,
PA_USEC_PER_SEC*2, PA_USEC_PER_SEC*2,
TRUE, true,
TRUE, true,
10, 10,
pa_rtclock_now(), pa_rtclock_now(),
TRUE); true);
adjust_time_sec = DEFAULT_ADJUST_TIME_USEC / PA_USEC_PER_SEC; adjust_time_sec = DEFAULT_ADJUST_TIME_USEC / PA_USEC_PER_SEC;
if (pa_modargs_get_value_u32(ma, "adjust_time", &adjust_time_sec) < 0) { if (pa_modargs_get_value_u32(ma, "adjust_time", &adjust_time_sec) < 0) {
@ -1195,7 +1195,7 @@ int pa__init(pa_module*m) {
char *n = NULL; char *n = NULL;
pa_sample_spec slaves_spec; pa_sample_spec slaves_spec;
pa_channel_map slaves_map; pa_channel_map slaves_map;
pa_bool_t is_first_slave = TRUE; bool is_first_slave = true;
pa_sample_spec_init(&slaves_spec); pa_sample_spec_init(&slaves_spec);
@ -1213,7 +1213,7 @@ int pa__init(pa_module*m) {
if (is_first_slave) { if (is_first_slave) {
slaves_spec = slave_sink->sample_spec; slaves_spec = slave_sink->sample_spec;
slaves_map = slave_sink->channel_map; slaves_map = slave_sink->channel_map;
is_first_slave = FALSE; is_first_slave = false;
} else { } else {
if (slaves_spec.format != slave_sink->sample_spec.format) if (slaves_spec.format != slave_sink->sample_spec.format)
slaves_spec.format = PA_SAMPLE_INVALID; slaves_spec.format = PA_SAMPLE_INVALID;
@ -1245,7 +1245,7 @@ int pa__init(pa_module*m) {
} }
pa_sink_new_data_init(&data); pa_sink_new_data_init(&data);
data.namereg_fail = FALSE; data.namereg_fail = false;
data.driver = __FILE__; data.driver = __FILE__;
data.module = m; data.module = m;
pa_sink_new_data_set_name(&data, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME)); pa_sink_new_data_set_name(&data, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME));
@ -1263,9 +1263,9 @@ int pa__init(pa_module*m) {
} }
/* Check proplist for a description & fill in a default value if not */ /* Check proplist for a description & fill in a default value if not */
u->auto_desc = FALSE; u->auto_desc = false;
if (NULL == pa_proplist_gets(data.proplist, PA_PROP_DEVICE_DESCRIPTION)) { if (NULL == pa_proplist_gets(data.proplist, PA_PROP_DEVICE_DESCRIPTION)) {
u->auto_desc = TRUE; u->auto_desc = true;
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Simultaneous Output"); pa_proplist_sets(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Simultaneous Output");
} }

View file

@ -34,7 +34,7 @@
PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_AUTHOR("Colin Guthrie");
PA_MODULE_DESCRIPTION("Compatibility module (module-combine rename)"); PA_MODULE_DESCRIPTION("Compatibility module (module-combine rename)");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_DEPRECATED("Please use module-combine-sink instead of module-combine!"); PA_MODULE_DEPRECATED("Please use module-combine-sink instead of module-combine!");
struct userdata { struct userdata {
@ -65,7 +65,7 @@ void pa__done(pa_module*m) {
u = m->userdata; u = m->userdata;
if (u && PA_INVALID_INDEX != u->module_index) if (u && PA_INVALID_INDEX != u->module_index)
pa_module_unload_by_index(m->core, u->module_index, TRUE); pa_module_unload_by_index(m->core, u->module_index, true);
pa_xfree(u); pa_xfree(u);
} }

View file

@ -44,7 +44,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Create a client for each ConsoleKit session of this user"); PA_MODULE_DESCRIPTION("Create a client for each ConsoleKit session of this user");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
NULL NULL
@ -60,7 +60,7 @@ struct userdata {
pa_core *core; pa_core *core;
pa_dbus_connection *connection; pa_dbus_connection *connection;
pa_hashmap *sessions; pa_hashmap *sessions;
pa_bool_t filter_added; bool filter_added;
}; };
static void add_session(struct userdata *u, const char *id) { static void add_session(struct userdata *u, const char *id) {
@ -310,7 +310,7 @@ int pa__init(pa_module*m) {
goto fail; goto fail;
} }
u->filter_added = TRUE; u->filter_added = true;
if (pa_dbus_add_matches( if (pa_dbus_add_matches(
pa_dbus_connection_get(connection), &error, pa_dbus_connection_get(connection), &error,

View file

@ -41,7 +41,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Automatically restore the default sink and source"); PA_MODULE_DESCRIPTION("Automatically restore the default sink and source");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
#define SAVE_INTERVAL (5 * PA_USEC_PER_SEC) #define SAVE_INTERVAL (5 * PA_USEC_PER_SEC)
@ -50,7 +50,7 @@ struct userdata {
pa_subscription *subscription; pa_subscription *subscription;
pa_time_event *time_event; pa_time_event *time_event;
char *sink_filename, *source_filename; char *sink_filename, *source_filename;
pa_bool_t modified; bool modified;
}; };
static void load(struct userdata *u) { static void load(struct userdata *u) {
@ -125,7 +125,7 @@ static void save(struct userdata *u) {
pa_log("Failed to save default source: %s", pa_cstrerror(errno)); pa_log("Failed to save default source: %s", pa_cstrerror(errno));
} }
u->modified = FALSE; u->modified = false;
} }
static void time_cb(pa_mainloop_api *a, pa_time_event *e, const struct timeval *t, void *userdata) { static void time_cb(pa_mainloop_api *a, pa_time_event *e, const struct timeval *t, void *userdata) {
@ -145,7 +145,7 @@ static void subscribe_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t id
pa_assert(u); pa_assert(u);
u->modified = TRUE; u->modified = true;
if (!u->time_event) if (!u->time_event)
u->time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + SAVE_INTERVAL, time_cb, u); u->time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + SAVE_INTERVAL, time_cb, u);
@ -159,10 +159,10 @@ int pa__init(pa_module *m) {
m->userdata = u = pa_xnew0(struct userdata, 1); m->userdata = u = pa_xnew0(struct userdata, 1);
u->core = m->core; u->core = m->core;
if (!(u->sink_filename = pa_state_path("default-sink", TRUE))) if (!(u->sink_filename = pa_state_path("default-sink", true)))
goto fail; goto fail;
if (!(u->source_filename = pa_state_path("default-source", TRUE))) if (!(u->source_filename = pa_state_path("default-source", true)))
goto fail; goto fail;
load(u); load(u);

View file

@ -30,6 +30,6 @@ const char* pa__get_description(void);
const char* pa__get_usage(void); const char* pa__get_usage(void);
const char* pa__get_version(void); const char* pa__get_version(void);
const char* pa__get_deprecated(void); const char* pa__get_deprecated(void);
pa_bool_t pa__load_once(void); bool pa__load_once(void);
#endif #endif

View file

@ -46,7 +46,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Detect available audio hardware and load matching drivers"); PA_MODULE_DESCRIPTION("Detect available audio hardware and load matching drivers");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE("just-one=<boolean>"); PA_MODULE_USAGE("just-one=<boolean>");
PA_MODULE_DEPRECATED("Please use module-udev-detect instead of module-detect!"); PA_MODULE_DEPRECATED("Please use module-udev-detect instead of module-detect!");
@ -219,7 +219,7 @@ static int detect_waveout(pa_core *c, int just_one) {
#endif #endif
int pa__init(pa_module*m) { int pa__init(pa_module*m) {
pa_bool_t just_one = FALSE; bool just_one = false;
int n = 0; int n = 0;
pa_modargs *ma; pa_modargs *ma;
@ -255,7 +255,7 @@ int pa__init(pa_module*m) {
pa_log_info("loaded %i modules.", n); pa_log_info("loaded %i modules.", n);
/* We were successful and can unload ourselves now. */ /* We were successful and can unload ourselves now. */
pa_module_unload_request(m, TRUE); pa_module_unload_request(m, true);
pa_modargs_free(ma); pa_modargs_free(ma);

View file

@ -56,7 +56,7 @@
PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_AUTHOR("Colin Guthrie");
PA_MODULE_DESCRIPTION("Keep track of devices (and their descriptions) both past and present and prioritise by role"); PA_MODULE_DESCRIPTION("Keep track of devices (and their descriptions) both past and present and prioritise by role");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"do_routing=<Automatically route streams based on a priority list (unique per-role)?> " "do_routing=<Automatically route streams based on a priority list (unique per-role)?> "
"on_hotplug=<When new device becomes available, recheck streams?> " "on_hotplug=<When new device becomes available, recheck streams?> "
@ -120,9 +120,9 @@ struct userdata {
pa_native_protocol *protocol; pa_native_protocol *protocol;
pa_idxset *subscribed; pa_idxset *subscribed;
pa_bool_t on_hotplug; bool on_hotplug;
pa_bool_t on_rescue; bool on_rescue;
pa_bool_t do_routing; bool do_routing;
role_indexes_t preferred_sinks; role_indexes_t preferred_sinks;
role_indexes_t preferred_sources; role_indexes_t preferred_sources;
@ -133,7 +133,7 @@ struct userdata {
struct entry { struct entry {
uint8_t version; uint8_t version;
char *description; char *description;
pa_bool_t user_set_description; bool user_set_description;
char *icon; char *icon;
role_indexes_t priority; role_indexes_t priority;
}; };
@ -200,10 +200,10 @@ static void entry_free(struct entry* e) {
pa_xfree(e); pa_xfree(e);
} }
static pa_bool_t entry_write(struct userdata *u, const char *name, const struct entry *e) { static bool entry_write(struct userdata *u, const char *name, const struct entry *e) {
pa_tagstruct *t; pa_tagstruct *t;
pa_datum key, data; pa_datum key, data;
pa_bool_t r; bool r;
pa_assert(u); pa_assert(u);
pa_assert(name); pa_assert(name);
@ -222,7 +222,7 @@ static pa_bool_t entry_write(struct userdata *u, const char *name, const struct
data.data = (void*)pa_tagstruct_data(t, &data.size); data.data = (void*)pa_tagstruct_data(t, &data.size);
r = (pa_database_set(u->database, &key, &data, TRUE) == 0); r = (pa_database_set(u->database, &key, &data, true) == 0);
pa_tagstruct_free(t); pa_tagstruct_free(t);
@ -236,7 +236,7 @@ static struct entry* legacy_entry_read(struct userdata *u, pa_datum *data) {
struct legacy_entry { struct legacy_entry {
uint8_t version; uint8_t version;
char description[PA_NAME_MAX]; char description[PA_NAME_MAX];
pa_bool_t user_set_description; bool user_set_description;
char icon[PA_NAME_MAX]; char icon[PA_NAME_MAX];
role_indexes_t priority; role_indexes_t priority;
} PA_GCC_PACKED; } PA_GCC_PACKED;
@ -360,7 +360,7 @@ fail:
} }
#ifdef DUMP_DATABASE #ifdef DUMP_DATABASE
static void dump_database_helper(struct userdata *u, uint32_t role_index, const char* human, pa_bool_t sink_mode) { static void dump_database_helper(struct userdata *u, uint32_t role_index, const char* human, bool sink_mode) {
pa_assert(u); pa_assert(u);
pa_assert(human); pa_assert(human);
@ -381,7 +381,7 @@ static void dump_database_helper(struct userdata *u, uint32_t role_index, const
static void dump_database(struct userdata *u) { static void dump_database(struct userdata *u) {
pa_datum key; pa_datum key;
pa_bool_t done; bool done;
pa_assert(u); pa_assert(u);
@ -423,7 +423,7 @@ static void dump_database(struct userdata *u) {
strncpy(name, role_names[role], len); strncpy(name, role_names[role], len);
for (int i = len+1; i < 12; ++i) name[i] = ' '; for (int i = len+1; i < 12; ++i) name[i] = ' ';
name[len] = ':'; name[0] -= 32; name[12] = '\0'; name[len] = ':'; name[0] -= 32; name[12] = '\0';
dump_database_helper(u, role, name, TRUE); dump_database_helper(u, role, name, true);
} }
pa_log_debug(" Sources:"); pa_log_debug(" Sources:");
@ -433,7 +433,7 @@ static void dump_database(struct userdata *u) {
strncpy(name, role_names[role], len); strncpy(name, role_names[role], len);
for (int i = len+1; i < 12; ++i) name[i] = ' '; for (int i = len+1; i < 12; ++i) name[i] = ' ';
name[len] = ':'; name[0] -= 32; name[12] = '\0'; name[len] = ':'; name[0] -= 32; name[12] = '\0';
dump_database_helper(u, role, name, FALSE); dump_database_helper(u, role, name, false);
} }
} }
@ -462,7 +462,7 @@ static void notify_subscribers(struct userdata *u) {
} }
} }
static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) { static bool entries_equal(const struct entry *a, const struct entry *b) {
pa_assert(a); pa_assert(a);
pa_assert(b); pa_assert(b);
@ -470,13 +470,13 @@ static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) {
if (!pa_streq(a->description, b->description) if (!pa_streq(a->description, b->description)
|| a->user_set_description != b->user_set_description || a->user_set_description != b->user_set_description
|| !pa_streq(a->icon, b->icon)) || !pa_streq(a->icon, b->icon))
return FALSE; return false;
for (int i=0; i < NUM_ROLES; ++i) for (int i=0; i < NUM_ROLES; ++i)
if (a->priority[i] != b->priority[i]) if (a->priority[i] != b->priority[i])
return FALSE; return false;
return TRUE; return true;
} }
static char *get_name(const char *key, const char *prefix) { static char *get_name(const char *key, const char *prefix) {
@ -505,7 +505,7 @@ static inline struct entry *load_or_initialize_entry(struct userdata *u, struct
/* This is a new device, so make sure we write it's priority list correctly */ /* This is a new device, so make sure we write it's priority list correctly */
role_indexes_t max_priority; role_indexes_t max_priority;
pa_datum key; pa_datum key;
pa_bool_t done; bool done;
pa_zero(max_priority); pa_zero(max_priority);
done = !pa_database_first(u->database, &key, NULL); done = !pa_database_first(u->database, &key, NULL);
@ -540,7 +540,7 @@ static inline struct entry *load_or_initialize_entry(struct userdata *u, struct
for (uint32_t i = 0; i < NUM_ROLES; ++i) { for (uint32_t i = 0; i < NUM_ROLES; ++i) {
entry->priority[i] = max_priority[i] + 1; entry->priority[i] = max_priority[i] + 1;
} }
entry->user_set_description = FALSE; entry->user_set_description = false;
} }
return old; return old;
@ -559,7 +559,7 @@ static uint32_t get_role_index(const char* role) {
static void update_highest_priority_device_indexes(struct userdata *u, const char *prefix, void *ignore_device) { static void update_highest_priority_device_indexes(struct userdata *u, const char *prefix, void *ignore_device) {
role_indexes_t *indexes, highest_priority_available; role_indexes_t *indexes, highest_priority_available;
pa_datum key; pa_datum key;
pa_bool_t done, sink_mode; bool done, sink_mode;
pa_assert(u); pa_assert(u);
pa_assert(prefix); pa_assert(prefix);
@ -597,7 +597,7 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha
/* We've found a device with a higher priority than that we've currently got, /* We've found a device with a higher priority than that we've currently got,
so see if it is currently available or not and update our list */ so see if it is currently available or not and update our list */
uint32_t idx; uint32_t idx;
pa_bool_t found = FALSE; bool found = false;
if (sink_mode) { if (sink_mode) {
pa_sink *sink; pa_sink *sink;
@ -606,7 +606,7 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha
if ((pa_sink*) ignore_device == sink) if ((pa_sink*) ignore_device == sink)
continue; continue;
if (pa_streq(sink->name, device_name)) { if (pa_streq(sink->name, device_name)) {
found = TRUE; found = true;
idx = sink->index; /* Is this needed? */ idx = sink->index; /* Is this needed? */
break; break;
} }
@ -618,7 +618,7 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha
if ((pa_source*) ignore_device == source) if ((pa_source*) ignore_device == source)
continue; continue;
if (pa_streq(source->name, device_name)) { if (pa_streq(source->name, device_name)) {
found = TRUE; found = true;
idx = source->index; /* Is this needed? */ idx = source->index; /* Is this needed? */
break; break;
} }
@ -681,7 +681,7 @@ static void route_sink_input(struct userdata *u, pa_sink_input *si) {
return; return;
if (si->sink != sink) if (si->sink != sink)
pa_sink_input_move_to(si, sink, FALSE); pa_sink_input_move_to(si, sink, false);
} }
static pa_hook_result_t route_sink_inputs(struct userdata *u, pa_sink *ignore_sink) { static pa_hook_result_t route_sink_inputs(struct userdata *u, pa_sink *ignore_sink) {
@ -742,7 +742,7 @@ static void route_source_output(struct userdata *u, pa_source_output *so) {
return; return;
if (so->source != source) if (so->source != source)
pa_source_output_move_to(so, source, FALSE); pa_source_output_move_to(so, source, false);
} }
static pa_hook_result_t route_source_outputs(struct userdata *u, pa_source* ignore_source) { static pa_hook_result_t route_source_outputs(struct userdata *u, pa_source* ignore_source) {
@ -966,7 +966,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
pa_sink *sink; pa_sink *sink;
if ((sink = pa_idxset_get_by_index(u->core->sinks, device_index))) { if ((sink = pa_idxset_get_by_index(u->core->sinks, device_index))) {
if (!pa_sink_input_new_data_set_sink(new_data, sink, FALSE)) if (!pa_sink_input_new_data_set_sink(new_data, sink, false))
pa_log_debug("Not restoring device for stream because no supported format was found"); pa_log_debug("Not restoring device for stream because no supported format was found");
} }
} }
@ -1006,7 +1006,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
pa_source *source; pa_source *source;
if ((source = pa_idxset_get_by_index(u->core->sources, device_index))) if ((source = pa_idxset_get_by_index(u->core->sources, device_index)))
if (!pa_source_output_new_data_set_source(new_data, source, FALSE)) if (!pa_source_output_new_data_set_source(new_data, source, false))
pa_log_debug("Not restoring device for stream because no supported format was found"); pa_log_debug("Not restoring device for stream because no supported format was found");
} }
} }
@ -1143,7 +1143,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
case SUBCOMMAND_READ: { case SUBCOMMAND_READ: {
pa_datum key; pa_datum key;
pa_bool_t done; bool done;
if (!pa_tagstruct_eof(t)) if (!pa_tagstruct_eof(t))
goto fail; goto fail;
@ -1222,7 +1222,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
if ((e = entry_read(u, device))) { if ((e = entry_read(u, device))) {
pa_xfree(e->description); pa_xfree(e->description);
e->description = pa_xstrdup(description); e->description = pa_xstrdup(description);
e->user_set_description = TRUE; e->user_set_description = true;
if (entry_write(u, (char *)device, e)) { if (entry_write(u, (char *)device, e)) {
apply_entry(u, device, e); apply_entry(u, device, e);
@ -1262,7 +1262,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
case SUBCOMMAND_ROLE_DEVICE_PRIORITY_ROUTING: { case SUBCOMMAND_ROLE_DEVICE_PRIORITY_ROUTING: {
pa_bool_t enable; bool enable;
if (pa_tagstruct_get_boolean(t, &enable) < 0) if (pa_tagstruct_get_boolean(t, &enable) < 0)
goto fail; goto fail;
@ -1282,14 +1282,14 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
struct entry *e; struct entry *e;
uint32_t role_index, n_devices; uint32_t role_index, n_devices;
pa_datum key; pa_datum key;
pa_bool_t done, sink_mode = TRUE; bool done, sink_mode = true;
struct device_t { uint32_t prio; char *device; }; struct device_t { uint32_t prio; char *device; };
struct device_t *device; struct device_t *device;
struct device_t **devices; struct device_t **devices;
uint32_t i, idx, offset; uint32_t i, idx, offset;
pa_hashmap *h; pa_hashmap *h;
/*void *state;*/ /*void *state;*/
pa_bool_t first; bool first;
if (pa_tagstruct_gets(t, &role) < 0 || if (pa_tagstruct_gets(t, &role) < 0 ||
pa_tagstruct_getu32(t, &n_devices) < 0 || pa_tagstruct_getu32(t, &n_devices) < 0 ||
@ -1301,7 +1301,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
/* 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);
first = TRUE; first = true;
idx = 0; idx = 0;
for (i = 0; i < n_devices; ++i) { for (i = 0; i < n_devices; ++i) {
const char *s; const char *s;
@ -1330,7 +1330,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
entry_free(e); entry_free(e);
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)) || (!sink_mode && 0 != strncmp("source:", s, 7))) { } else if ((sink_mode && 0 != strncmp("sink:", s, 5)) || (!sink_mode && 0 != strncmp("source:", s, 7))) {
while ((device = pa_hashmap_steal_first(h))) { while ((device = pa_hashmap_steal_first(h))) {
@ -1432,7 +1432,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
/* Go through in order and write the new entry and cleanup our own list */ /* Go through in order and write the new entry and cleanup our own list */
idx = 1; idx = 1;
first = TRUE; first = true;
for (i = 0; i < n_devices; ++i) { for (i = 0; i < n_devices; ++i) {
if ((e = entry_read(u, devices[i]->device))) { if ((e = entry_read(u, devices[i]->device))) {
if (e->priority[role_index] == idx) if (e->priority[role_index] == idx)
@ -1441,7 +1441,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
e->priority[role_index] = idx; e->priority[role_index] = idx;
if (entry_write(u, (char *) devices[i]->device, e)) { if (entry_write(u, (char *) devices[i]->device, e)) {
first = FALSE; first = false;
idx++; idx++;
} }
} }
@ -1468,7 +1468,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
case SUBCOMMAND_SUBSCRIBE: { case SUBCOMMAND_SUBSCRIBE: {
pa_bool_t enabled; bool enabled;
if (pa_tagstruct_get_boolean(t, &enabled) < 0 || if (pa_tagstruct_get_boolean(t, &enabled) < 0 ||
!pa_tagstruct_eof(t)) !pa_tagstruct_eof(t))
@ -1518,7 +1518,7 @@ int pa__init(pa_module*m) {
pa_sink *sink; pa_sink *sink;
pa_source *source; pa_source *source;
uint32_t idx; uint32_t idx;
pa_bool_t do_routing = FALSE, on_hotplug = TRUE, on_rescue = TRUE; bool do_routing = false, on_hotplug = true, on_rescue = true;
uint32_t total_devices; uint32_t total_devices;
pa_assert(m); pa_assert(m);
@ -1571,10 +1571,10 @@ int pa__init(pa_module*m) {
u->source_unlink_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK], PA_HOOK_LATE+5, (pa_hook_cb_t) source_unlink_hook_callback, u); u->source_unlink_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK], PA_HOOK_LATE+5, (pa_hook_cb_t) source_unlink_hook_callback, u);
} }
if (!(fname = pa_state_path("device-manager", TRUE))) if (!(fname = pa_state_path("device-manager", true)))
goto fail; goto fail;
if (!(u->database = pa_database_open(fname, TRUE))) { if (!(u->database = pa_database_open(fname, true))) {
pa_log("Failed to open volume database '%s': %s", fname, pa_cstrerror(errno)); pa_log("Failed to open volume database '%s': %s", fname, pa_cstrerror(errno));
pa_xfree(fname); pa_xfree(fname);
goto fail; goto fail;

View file

@ -59,7 +59,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Automatically restore the volume/mute state of devices"); PA_MODULE_DESCRIPTION("Automatically restore the volume/mute state of devices");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"restore_port=<Save/restore port?> " "restore_port=<Save/restore port?> "
"restore_volume=<Save/restore volumes?> " "restore_volume=<Save/restore volumes?> "
@ -95,10 +95,10 @@ struct userdata {
pa_native_protocol *protocol; pa_native_protocol *protocol;
pa_idxset *subscribed; pa_idxset *subscribed;
pa_bool_t restore_volume:1; bool restore_volume:1;
pa_bool_t restore_muted:1; bool restore_muted:1;
pa_bool_t restore_port:1; bool restore_port:1;
pa_bool_t restore_formats:1; bool restore_formats:1;
}; };
/* Protocol extension commands */ /* Protocol extension commands */
@ -115,7 +115,7 @@ enum {
struct entry { struct entry {
uint8_t version; uint8_t version;
pa_bool_t port_valid; bool port_valid;
char *port; char *port;
}; };
@ -123,8 +123,8 @@ struct entry {
struct perportentry { struct perportentry {
uint8_t version; uint8_t version;
pa_bool_t muted_valid, volume_valid; bool muted_valid, volume_valid;
pa_bool_t muted; bool muted;
pa_channel_map channel_map; pa_channel_map channel_map;
pa_cvolume volume; pa_cvolume volume;
pa_idxset *formats; pa_idxset *formats;
@ -174,9 +174,9 @@ static void trigger_save(struct userdata *u, pa_device_type_t type, uint32_t sin
#ifdef ENABLE_LEGACY_DATABASE_ENTRY_FORMAT #ifdef ENABLE_LEGACY_DATABASE_ENTRY_FORMAT
/* Some forward declarations */ /* Some forward declarations */
static pa_bool_t legacy_entry_read(struct userdata *u, pa_datum *data, struct entry **entry, struct perportentry **perportentry); static bool legacy_entry_read(struct userdata *u, pa_datum *data, struct entry **entry, struct perportentry **perportentry);
static struct perportentry* perportentry_read(struct userdata *u, const char *basekeyname, const char *port); static struct perportentry* perportentry_read(struct userdata *u, const char *basekeyname, const char *port);
static pa_bool_t perportentry_write(struct userdata *u, const char *basekeyname, const char *port, const struct perportentry *e); static bool perportentry_write(struct userdata *u, const char *basekeyname, const char *port, const struct perportentry *e);
static void perportentry_free(struct perportentry* e); static void perportentry_free(struct perportentry* e);
#endif #endif
@ -193,10 +193,10 @@ static void entry_free(struct entry* e) {
pa_xfree(e); pa_xfree(e);
} }
static pa_bool_t entry_write(struct userdata *u, const char *name, const struct entry *e) { static bool entry_write(struct userdata *u, const char *name, const struct entry *e) {
pa_tagstruct *t; pa_tagstruct *t;
pa_datum key, data; pa_datum key, data;
pa_bool_t r; bool r;
pa_assert(u); pa_assert(u);
pa_assert(name); pa_assert(name);
@ -212,7 +212,7 @@ static pa_bool_t entry_write(struct userdata *u, const char *name, const struct
data.data = (void*)pa_tagstruct_data(t, &data.size); data.data = (void*)pa_tagstruct_data(t, &data.size);
r = (pa_database_set(u->database, &key, &data, TRUE) == 0); r = (pa_database_set(u->database, &key, &data, true) == 0);
pa_tagstruct_free(t); pa_tagstruct_free(t);
@ -271,7 +271,7 @@ fail:
struct perportentry *ppe; struct perportentry *ppe;
pa_log_debug("Attempting to load legacy (pre-v1.0) data for key: %s", name); pa_log_debug("Attempting to load legacy (pre-v1.0) data for key: %s", name);
if (legacy_entry_read(u, &data, &e, &ppe)) { if (legacy_entry_read(u, &data, &e, &ppe)) {
pa_bool_t written = FALSE; bool written = false;
pa_log_debug("Success. Saving new format for key: %s", name); pa_log_debug("Success. Saving new format for key: %s", name);
written = entry_write(u, name, e); written = entry_write(u, name, e);
@ -323,18 +323,18 @@ static struct entry* entry_copy(const struct entry *e) {
return r; return r;
} }
static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) { static bool entries_equal(const struct entry *a, const struct entry *b) {
pa_assert(a && b); pa_assert(a && b);
if (a->port_valid != b->port_valid || if (a->port_valid != b->port_valid ||
(a->port_valid && !pa_streq(a->port, b->port))) (a->port_valid && !pa_streq(a->port, b->port)))
return FALSE; return false;
return TRUE; return true;
} }
static struct perportentry* perportentry_new(pa_bool_t add_pcm_format) { static struct perportentry* perportentry_new(bool add_pcm_format) {
struct perportentry *r = pa_xnew0(struct perportentry, 1); struct perportentry *r = pa_xnew0(struct perportentry, 1);
r->version = PERPORTENTRY_VERSION; r->version = PERPORTENTRY_VERSION;
r->formats = pa_idxset_new(NULL, NULL); r->formats = pa_idxset_new(NULL, NULL);
@ -353,10 +353,10 @@ static void perportentry_free(struct perportentry* e) {
pa_xfree(e); pa_xfree(e);
} }
static pa_bool_t perportentry_write(struct userdata *u, const char *basekeyname, const char *port, const struct perportentry *e) { static bool perportentry_write(struct userdata *u, const char *basekeyname, const char *port, const struct perportentry *e) {
pa_tagstruct *t; pa_tagstruct *t;
pa_datum key, data; pa_datum key, data;
pa_bool_t r; bool r;
uint32_t i; uint32_t i;
pa_format_info *f; pa_format_info *f;
uint8_t n_formats; uint8_t n_formats;
@ -389,7 +389,7 @@ static pa_bool_t perportentry_write(struct userdata *u, const char *basekeyname,
data.data = (void*)pa_tagstruct_data(t, &data.size); data.data = (void*)pa_tagstruct_data(t, &data.size);
r = (pa_database_set(u->database, &key, &data, TRUE) == 0); r = (pa_database_set(u->database, &key, &data, true) == 0);
pa_tagstruct_free(t); pa_tagstruct_free(t);
pa_xfree(name); pa_xfree(name);
@ -418,7 +418,7 @@ static struct perportentry* perportentry_read(struct userdata *u, const char *ba
goto fail; goto fail;
t = pa_tagstruct_new(data.data, data.size); t = pa_tagstruct_new(data.data, data.size);
e = perportentry_new(FALSE); e = perportentry_new(false);
if (pa_tagstruct_getu8(t, &e->version) < 0 || if (pa_tagstruct_getu8(t, &e->version) < 0 ||
e->version > PERPORTENTRY_VERSION || e->version > PERPORTENTRY_VERSION ||
@ -490,7 +490,7 @@ static struct perportentry* perportentry_copy(const struct perportentry *e) {
pa_format_info *f; pa_format_info *f;
pa_assert(e); pa_assert(e);
r = perportentry_new(FALSE); r = perportentry_new(false);
r->version = e->version; r->version = e->version;
r->muted_valid = e->muted_valid; r->muted_valid = e->muted_valid;
r->volume_valid = e->volume_valid; r->volume_valid = e->volume_valid;
@ -504,36 +504,36 @@ static struct perportentry* perportentry_copy(const struct perportentry *e) {
return r; return r;
} }
static pa_bool_t perportentries_equal(const struct perportentry *a, const struct perportentry *b) { static bool perportentries_equal(const struct perportentry *a, const struct perportentry *b) {
pa_cvolume t; pa_cvolume t;
pa_assert(a && b); pa_assert(a && b);
if (a->muted_valid != b->muted_valid || if (a->muted_valid != b->muted_valid ||
(a->muted_valid && (a->muted != b->muted))) (a->muted_valid && (a->muted != b->muted)))
return FALSE; return false;
t = b->volume; t = b->volume;
if (a->volume_valid != b->volume_valid || if (a->volume_valid != b->volume_valid ||
(a->volume_valid && !pa_cvolume_equal(pa_cvolume_remap(&t, &b->channel_map, &a->channel_map), &a->volume))) (a->volume_valid && !pa_cvolume_equal(pa_cvolume_remap(&t, &b->channel_map, &a->channel_map), &a->volume)))
return FALSE; return false;
if (pa_idxset_size(a->formats) != pa_idxset_size(b->formats)) if (pa_idxset_size(a->formats) != pa_idxset_size(b->formats))
return FALSE; return false;
/** TODO: Compare a bit better */ /** TODO: Compare a bit better */
return TRUE; return true;
} }
#ifdef ENABLE_LEGACY_DATABASE_ENTRY_FORMAT #ifdef ENABLE_LEGACY_DATABASE_ENTRY_FORMAT
#define LEGACY_ENTRY_VERSION 2 #define LEGACY_ENTRY_VERSION 2
static pa_bool_t legacy_entry_read(struct userdata *u, pa_datum *data, struct entry **entry, struct perportentry **perportentry) { static bool legacy_entry_read(struct userdata *u, pa_datum *data, struct entry **entry, struct perportentry **perportentry) {
struct legacy_entry { struct legacy_entry {
uint8_t version; uint8_t version;
pa_bool_t muted_valid:1, volume_valid:1, port_valid:1; bool muted_valid:1, volume_valid:1, port_valid:1;
pa_bool_t muted:1; bool muted:1;
pa_channel_map channel_map; pa_channel_map channel_map;
pa_cvolume volume; pa_cvolume volume;
char port[PA_NAME_MAX]; char port[PA_NAME_MAX];
@ -547,43 +547,43 @@ static pa_bool_t legacy_entry_read(struct userdata *u, pa_datum *data, struct en
if (data->size != sizeof(struct legacy_entry)) { if (data->size != sizeof(struct legacy_entry)) {
pa_log_debug("Size does not match."); pa_log_debug("Size does not match.");
return FALSE; return false;
} }
le = (struct legacy_entry*)data->data; le = (struct legacy_entry*)data->data;
if (le->version != LEGACY_ENTRY_VERSION) { if (le->version != LEGACY_ENTRY_VERSION) {
pa_log_debug("Version mismatch."); pa_log_debug("Version mismatch.");
return FALSE; return false;
} }
if (!memchr(le->port, 0, sizeof(le->port))) { if (!memchr(le->port, 0, sizeof(le->port))) {
pa_log_warn("Port has missing NUL byte."); pa_log_warn("Port has missing NUL byte.");
return FALSE; return false;
} }
if (le->volume_valid && !pa_channel_map_valid(&le->channel_map)) { if (le->volume_valid && !pa_channel_map_valid(&le->channel_map)) {
pa_log_warn("Invalid channel map."); pa_log_warn("Invalid channel map.");
return FALSE; return false;
} }
if (le->volume_valid && (!pa_cvolume_valid(&le->volume) || !pa_cvolume_compatible_with_channel_map(&le->volume, &le->channel_map))) { if (le->volume_valid && (!pa_cvolume_valid(&le->volume) || !pa_cvolume_compatible_with_channel_map(&le->volume, &le->channel_map))) {
pa_log_warn("Volume and channel map don't match."); pa_log_warn("Volume and channel map don't match.");
return FALSE; return false;
} }
*entry = entry_new(); *entry = entry_new();
(*entry)->port_valid = le->port_valid; (*entry)->port_valid = le->port_valid;
(*entry)->port = pa_xstrdup(le->port); (*entry)->port = pa_xstrdup(le->port);
*perportentry = perportentry_new(TRUE); *perportentry = perportentry_new(true);
(*perportentry)->muted_valid = le->muted_valid; (*perportentry)->muted_valid = le->muted_valid;
(*perportentry)->volume_valid = le->volume_valid; (*perportentry)->volume_valid = le->volume_valid;
(*perportentry)->muted = le->muted; (*perportentry)->muted = le->muted;
(*perportentry)->channel_map = le->channel_map; (*perportentry)->channel_map = le->channel_map;
(*perportentry)->volume = le->volume; (*perportentry)->volume = le->volume;
return TRUE; return true;
} }
#endif #endif
@ -594,7 +594,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
char *name; char *name;
const char *port = NULL; const char *port = NULL;
pa_device_type_t type; pa_device_type_t type;
pa_bool_t written = FALSE; bool written = false;
pa_assert(c); pa_assert(c);
pa_assert(u); pa_assert(u);
@ -624,23 +624,23 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if (sink->save_port) { if (sink->save_port) {
pa_xfree(e->port); pa_xfree(e->port);
e->port = pa_xstrdup(port ? port : ""); e->port = pa_xstrdup(port ? port : "");
e->port_valid = TRUE; e->port_valid = true;
} }
if ((oldppe = perportentry_read(u, name, port))) if ((oldppe = perportentry_read(u, name, port)))
ppe = perportentry_copy(oldppe); ppe = perportentry_copy(oldppe);
else else
ppe = perportentry_new(TRUE); ppe = perportentry_new(true);
if (sink->save_volume) { if (sink->save_volume) {
ppe->channel_map = sink->channel_map; ppe->channel_map = sink->channel_map;
ppe->volume = *pa_sink_get_volume(sink, FALSE); ppe->volume = *pa_sink_get_volume(sink, false);
ppe->volume_valid = TRUE; ppe->volume_valid = true;
} }
if (sink->save_muted) { if (sink->save_muted) {
ppe->muted = pa_sink_get_mute(sink, FALSE); ppe->muted = pa_sink_get_mute(sink, false);
ppe->muted_valid = TRUE; ppe->muted_valid = true;
} }
} else { } else {
pa_source *source; pa_source *source;
@ -663,23 +663,23 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if (source->save_port) { if (source->save_port) {
pa_xfree(e->port); pa_xfree(e->port);
e->port = pa_xstrdup(port ? port : ""); e->port = pa_xstrdup(port ? port : "");
e->port_valid = TRUE; e->port_valid = true;
} }
if ((oldppe = perportentry_read(u, name, port))) if ((oldppe = perportentry_read(u, name, port)))
ppe = perportentry_copy(oldppe); ppe = perportentry_copy(oldppe);
else else
ppe = perportentry_new(TRUE); ppe = perportentry_new(true);
if (source->save_volume) { if (source->save_volume) {
ppe->channel_map = source->channel_map; ppe->channel_map = source->channel_map;
ppe->volume = *pa_source_get_volume(source, FALSE); ppe->volume = *pa_source_get_volume(source, false);
ppe->volume_valid = TRUE; ppe->volume_valid = true;
} }
if (source->save_muted) { if (source->save_muted) {
ppe->muted = pa_source_get_mute(source, FALSE); ppe->muted = pa_source_get_mute(source, false);
ppe->muted_valid = TRUE; ppe->muted_valid = true;
} }
} }
@ -745,7 +745,7 @@ static pa_hook_result_t sink_new_hook_callback(pa_core *c, pa_sink_new_data *new
if (!new_data->active_port) { if (!new_data->active_port) {
pa_log_info("Restoring port for sink %s.", name); pa_log_info("Restoring port for sink %s.", name);
pa_sink_new_data_set_port(new_data, e->port); pa_sink_new_data_set_port(new_data, e->port);
new_data->save_port = TRUE; new_data->save_port = true;
} else } else
pa_log_debug("Not restoring port for sink %s, because already set.", name); pa_log_debug("Not restoring port for sink %s, because already set.", name);
} }
@ -783,7 +783,7 @@ static pa_hook_result_t sink_fixate_hook_callback(pa_core *c, pa_sink_new_data *
pa_sink_new_data_set_volume(new_data, &v); pa_sink_new_data_set_volume(new_data, &v);
pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &new_data->volume)); pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &new_data->volume));
new_data->save_volume = TRUE; new_data->save_volume = true;
} else } else
pa_log_debug("Not restoring volume for sink %s, because already set.", new_data->name); pa_log_debug("Not restoring volume for sink %s, because already set.", new_data->name);
} }
@ -793,7 +793,7 @@ static pa_hook_result_t sink_fixate_hook_callback(pa_core *c, pa_sink_new_data *
if (!new_data->muted_is_set) { if (!new_data->muted_is_set) {
pa_log_info("Restoring mute state for sink %s.", new_data->name); pa_log_info("Restoring mute state for sink %s.", new_data->name);
pa_sink_new_data_set_muted(new_data, e->muted); pa_sink_new_data_set_muted(new_data, e->muted);
new_data->save_muted = TRUE; new_data->save_muted = true;
} else } else
pa_log_debug("Not restoring mute state for sink %s, because already set.", new_data->name); pa_log_debug("Not restoring mute state for sink %s, because already set.", new_data->name);
} }
@ -826,17 +826,17 @@ static pa_hook_result_t sink_port_hook_callback(pa_core *c, pa_sink *sink, struc
pa_log_info("Restoring volume for sink %s.", sink->name); pa_log_info("Restoring volume for sink %s.", sink->name);
v = e->volume; v = e->volume;
pa_cvolume_remap(&v, &e->channel_map, &sink->channel_map); pa_cvolume_remap(&v, &e->channel_map, &sink->channel_map);
pa_sink_set_volume(sink, &v, TRUE, FALSE); pa_sink_set_volume(sink, &v, true, false);
pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &sink->reference_volume)); pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &sink->reference_volume));
sink->save_volume = TRUE; sink->save_volume = true;
} }
if (u->restore_muted && e->muted_valid) { if (u->restore_muted && e->muted_valid) {
pa_log_info("Restoring mute state for sink %s.", sink->name); pa_log_info("Restoring mute state for sink %s.", sink->name);
pa_sink_set_mute(sink, e->muted, FALSE); pa_sink_set_mute(sink, e->muted, false);
sink->save_muted = TRUE; sink->save_muted = true;
} }
perportentry_free(e); perportentry_free(e);
@ -888,7 +888,7 @@ static pa_hook_result_t source_new_hook_callback(pa_core *c, pa_source_new_data
if (!new_data->active_port) { if (!new_data->active_port) {
pa_log_info("Restoring port for source %s.", name); pa_log_info("Restoring port for source %s.", name);
pa_source_new_data_set_port(new_data, e->port); pa_source_new_data_set_port(new_data, e->port);
new_data->save_port = TRUE; new_data->save_port = true;
} else } else
pa_log_debug("Not restoring port for source %s, because already set.", name); pa_log_debug("Not restoring port for source %s, because already set.", name);
} }
@ -926,7 +926,7 @@ static pa_hook_result_t source_fixate_hook_callback(pa_core *c, pa_source_new_da
pa_source_new_data_set_volume(new_data, &v); pa_source_new_data_set_volume(new_data, &v);
pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &new_data->volume)); pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &new_data->volume));
new_data->save_volume = TRUE; new_data->save_volume = true;
} else } else
pa_log_debug("Not restoring volume for source %s, because already set.", new_data->name); pa_log_debug("Not restoring volume for source %s, because already set.", new_data->name);
} }
@ -936,7 +936,7 @@ static pa_hook_result_t source_fixate_hook_callback(pa_core *c, pa_source_new_da
if (!new_data->muted_is_set) { if (!new_data->muted_is_set) {
pa_log_info("Restoring mute state for source %s.", new_data->name); pa_log_info("Restoring mute state for source %s.", new_data->name);
pa_source_new_data_set_muted(new_data, e->muted); pa_source_new_data_set_muted(new_data, e->muted);
new_data->save_muted = TRUE; new_data->save_muted = true;
} else } else
pa_log_debug("Not restoring mute state for source %s, because already set.", new_data->name); pa_log_debug("Not restoring mute state for source %s, because already set.", new_data->name);
} }
@ -969,17 +969,17 @@ static pa_hook_result_t source_port_hook_callback(pa_core *c, pa_source *source,
pa_log_info("Restoring volume for source %s.", source->name); pa_log_info("Restoring volume for source %s.", source->name);
v = e->volume; v = e->volume;
pa_cvolume_remap(&v, &e->channel_map, &source->channel_map); pa_cvolume_remap(&v, &e->channel_map, &source->channel_map);
pa_source_set_volume(source, &v, TRUE, FALSE); pa_source_set_volume(source, &v, true, false);
pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &source->reference_volume)); pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &source->reference_volume));
source->save_volume = TRUE; source->save_volume = true;
} }
if (u->restore_muted && e->muted_valid) { if (u->restore_muted && e->muted_valid) {
pa_log_info("Restoring mute state for source %s.", source->name); pa_log_info("Restoring mute state for source %s.", source->name);
pa_source_set_mute(source, e->muted, FALSE); pa_source_set_mute(source, e->muted, false);
source->save_muted = TRUE; source->save_muted = true;
} }
perportentry_free(e); perportentry_free(e);
@ -1057,7 +1057,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
case SUBCOMMAND_SUBSCRIBE: { case SUBCOMMAND_SUBSCRIBE: {
pa_bool_t enabled; bool enabled;
if (pa_tagstruct_get_boolean(t, &enabled) < 0 || if (pa_tagstruct_get_boolean(t, &enabled) < 0 ||
!pa_tagstruct_eof(t)) !pa_tagstruct_eof(t))
@ -1144,7 +1144,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
/* Read or create an entry */ /* Read or create an entry */
name = pa_sprintf_malloc("sink:%s", sink->name); name = pa_sprintf_malloc("sink:%s", sink->name);
if (!(e = perportentry_read(u, name, (sink->active_port ? sink->active_port->name : NULL)))) if (!(e = perportentry_read(u, name, (sink->active_port ? sink->active_port->name : NULL))))
e = perportentry_new(FALSE); e = perportentry_new(false);
else { else {
/* Clean out any saved formats */ /* Clean out any saved formats */
pa_idxset_free(e->formats, (pa_free_cb_t) pa_format_info_free); pa_idxset_free(e->formats, (pa_free_cb_t) pa_format_info_free);
@ -1210,7 +1210,7 @@ int pa__init(pa_module*m) {
pa_sink *sink; pa_sink *sink;
pa_source *source; pa_source *source;
uint32_t idx; uint32_t idx;
pa_bool_t restore_volume = TRUE, restore_muted = TRUE, restore_port = TRUE, restore_formats = TRUE; bool restore_volume = true, restore_muted = true, restore_port = true, restore_formats = true;
pa_assert(m); pa_assert(m);
@ -1263,10 +1263,10 @@ int pa__init(pa_module*m) {
if (restore_formats) if (restore_formats)
u->sink_put_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_EARLY, (pa_hook_cb_t) sink_put_hook_callback, u); u->sink_put_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_EARLY, (pa_hook_cb_t) sink_put_hook_callback, u);
if (!(fname = pa_state_path("device-volumes", TRUE))) if (!(fname = pa_state_path("device-volumes", true)))
goto fail; goto fail;
if (!(u->database = pa_database_open(fname, TRUE))) { if (!(u->database = pa_database_open(fname, true))) {
pa_log("Failed to open volume database '%s': %s", fname, pa_cstrerror(errno)); pa_log("Failed to open volume database '%s': %s", fname, pa_cstrerror(errno));
pa_xfree(fname); pa_xfree(fname);
goto fail; goto fail;

View file

@ -71,7 +71,7 @@
PA_MODULE_AUTHOR("Jason Newton"); PA_MODULE_AUTHOR("Jason Newton");
PA_MODULE_DESCRIPTION(_("General Purpose Equalizer")); PA_MODULE_DESCRIPTION(_("General Purpose Equalizer"));
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
_("sink_name=<name of the sink> " _("sink_name=<name of the sink> "
"sink_properties=<properties for the sink> " "sink_properties=<properties for the sink> "
@ -85,13 +85,13 @@ PA_MODULE_USAGE(
)); ));
#define MEMBLOCKQ_MAXLENGTH (16*1024*1024) #define MEMBLOCKQ_MAXLENGTH (16*1024*1024)
#define DEFAULT_AUTOLOADED FALSE #define DEFAULT_AUTOLOADED false
struct userdata { struct userdata {
pa_module *module; pa_module *module;
pa_sink *sink; pa_sink *sink;
pa_sink_input *sink_input; pa_sink_input *sink_input;
pa_bool_t autoloaded; bool autoloaded;
size_t channels; size_t channels;
size_t fft_size;//length (res) of fft size_t fft_size;//length (res) of fft
@ -122,7 +122,7 @@ struct userdata {
size_t output_buffer_length; size_t output_buffer_length;
size_t output_buffer_max_length; size_t output_buffer_max_length;
pa_memblockq *output_q; pa_memblockq *output_q;
pa_bool_t first_iteration; bool first_iteration;
pa_dbus_protocol *dbus_protocol; pa_dbus_protocol *dbus_protocol;
char *dbus_path; char *dbus_path;
@ -197,17 +197,17 @@ static void interpolate(float *samples, size_t length, uint32_t *xs, float *ys,
samples[length-1] = ys[n_points-1]; samples[length-1] = ys[n_points-1];
} }
static pa_bool_t is_monotonic(const uint32_t *xs, size_t length) { static bool is_monotonic(const uint32_t *xs, size_t length) {
pa_assert(xs); pa_assert(xs);
if (length < 2) if (length < 2)
return TRUE; return true;
for(size_t i = 1; i < length; ++i) for(size_t i = 1; i < length; ++i)
if (xs[i] <= xs[i-1]) if (xs[i] <= xs[i-1])
return FALSE; return false;
return TRUE; return true;
} }
/* ensures memory allocated is a multiple of v_size and aligned */ /* ensures memory allocated is a multiple of v_size and aligned */
@ -301,7 +301,7 @@ static void sink_request_rewind_cb(pa_sink *s) {
return; return;
/* Just hand this one over to the master sink */ /* Just hand this one over to the master sink */
pa_sink_input_request_rewind(u->sink_input, s->thread_info.rewind_nbytes+pa_memblockq_get_length(u->input_q), TRUE, FALSE, FALSE); pa_sink_input_request_rewind(u->sink_input, s->thread_info.rewind_nbytes+pa_memblockq_get_length(u->input_q), true, false, false);
} }
/* Called from I/O thread context */ /* Called from I/O thread context */
@ -332,7 +332,7 @@ static void sink_set_volume_cb(pa_sink *s) {
!PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input))) !PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input)))
return; return;
pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, TRUE); pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, true);
} }
/* Called from main context */ /* Called from main context */
@ -564,7 +564,7 @@ static void process_samples(struct userdata *u) {
pa_sample_clamp(PA_SAMPLE_FLOAT32NE, (uint8_t *) (((float *)u->output_buffer) + c) + offset, fs, u->work_buffer, sizeof(float), u->R); pa_sample_clamp(PA_SAMPLE_FLOAT32NE, (uint8_t *) (((float *)u->output_buffer) + c) + offset, fs, u->work_buffer, sizeof(float), u->R);
} }
if (u->first_iteration) { if (u->first_iteration) {
u->first_iteration = FALSE; u->first_iteration = false;
} }
u->samples_gathered -= u->R; u->samples_gathered -= u->R;
} }
@ -711,7 +711,7 @@ static void reset_filter(struct userdata *u) {
for(size_t i = 0; i < u->channels; ++i) for(size_t i = 0; i < u->channels; ++i)
pa_memzero(u->overlap_accum[i], u->overlap_size * sizeof(float)); pa_memzero(u->overlap_accum[i], u->overlap_size * sizeof(float));
u->first_iteration = TRUE; u->first_iteration = true;
//set buffer size to max request, no overlap copy //set buffer size to max request, no overlap copy
max_request = PA_ROUND_UP(pa_sink_input_get_max_request(u->sink_input) / fs , u->R); max_request = PA_ROUND_UP(pa_sink_input_get_max_request(u->sink_input) / fs , u->R);
max_request = PA_MAX(max_request, u->window_size); max_request = PA_MAX(max_request, u->window_size);
@ -739,7 +739,7 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
if (amount > 0) { if (amount > 0) {
//invalidate the output q //invalidate the output q
pa_memblockq_seek(u->input_q, - (int64_t) amount, PA_SEEK_RELATIVE, TRUE); pa_memblockq_seek(u->input_q, - (int64_t) amount, PA_SEEK_RELATIVE, true);
pa_log("Resetting filter"); pa_log("Resetting filter");
//reset_filter(u); //this is the "proper" thing to do... //reset_filter(u); //this is the "proper" thing to do...
} }
@ -851,7 +851,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
/* Leave u->sink alone for now, it will be cleaned up on module /* Leave u->sink alone for now, it will be cleaned up on module
* unload (and it is needed during unload as well). */ * unload (and it is needed during unload as well). */
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from IO thread context */ /* Called from IO thread context */
@ -866,7 +866,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
if (PA_SINK_INPUT_IS_LINKED(state) && if (PA_SINK_INPUT_IS_LINKED(state) &&
i->thread_info.state == PA_SINK_INPUT_INIT) { i->thread_info.state == PA_SINK_INPUT_INIT) {
pa_log_debug("Requesting rewind due to state change."); pa_log_debug("Requesting rewind due to state change.");
pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); pa_sink_input_request_rewind(i, 0, false, true, true);
} }
} }
@ -924,7 +924,7 @@ static void save_profile(struct userdata *u, size_t channel, char *name) {
key.size = strlen(key.data); key.size = strlen(key.data);
data.data = profile; data.data = profile;
data.size = profile_size; data.size = profile_size;
pa_database_set(u->database, &key, &data, TRUE); pa_database_set(u->database, &key, &data, true);
pa_database_sync(u->database); pa_database_sync(u->database);
if (u->base_profiles[channel]) { if (u->base_profiles[channel]) {
pa_xfree(u->base_profiles[channel]); pa_xfree(u->base_profiles[channel]);
@ -962,11 +962,11 @@ static void save_state(struct userdata *u) {
data.data = state; data.data = state;
data.size = filter_state_size + packed_length; data.size = filter_state_size + packed_length;
//thread safety for 0.9.17? //thread safety for 0.9.17?
pa_assert_se(dbname = pa_state_path(EQ_STATE_DB, FALSE)); pa_assert_se(dbname = pa_state_path(EQ_STATE_DB, false));
pa_assert_se(database = pa_database_open(dbname, TRUE)); pa_assert_se(database = pa_database_open(dbname, true));
pa_xfree(dbname); pa_xfree(dbname);
pa_database_set(database, &key, &data, TRUE); pa_database_set(database, &key, &data, true);
pa_database_sync(database); pa_database_sync(database);
pa_database_close(database); pa_database_close(database);
pa_xfree(state); pa_xfree(state);
@ -1014,8 +1014,8 @@ static void load_state(struct userdata *u) {
pa_datum key, value; pa_datum key, value;
pa_database *database; pa_database *database;
char *dbname; char *dbname;
pa_assert_se(dbname = pa_state_path(EQ_STATE_DB, FALSE)); pa_assert_se(dbname = pa_state_path(EQ_STATE_DB, false));
database = pa_database_open(dbname, FALSE); database = pa_database_open(dbname, false);
pa_xfree(dbname); pa_xfree(dbname);
if (!database) { if (!database) {
pa_log("No resume state"); pa_log("No resume state");
@ -1053,14 +1053,14 @@ static void load_state(struct userdata *u) {
} }
/* Called from main context */ /* Called from main context */
static pa_bool_t sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) { static bool sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) {
struct userdata *u; struct userdata *u;
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
pa_assert_se(u = i->userdata); pa_assert_se(u = i->userdata);
if (u->autoloaded) if (u->autoloaded)
return FALSE; return false;
return u->sink != dest; return u->sink != dest;
} }
@ -1092,7 +1092,7 @@ int pa__init(pa_module*m) {
unsigned c; unsigned c;
float *H; float *H;
unsigned a_i; unsigned a_i;
pa_bool_t use_volume_sharing = TRUE; bool use_volume_sharing = true;
pa_assert(m); pa_assert(m);
@ -1161,7 +1161,7 @@ int pa__init(pa_module*m) {
u->inverse_plan = fftwf_plan_dft_c2r_1d(u->fft_size, u->output_window, u->work_buffer, FFTW_ESTIMATE); u->inverse_plan = fftwf_plan_dft_c2r_1d(u->fft_size, u->output_window, u->work_buffer, FFTW_ESTIMATE);
hanning_window(u->W, u->window_size); hanning_window(u->W, u->window_size);
u->first_iteration = TRUE; u->first_iteration = true;
u->base_profiles = pa_xnew0(char *, u->channels); u->base_profiles = pa_xnew0(char *, u->channels);
for (c = 0; c < u->channels; ++c) for (c = 0; c < u->channels; ++c)
@ -1210,7 +1210,7 @@ int pa__init(pa_module*m) {
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb); pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
if (!use_volume_sharing) { if (!use_volume_sharing) {
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb); pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
pa_sink_enable_decibel_volume(u->sink, TRUE); pa_sink_enable_decibel_volume(u->sink, true);
} }
u->sink->userdata = u; u->sink->userdata = u;
@ -1227,7 +1227,7 @@ int pa__init(pa_module*m) {
pa_sink_input_new_data_init(&sink_input_data); pa_sink_input_new_data_init(&sink_input_data);
sink_input_data.driver = __FILE__; sink_input_data.driver = __FILE__;
sink_input_data.module = m; sink_input_data.module = m;
pa_sink_input_new_data_set_sink(&sink_input_data, master, FALSE); pa_sink_input_new_data_set_sink(&sink_input_data, master, false);
sink_input_data.origin_sink = u->sink; sink_input_data.origin_sink = u->sink;
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Equalized Stream"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Equalized Stream");
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
@ -1592,8 +1592,8 @@ void dbus_init(struct userdata *u) {
char *dbname; char *dbname;
sink_list=pa_idxset_new(&pa_idxset_trivial_hash_func, &pa_idxset_trivial_compare_func); sink_list=pa_idxset_new(&pa_idxset_trivial_hash_func, &pa_idxset_trivial_compare_func);
pa_shared_set(u->sink->core, SINKLIST, sink_list); pa_shared_set(u->sink->core, SINKLIST, sink_list);
pa_assert_se(dbname = pa_state_path("equalizer-presets", FALSE)); pa_assert_se(dbname = pa_state_path("equalizer-presets", false));
pa_assert_se(u->database = pa_database_open(dbname, TRUE)); pa_assert_se(u->database = pa_database_open(dbname, true));
pa_xfree(dbname); pa_xfree(dbname);
pa_shared_set(u->sink->core, EQDB, u->database); pa_shared_set(u->sink->core, EQDB, u->database);
pa_dbus_protocol_add_interface(u->dbus_protocol, MANAGER_PATH, &manager_info, u->sink->core); pa_dbus_protocol_add_interface(u->dbus_protocol, MANAGER_PATH, &manager_info, u->sink->core);
@ -1702,7 +1702,7 @@ static void get_profiles(pa_core *c, char ***names, unsigned *n) {
pa_database *database; pa_database *database;
pa_datum key, next_key; pa_datum key, next_key;
pa_strlist *head=NULL, *iter; pa_strlist *head=NULL, *iter;
pa_bool_t done; bool done;
pa_assert_se(database = pa_shared_get(c, EQDB)); pa_assert_se(database = pa_shared_get(c, EQDB));
pa_assert(c); pa_assert(c);
@ -1790,7 +1790,7 @@ void equalizer_handle_seed_filter(DBusConnection *conn, DBusMessage *msg, void *
double *_ys, preamp; double *_ys, preamp;
unsigned x_npoints, y_npoints, a_i; unsigned x_npoints, y_npoints, a_i;
float *H; float *H;
pa_bool_t points_good = TRUE; bool points_good = true;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
@ -1815,7 +1815,7 @@ void equalizer_handle_seed_filter(DBusConnection *conn, DBusMessage *msg, void *
} }
for(size_t i = 0; i < x_npoints; ++i) { for(size_t i = 0; i < x_npoints; ++i) {
if (xs[i] >= FILTER_SIZE(u)) { if (xs[i] >= FILTER_SIZE(u)) {
points_good = FALSE; points_good = false;
break; break;
} }
} }
@ -1868,7 +1868,7 @@ void equalizer_handle_get_filter_points(DBusConnection *conn, DBusMessage *msg,
double *ys, preamp; double *ys, preamp;
unsigned x_npoints, a_i; unsigned x_npoints, a_i;
float *H; float *H;
pa_bool_t points_good=TRUE; bool points_good=true;
DBusMessage *reply = NULL; DBusMessage *reply = NULL;
DBusMessageIter msg_iter; DBusMessageIter msg_iter;
DBusError error; DBusError error;
@ -1894,7 +1894,7 @@ void equalizer_handle_get_filter_points(DBusConnection *conn, DBusMessage *msg,
for(size_t i = 0; i < x_npoints; ++i) { for(size_t i = 0; i < x_npoints; ++i) {
if (xs[i] >= FILTER_SIZE(u)) { if (xs[i] >= FILTER_SIZE(u)) {
points_good=FALSE; points_good=false;
break; break;
} }
} }

View file

@ -36,7 +36,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("ESOUND compatibility module: -spawnfd emulation"); PA_MODULE_DESCRIPTION("ESOUND compatibility module: -spawnfd emulation");
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_USAGE("fd=<file descriptor>"); PA_MODULE_USAGE("fd=<file descriptor>");
@ -66,7 +66,7 @@ int pa__init(pa_module*m) {
pa_assert_se(pa_close(fd) == 0); pa_assert_se(pa_close(fd) == 0);
pa_module_unload_request(m, TRUE); pa_module_unload_request(m, true);
ret = 0; ret = 0;

View file

@ -38,7 +38,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("ESOUND compatibility module: -spawnpid emulation"); PA_MODULE_DESCRIPTION("ESOUND compatibility module: -spawnpid emulation");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE("pid=<process id>"); PA_MODULE_USAGE("pid=<process id>");
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -63,7 +63,7 @@ int pa__init(pa_module*m) {
if (kill((pid_t) pid, SIGUSR1) < 0) if (kill((pid_t) pid, SIGUSR1) < 0)
pa_log_warn("kill(%u) failed: %s", pid, pa_cstrerror(errno)); pa_log_warn("kill(%u) failed: %s", pid, pa_cstrerror(errno));
pa_module_unload_request(m, TRUE); pa_module_unload_request(m, true);
ret = 0; ret = 0;

View file

@ -72,7 +72,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("ESOUND Sink"); PA_MODULE_DESCRIPTION("ESOUND Sink");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> " "sink_properties=<properties for the sink> "
@ -159,7 +159,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
case PA_SINK_RUNNING: case PA_SINK_RUNNING:
if (u->sink->thread_info.state == PA_SINK_SUSPENDED) if (u->sink->thread_info.state == PA_SINK_SUSPENDED)
pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE); pa_smoother_resume(u->smoother, pa_rtclock_now(), true);
break; break;
@ -307,7 +307,7 @@ static void thread_func(void *userdata) {
pollfd->events = (short) (PA_SINK_IS_OPENED(u->sink->thread_info.state) ? POLLOUT : 0); pollfd->events = (short) (PA_SINK_IS_OPENED(u->sink->thread_info.state) ? POLLOUT : 0);
} }
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)
@ -370,7 +370,7 @@ static int do_write(struct userdata *u) {
pa_assert(u->fd < 0); pa_assert(u->fd < 0);
u->fd = pa_iochannel_get_send_fd(u->io); u->fd = pa_iochannel_get_send_fd(u->io);
pa_iochannel_set_noclose(u->io, TRUE); pa_iochannel_set_noclose(u->io, true);
pa_iochannel_free(u->io); pa_iochannel_free(u->io);
u->io = NULL; u->io = NULL;
@ -497,7 +497,7 @@ static void io_callback(pa_iochannel *io, void*userdata) {
u->io = NULL; u->io = NULL;
} }
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
} }
@ -509,7 +509,7 @@ static void on_connection(pa_socket_client *c, pa_iochannel*io, void *userdata)
if (!io) { if (!io) {
pa_log("Connection failed: %s", pa_cstrerror(errno)); pa_log("Connection failed: %s", pa_cstrerror(errno));
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
return; return;
} }
@ -555,11 +555,11 @@ int pa__init(pa_module*m) {
u->smoother = pa_smoother_new( u->smoother = pa_smoother_new(
PA_USEC_PER_SEC, PA_USEC_PER_SEC,
PA_USEC_PER_SEC*2, PA_USEC_PER_SEC*2,
TRUE, true,
TRUE, true,
10, 10,
0, 0,
FALSE); false);
pa_memchunk_reset(&u->memchunk); pa_memchunk_reset(&u->memchunk);
u->offset = 0; u->offset = 0;
@ -613,7 +613,7 @@ int pa__init(pa_module*m) {
pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq); pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
pa_sink_set_rtpoll(u->sink, u->rtpoll); pa_sink_set_rtpoll(u->sink, u->rtpoll);
if (!(u->client = pa_socket_client_new_string(u->core->mainloop, TRUE, espeaker, ESD_DEFAULT_PORT))) { if (!(u->client = pa_socket_client_new_string(u->core->mainloop, true, espeaker, ESD_DEFAULT_PORT))) {
pa_log("Failed to connect to server."); pa_log("Failed to connect to server.");
goto fail; goto fail;
} }
@ -622,7 +622,7 @@ int pa__init(pa_module*m) {
/* Prepare the initial request */ /* Prepare the initial request */
u->write_data = pa_xmalloc(u->write_length = ESD_KEY_LEN + sizeof(int32_t)); u->write_data = pa_xmalloc(u->write_length = ESD_KEY_LEN + sizeof(int32_t));
if (pa_authkey_load_auto(pa_modargs_get_value(ma, "cookie", ".esd_auth"), TRUE, u->write_data, ESD_KEY_LEN) < 0) { if (pa_authkey_load_auto(pa_modargs_get_value(ma, "cookie", ".esd_auth"), true, u->write_data, ESD_KEY_LEN) < 0) {
pa_log("Failed to load cookie"); pa_log("Failed to load cookie");
goto fail; goto fail;
} }

View file

@ -44,7 +44,7 @@
PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_AUTHOR("Colin Guthrie");
PA_MODULE_DESCRIPTION("Load filter sinks automatically when needed"); PA_MODULE_DESCRIPTION("Load filter sinks automatically when needed");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE(_("autoclean=<automatically unload unused filters?>")); PA_MODULE_USAGE(_("autoclean=<automatically unload unused filters?>"));
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -52,7 +52,7 @@ static const char* const valid_modargs[] = {
NULL NULL
}; };
#define DEFAULT_AUTOCLEAN TRUE #define DEFAULT_AUTOCLEAN true
#define HOUSEKEEPING_INTERVAL (10 * PA_USEC_PER_SEC) #define HOUSEKEEPING_INTERVAL (10 * PA_USEC_PER_SEC)
struct filter { struct filter {
@ -78,7 +78,7 @@ struct userdata {
*source_output_proplist_slot, *source_output_proplist_slot,
*source_output_unlink_slot, *source_output_unlink_slot,
*source_unlink_slot; *source_unlink_slot;
pa_bool_t autoclean; bool autoclean;
pa_time_event *housekeeping_time_event; pa_time_event *housekeeping_time_event;
}; };
@ -128,7 +128,7 @@ static void filter_free(struct filter *f) {
pa_xfree(f); pa_xfree(f);
} }
static const char* should_filter(pa_object *o, pa_bool_t is_sink_input) { static const char* should_filter(pa_object *o, bool is_sink_input) {
const char *apply; const char *apply;
pa_proplist *pl; pa_proplist *pl;
@ -148,11 +148,11 @@ static const char* should_filter(pa_object *o, pa_bool_t is_sink_input) {
return NULL; return NULL;
} }
static pa_bool_t should_group_filter(struct filter *filter) { static bool should_group_filter(struct filter *filter) {
return pa_streq(filter->name, "echo-cancel"); return pa_streq(filter->name, "echo-cancel");
} }
static char* get_group(pa_object *o, pa_bool_t is_sink_input) { static char* get_group(pa_object *o, bool is_sink_input) {
pa_proplist *pl; pa_proplist *pl;
if (is_sink_input) if (is_sink_input)
@ -170,7 +170,7 @@ static char* get_group(pa_object *o, pa_bool_t is_sink_input) {
* looking up streams that belong to the same stream group as the original * looking up streams that belong to the same stream group as the original
* object. The idea is that streams from the sam group are always routed * object. The idea is that streams from the sam group are always routed
* together. */ * together. */
static pa_bool_t find_paired_master(struct userdata *u, struct filter *filter, pa_object *o, pa_bool_t is_sink_input) { static bool find_paired_master(struct userdata *u, struct filter *filter, pa_object *o, bool is_sink_input) {
char *group; char *group;
if ((group = get_group(o, is_sink_input))) { if ((group = get_group(o, is_sink_input))) {
@ -182,7 +182,7 @@ static pa_bool_t find_paired_master(struct userdata *u, struct filter *filter, p
pa_source_output *so; pa_source_output *so;
PA_IDXSET_FOREACH(so, u->core->source_outputs, idx) { PA_IDXSET_FOREACH(so, u->core->source_outputs, idx) {
g = get_group(PA_OBJECT(so), FALSE); g = get_group(PA_OBJECT(so), false);
if (pa_streq(g, group)) { if (pa_streq(g, group)) {
if (pa_streq(module_name, so->source->module->name)) { if (pa_streq(module_name, so->source->module->name)) {
@ -203,7 +203,7 @@ static pa_bool_t find_paired_master(struct userdata *u, struct filter *filter, p
pa_sink_input *si; pa_sink_input *si;
PA_IDXSET_FOREACH(si, u->core->sink_inputs, idx) { PA_IDXSET_FOREACH(si, u->core->sink_inputs, idx) {
g = get_group(PA_OBJECT(si), TRUE); g = get_group(PA_OBJECT(si), true);
if (pa_streq(g, group)) { if (pa_streq(g, group)) {
if (pa_streq(module_name, si->sink->module->name)) { if (pa_streq(module_name, si->sink->module->name)) {
@ -226,14 +226,14 @@ static pa_bool_t find_paired_master(struct userdata *u, struct filter *filter, p
pa_xfree(module_name); pa_xfree(module_name);
if (!filter->sink_master || !filter->source_master) if (!filter->sink_master || !filter->source_master)
return FALSE; return false;
} }
return TRUE; return true;
} }
static pa_bool_t nothing_attached(struct filter *f) { static bool nothing_attached(struct filter *f) {
pa_bool_t no_si = TRUE, no_so = TRUE; bool no_si = true, no_so = true;
if (f->sink) if (f->sink)
no_si = pa_idxset_isempty(f->sink->inputs); no_si = pa_idxset_isempty(f->sink->inputs);
@ -264,7 +264,7 @@ static void housekeeping_time_callback(pa_mainloop_api*a, pa_time_event* e, cons
idx = filter->module_index; idx = filter->module_index;
pa_hashmap_remove(u->filters, filter); pa_hashmap_remove(u->filters, filter);
filter_free(filter); filter_free(filter);
pa_module_unload_request_by_index(u->core, idx, TRUE); pa_module_unload_request_by_index(u->core, idx, true);
} }
} }
@ -283,14 +283,14 @@ static void trigger_housekeeping(struct userdata *u) {
u->housekeeping_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + HOUSEKEEPING_INTERVAL, housekeeping_time_callback, u); u->housekeeping_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + HOUSEKEEPING_INTERVAL, housekeeping_time_callback, u);
} }
static int do_move(pa_object *obj, pa_object *parent, pa_bool_t restore, pa_bool_t is_input) { static int do_move(pa_object *obj, pa_object *parent, bool restore, bool is_input) {
if (is_input) if (is_input)
return pa_sink_input_move_to(PA_SINK_INPUT(obj), PA_SINK(parent), restore); return pa_sink_input_move_to(PA_SINK_INPUT(obj), PA_SINK(parent), restore);
else else
return pa_source_output_move_to(PA_SOURCE_OUTPUT(obj), PA_SOURCE(parent), restore); return pa_source_output_move_to(PA_SOURCE_OUTPUT(obj), PA_SOURCE(parent), restore);
} }
static void move_object_for_filter(pa_object *o, struct filter* filter, pa_bool_t restore, pa_bool_t is_sink_input) { static void move_object_for_filter(pa_object *o, struct filter* filter, bool restore, bool is_sink_input) {
pa_object *parent; pa_object *parent;
pa_proplist *pl; pa_proplist *pl;
const char *name; const char *name;
@ -314,7 +314,7 @@ static void move_object_for_filter(pa_object *o, struct filter* filter, pa_bool_
pa_proplist_sets(pl, PA_PROP_FILTER_APPLY_MOVING, "1"); pa_proplist_sets(pl, PA_PROP_FILTER_APPLY_MOVING, "1");
if (do_move(o, parent, FALSE, is_sink_input) < 0) if (do_move(o, parent, false, is_sink_input) < 0)
pa_log_info("Failed to move %s for \"%s\" to <%s>.", is_sink_input ? "sink-input" : "source-output", pa_log_info("Failed to move %s for \"%s\" to <%s>.", is_sink_input ? "sink-input" : "source-output",
pa_strnull(pa_proplist_gets(pl, PA_PROP_APPLICATION_NAME)), name); pa_strnull(pa_proplist_gets(pl, PA_PROP_APPLICATION_NAME)), name);
else else
@ -324,8 +324,8 @@ static void move_object_for_filter(pa_object *o, struct filter* filter, pa_bool_
pa_proplist_unset(pl, PA_PROP_FILTER_APPLY_MOVING); pa_proplist_unset(pl, PA_PROP_FILTER_APPLY_MOVING);
} }
static void move_objects_for_filter(struct userdata *u, pa_object *o, struct filter* filter, pa_bool_t restore, static void move_objects_for_filter(struct userdata *u, pa_object *o, struct filter* filter, bool restore,
pa_bool_t is_sink_input) { bool is_sink_input) {
if (!should_group_filter(filter)) if (!should_group_filter(filter))
move_object_for_filter(o, filter, restore, is_sink_input); move_object_for_filter(o, filter, restore, is_sink_input);
@ -338,19 +338,19 @@ static void move_objects_for_filter(struct userdata *u, pa_object *o, struct fil
group = get_group(o, is_sink_input); group = get_group(o, is_sink_input);
PA_IDXSET_FOREACH(so, u->core->source_outputs, idx) { PA_IDXSET_FOREACH(so, u->core->source_outputs, idx) {
g = get_group(PA_OBJECT(so), FALSE); g = get_group(PA_OBJECT(so), false);
if (pa_streq(g, group)) if (pa_streq(g, group))
move_object_for_filter(PA_OBJECT(so), filter, restore, FALSE); move_object_for_filter(PA_OBJECT(so), filter, restore, false);
pa_xfree(g); pa_xfree(g);
} }
PA_IDXSET_FOREACH(si, u->core->sink_inputs, idx) { PA_IDXSET_FOREACH(si, u->core->sink_inputs, idx) {
g = get_group(PA_OBJECT(si), TRUE); g = get_group(PA_OBJECT(si), true);
if (pa_streq(g, group)) if (pa_streq(g, group))
move_object_for_filter(PA_OBJECT(si), filter, restore, TRUE); move_object_for_filter(PA_OBJECT(si), filter, restore, true);
pa_xfree(g); pa_xfree(g);
} }
@ -399,22 +399,22 @@ static void find_filters_for_module(struct userdata *u, pa_module *m, const char
pa_hashmap_put(u->filters, fltr, fltr); pa_hashmap_put(u->filters, fltr, fltr);
} }
static pa_bool_t can_unload_module(struct userdata *u, uint32_t idx) { static bool can_unload_module(struct userdata *u, uint32_t idx) {
void *state; void *state;
struct filter *filter; struct filter *filter;
/* Check if any other struct filters point to the same module */ /* Check if any other struct filters point to the same module */
PA_HASHMAP_FOREACH(filter, u->filters, state) { PA_HASHMAP_FOREACH(filter, u->filters, state) {
if (filter->module_index == idx && !nothing_attached(filter)) if (filter->module_index == idx && !nothing_attached(filter))
return FALSE; return false;
} }
return TRUE; return true;
} }
static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_sink_input) { static pa_hook_result_t process(struct userdata *u, pa_object *o, bool is_sink_input) {
const char *want; const char *want;
pa_bool_t done_something = FALSE; bool done_something = false;
pa_sink *sink = NULL; pa_sink *sink = NULL;
pa_source *source = NULL; pa_source *source = NULL;
pa_module *module = NULL; pa_module *module = NULL;
@ -475,7 +475,7 @@ static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_s
if ((m = pa_module_load(u->core, module_name, args))) { if ((m = pa_module_load(u->core, module_name, args))) {
find_filters_for_module(u, m, want); find_filters_for_module(u, m, want);
filter = pa_hashmap_get(u->filters, fltr); filter = pa_hashmap_get(u->filters, fltr);
done_something = TRUE; done_something = true;
} }
pa_xfree(args); pa_xfree(args);
} }
@ -492,8 +492,8 @@ static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_s
/* We can move the stream now as we know the destination. If this /* We can move the stream now as we know the destination. If this
* isn't true, we will do it later when the sink appears. */ * isn't true, we will do it later when the sink appears. */
if ((is_sink_input && filter->sink) || (!is_sink_input && filter->source)) { if ((is_sink_input && filter->sink) || (!is_sink_input && filter->source)) {
move_objects_for_filter(u, o, filter, FALSE, is_sink_input); move_objects_for_filter(u, o, filter, false, is_sink_input);
done_something = TRUE; done_something = true;
} }
} else { } else {
void *state; void *state;
@ -503,8 +503,8 @@ static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_s
* This can happen if an input's proplist changes */ * This can happen if an input's proplist changes */
PA_HASHMAP_FOREACH(filter, u->filters, state) { PA_HASHMAP_FOREACH(filter, u->filters, state) {
if ((is_sink_input && sink == filter->sink) || (!is_sink_input && source == filter->source)) { if ((is_sink_input && sink == filter->sink) || (!is_sink_input && source == filter->source)) {
move_objects_for_filter(u, o, filter, TRUE, is_sink_input); move_objects_for_filter(u, o, filter, true, is_sink_input);
done_something = TRUE; done_something = true;
break; break;
} }
} }
@ -520,7 +520,7 @@ static pa_hook_result_t sink_input_put_cb(pa_core *core, pa_sink_input *i, struc
pa_core_assert_ref(core); pa_core_assert_ref(core);
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
return process(u, PA_OBJECT(i), TRUE); return process(u, PA_OBJECT(i), true);
} }
static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *i, struct userdata *u) {
@ -530,14 +530,14 @@ static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *
if (pa_proplist_gets(i->proplist, PA_PROP_FILTER_APPLY_MOVING)) if (pa_proplist_gets(i->proplist, PA_PROP_FILTER_APPLY_MOVING))
return PA_HOOK_OK; return PA_HOOK_OK;
return process(u, PA_OBJECT(i), TRUE); return process(u, PA_OBJECT(i), true);
} }
static pa_hook_result_t sink_input_proplist_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { static pa_hook_result_t sink_input_proplist_cb(pa_core *core, pa_sink_input *i, struct userdata *u) {
pa_core_assert_ref(core); pa_core_assert_ref(core);
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
return process(u, PA_OBJECT(i), TRUE); return process(u, PA_OBJECT(i), true);
} }
static pa_hook_result_t sink_input_unlink_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { static pa_hook_result_t sink_input_unlink_cb(pa_core *core, pa_sink_input *i, struct userdata *u) {
@ -573,7 +573,7 @@ static pa_hook_result_t sink_unlink_cb(pa_core *core, pa_sink *sink, struct user
pa_sink_input *i; pa_sink_input *i;
PA_IDXSET_FOREACH(i, sink->inputs, idx) PA_IDXSET_FOREACH(i, sink->inputs, idx)
move_objects_for_filter(u, PA_OBJECT(i), filter, TRUE, TRUE); move_objects_for_filter(u, PA_OBJECT(i), filter, true, true);
} }
idx = filter->module_index; idx = filter->module_index;
@ -581,7 +581,7 @@ static pa_hook_result_t sink_unlink_cb(pa_core *core, pa_sink *sink, struct user
filter_free(filter); filter_free(filter);
if (can_unload_module(u, idx)) if (can_unload_module(u, idx))
pa_module_unload_request_by_index(u->core, idx, TRUE); pa_module_unload_request_by_index(u->core, idx, true);
} }
} }
@ -592,7 +592,7 @@ static pa_hook_result_t source_output_put_cb(pa_core *core, pa_source_output *o,
pa_core_assert_ref(core); pa_core_assert_ref(core);
pa_source_output_assert_ref(o); pa_source_output_assert_ref(o);
return process(u, PA_OBJECT(o), FALSE); return process(u, PA_OBJECT(o), false);
} }
static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_output *o, struct userdata *u) { static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_output *o, struct userdata *u) {
@ -602,14 +602,14 @@ static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_ou
if (pa_proplist_gets(o->proplist, PA_PROP_FILTER_APPLY_MOVING)) if (pa_proplist_gets(o->proplist, PA_PROP_FILTER_APPLY_MOVING))
return PA_HOOK_OK; return PA_HOOK_OK;
return process(u, PA_OBJECT(o), FALSE); return process(u, PA_OBJECT(o), false);
} }
static pa_hook_result_t source_output_proplist_cb(pa_core *core, pa_source_output *o, struct userdata *u) { static pa_hook_result_t source_output_proplist_cb(pa_core *core, pa_source_output *o, struct userdata *u) {
pa_core_assert_ref(core); pa_core_assert_ref(core);
pa_source_output_assert_ref(o); pa_source_output_assert_ref(o);
return process(u, PA_OBJECT(o), FALSE); return process(u, PA_OBJECT(o), false);
} }
static pa_hook_result_t source_output_unlink_cb(pa_core *core, pa_source_output *o, struct userdata *u) { static pa_hook_result_t source_output_unlink_cb(pa_core *core, pa_source_output *o, struct userdata *u) {
@ -645,7 +645,7 @@ static pa_hook_result_t source_unlink_cb(pa_core *core, pa_source *source, struc
pa_source_output *o; pa_source_output *o;
PA_IDXSET_FOREACH(o, source->outputs, idx) PA_IDXSET_FOREACH(o, source->outputs, idx)
move_objects_for_filter(u, PA_OBJECT(o), filter, TRUE, FALSE); move_objects_for_filter(u, PA_OBJECT(o), filter, true, false);
} }
idx = filter->module_index; idx = filter->module_index;
@ -653,7 +653,7 @@ static pa_hook_result_t source_unlink_cb(pa_core *core, pa_source *source, struc
filter_free(filter); filter_free(filter);
if (can_unload_module(u, idx)) if (can_unload_module(u, idx))
pa_module_unload_request_by_index(u->core, idx, TRUE); pa_module_unload_request_by_index(u->core, idx, true);
} }
} }
@ -743,7 +743,7 @@ void pa__done(pa_module *m) {
struct filter *f; struct filter *f;
while ((f = pa_hashmap_steal_first(u->filters))) { while ((f = pa_hashmap_steal_first(u->filters))) {
pa_module_unload_request_by_index(u->core, f->module_index, TRUE); pa_module_unload_request_by_index(u->core, f->module_index, true);
filter_free(f); filter_free(f);
} }

View file

@ -40,7 +40,7 @@
PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_AUTHOR("Colin Guthrie");
PA_MODULE_DESCRIPTION("Detect when various filters are desirable"); PA_MODULE_DESCRIPTION("Detect when various filters are desirable");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
NULL NULL
@ -55,7 +55,7 @@ struct userdata {
*source_output_move_finish_slot; *source_output_move_finish_slot;
}; };
static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_sink_input) { static pa_hook_result_t process(struct userdata *u, pa_object *o, bool is_sink_input) {
const char *want; const char *want;
pa_proplist *pl, *parent_pl; pa_proplist *pl, *parent_pl;
@ -99,7 +99,7 @@ static pa_hook_result_t sink_input_put_cb(pa_core *core, pa_sink_input *i, struc
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
pa_assert(u); pa_assert(u);
return process(u, PA_OBJECT(i), TRUE); return process(u, PA_OBJECT(i), true);
} }
static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *i, struct userdata *u) {
@ -111,7 +111,7 @@ static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *
if (pa_proplist_gets(i->proplist, PA_PROP_FILTER_APPLY_MOVING)) if (pa_proplist_gets(i->proplist, PA_PROP_FILTER_APPLY_MOVING))
return PA_HOOK_OK; return PA_HOOK_OK;
return process(u, PA_OBJECT(i), TRUE); return process(u, PA_OBJECT(i), true);
} }
static pa_hook_result_t source_output_put_cb(pa_core *core, pa_source_output *i, struct userdata *u) { static pa_hook_result_t source_output_put_cb(pa_core *core, pa_source_output *i, struct userdata *u) {
@ -119,7 +119,7 @@ static pa_hook_result_t source_output_put_cb(pa_core *core, pa_source_output *i,
pa_source_output_assert_ref(i); pa_source_output_assert_ref(i);
pa_assert(u); pa_assert(u);
return process(u, PA_OBJECT(i), FALSE); return process(u, PA_OBJECT(i), false);
} }
static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_output *i, struct userdata *u) { static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_output *i, struct userdata *u) {
@ -131,7 +131,7 @@ static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_ou
if (pa_proplist_gets(i->proplist, PA_PROP_FILTER_APPLY_MOVING)) if (pa_proplist_gets(i->proplist, PA_PROP_FILTER_APPLY_MOVING))
return PA_HOOK_OK; return PA_HOOK_OK;
return process(u, PA_OBJECT(i), FALSE); return process(u, PA_OBJECT(i), false);
} }
int pa__init(pa_module *m) { int pa__init(pa_module *m) {

View file

@ -35,7 +35,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Compatibility module"); PA_MODULE_DESCRIPTION("Compatibility module");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_DEPRECATED("Please use module-udev-detect instead of module-hal-detect!"); PA_MODULE_DEPRECATED("Please use module-udev-detect instead of module-hal-detect!");
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -47,7 +47,7 @@ static const char* const valid_modargs[] = {
int pa__init(pa_module*m) { int pa__init(pa_module*m) {
pa_modargs *ma = NULL; pa_modargs *ma = NULL;
pa_bool_t tsched = TRUE; bool tsched = true;
pa_module *n; pa_module *n;
char *t; char *t;
@ -70,7 +70,7 @@ int pa__init(pa_module*m) {
pa_xfree(t); pa_xfree(t);
if (n) if (n)
pa_module_unload_request(m, TRUE); pa_module_unload_request(m, true);
pa_modargs_free(ma); pa_modargs_free(ma);

View file

@ -38,7 +38,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Automatically set device of streams based on intended roles of devices"); PA_MODULE_DESCRIPTION("Automatically set device of streams based on intended roles of devices");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"on_hotplug=<When new device becomes available, recheck streams?> " "on_hotplug=<When new device becomes available, recheck streams?> "
"on_rescue=<When device becomes unavailable, recheck streams?>"); "on_rescue=<When device becomes unavailable, recheck streams?>");
@ -61,11 +61,11 @@ struct userdata {
*sink_unlink_hook_slot, *sink_unlink_hook_slot,
*source_unlink_hook_slot; *source_unlink_hook_slot;
pa_bool_t on_hotplug:1; bool on_hotplug:1;
pa_bool_t on_rescue:1; bool on_rescue:1;
}; };
static pa_bool_t role_match(pa_proplist *proplist, const char *role) { static bool role_match(pa_proplist *proplist, const char *role) {
return pa_str_in_list_spaces(pa_proplist_gets(proplist, PA_PROP_DEVICE_INTENDED_ROLES), role); return pa_str_in_list_spaces(pa_proplist_gets(proplist, PA_PROP_DEVICE_INTENDED_ROLES), role);
} }
@ -95,7 +95,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
/* Prefer the default sink over any other sink, just in case... */ /* Prefer the default sink over any other sink, just in case... */
if ((def = pa_namereg_get_default_sink(c))) if ((def = pa_namereg_get_default_sink(c)))
if (role_match(def->proplist, role) && pa_sink_input_new_data_set_sink(new_data, def, FALSE)) if (role_match(def->proplist, role) && pa_sink_input_new_data_set_sink(new_data, def, false))
return PA_HOOK_OK; return PA_HOOK_OK;
/* @todo: favour the highest priority device, not the first one we find? */ /* @todo: favour the highest priority device, not the first one we find? */
@ -106,7 +106,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s))) if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)))
continue; continue;
if (role_match(s->proplist, role) && pa_sink_input_new_data_set_sink(new_data, s, FALSE)) if (role_match(s->proplist, role) && pa_sink_input_new_data_set_sink(new_data, s, false))
return PA_HOOK_OK; return PA_HOOK_OK;
} }
@ -140,7 +140,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
/* Prefer the default source over any other source, just in case... */ /* Prefer the default source over any other source, just in case... */
if ((def = pa_namereg_get_default_source(c))) if ((def = pa_namereg_get_default_source(c)))
if (role_match(def->proplist, role)) { if (role_match(def->proplist, role)) {
pa_source_output_new_data_set_source(new_data, def, FALSE); pa_source_output_new_data_set_source(new_data, def, false);
return PA_HOOK_OK; return PA_HOOK_OK;
} }
@ -156,7 +156,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
/* @todo: favour the highest priority device, not the first one we find? */ /* @todo: favour the highest priority device, not the first one we find? */
if (role_match(s->proplist, role)) { if (role_match(s->proplist, role)) {
pa_source_output_new_data_set_source(new_data, s, FALSE); pa_source_output_new_data_set_source(new_data, s, false);
return PA_HOOK_OK; return PA_HOOK_OK;
} }
} }
@ -202,7 +202,7 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, struct
if (!role_match(sink->proplist, role)) if (!role_match(sink->proplist, role))
continue; continue;
pa_sink_input_move_to(si, sink, FALSE); pa_sink_input_move_to(si, sink, false);
} }
return PA_HOOK_OK; return PA_HOOK_OK;
@ -252,7 +252,7 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source,
if (!role_match(source->proplist, role)) if (!role_match(source->proplist, role))
continue; continue;
pa_source_output_move_to(so, source, FALSE); pa_source_output_move_to(so, source, false);
} }
return PA_HOOK_OK; return PA_HOOK_OK;
@ -289,7 +289,7 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, str
/* Would the default sink fit? If so, let's use it */ /* Would the default sink fit? If so, let's use it */
if (def != sink && role_match(def->proplist, role)) if (def != sink && role_match(def->proplist, role))
if (pa_sink_input_move_to(si, def, FALSE) >= 0) if (pa_sink_input_move_to(si, def, false) >= 0)
continue; continue;
/* Try to find some other fitting sink */ /* Try to find some other fitting sink */
@ -302,7 +302,7 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, str
continue; continue;
if (role_match(d->proplist, role)) if (role_match(d->proplist, role))
if (pa_sink_input_move_to(si, d, FALSE) >= 0) if (pa_sink_input_move_to(si, d, false) >= 0)
break; break;
} }
} }
@ -344,7 +344,7 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc
/* Would the default source fit? If so, let's use it */ /* Would the default source fit? If so, let's use it */
if (def != source && role_match(def->proplist, role) && !source->monitor_of == !def->monitor_of) { if (def != source && role_match(def->proplist, role) && !source->monitor_of == !def->monitor_of) {
pa_source_output_move_to(so, def, FALSE); pa_source_output_move_to(so, def, false);
continue; continue;
} }
@ -359,7 +359,7 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc
/* If moving from a monitor, move to another monitor */ /* If moving from a monitor, move to another monitor */
if (!source->monitor_of == !d->monitor_of && role_match(d->proplist, role)) { if (!source->monitor_of == !d->monitor_of && role_match(d->proplist, role)) {
pa_source_output_move_to(so, d, FALSE); pa_source_output_move_to(so, d, false);
break; break;
} }
} }
@ -371,7 +371,7 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc
int pa__init(pa_module*m) { int pa__init(pa_module*m) {
pa_modargs *ma = NULL; pa_modargs *ma = NULL;
struct userdata *u; struct userdata *u;
pa_bool_t on_hotplug = TRUE, on_rescue = TRUE; bool on_hotplug = true, on_rescue = true;
pa_assert(m); pa_assert(m);

View file

@ -52,7 +52,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION(_("Virtual LADSPA sink")); PA_MODULE_DESCRIPTION(_("Virtual LADSPA sink"));
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
_("sink_name=<name for the sink> " _("sink_name=<name for the sink> "
"sink_properties=<properties for the sink> " "sink_properties=<properties for the sink> "
@ -92,7 +92,7 @@ struct userdata {
pa_memblockq *memblockq; pa_memblockq *memblockq;
pa_bool_t *use_default; bool *use_default;
pa_sample_spec ss; pa_sample_spec ss;
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
@ -100,7 +100,7 @@ struct userdata {
char *dbus_path; char *dbus_path;
#endif #endif
pa_bool_t auto_desc; bool auto_desc;
}; };
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -124,7 +124,7 @@ enum {
LADSPA_SINK_MESSAGE_UPDATE_PARAMETERS = PA_SINK_MESSAGE_MAX LADSPA_SINK_MESSAGE_UPDATE_PARAMETERS = PA_SINK_MESSAGE_MAX
}; };
static int write_control_parameters(struct userdata *u, double *control_values, pa_bool_t *use_default); static int write_control_parameters(struct userdata *u, double *control_values, bool *use_default);
static void connect_control_ports(struct userdata *u); static void connect_control_ports(struct userdata *u);
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
@ -184,7 +184,7 @@ static void set_algorithm_parameters(DBusConnection *conn, DBusMessage *msg, DBu
unsigned n_dbus_control, n_dbus_use_default; unsigned n_dbus_control, n_dbus_use_default;
double *read_values = NULL; double *read_values = NULL;
dbus_bool_t *read_defaults = NULL; dbus_bool_t *read_defaults = NULL;
pa_bool_t *use_defaults = NULL; bool *use_defaults = NULL;
unsigned long i; unsigned long i;
pa_assert(conn); pa_assert(conn);
@ -216,7 +216,7 @@ static void set_algorithm_parameters(DBusConnection *conn, DBusMessage *msg, DBu
return; return;
} }
use_defaults = pa_xnew(pa_bool_t, n_control); use_defaults = pa_xnew(bool, n_control);
for (i = 0; i < u->n_control; i++) for (i = 0; i < u->n_control; i++)
use_defaults[i] = read_defaults[i]; use_defaults[i] = read_defaults[i];
@ -403,7 +403,7 @@ static void sink_request_rewind_cb(pa_sink *s) {
/* Just hand this one over to the master sink */ /* Just hand this one over to the master sink */
pa_sink_input_request_rewind(u->sink_input, pa_sink_input_request_rewind(u->sink_input,
s->thread_info.rewind_nbytes + s->thread_info.rewind_nbytes +
pa_memblockq_get_length(u->memblockq), TRUE, FALSE, FALSE); pa_memblockq_get_length(u->memblockq), true, false, false);
} }
/* Called from I/O thread context */ /* Called from I/O thread context */
@ -511,7 +511,7 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
if (amount > 0) { if (amount > 0) {
unsigned c; unsigned c;
pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE, TRUE); pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE, true);
pa_log_debug("Resetting plugin"); pa_log_debug("Resetting plugin");
@ -622,7 +622,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
pa_sink_unref(u->sink); pa_sink_unref(u->sink);
u->sink = NULL; u->sink = NULL;
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from IO thread context */ /* Called from IO thread context */
@ -637,7 +637,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
if (PA_SINK_INPUT_IS_LINKED(state) && if (PA_SINK_INPUT_IS_LINKED(state) &&
i->thread_info.state == PA_SINK_INPUT_INIT) { i->thread_info.state == PA_SINK_INPUT_INIT) {
pa_log_debug("Requesting rewind due to state change."); pa_log_debug("Requesting rewind due to state change.");
pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); pa_sink_input_request_rewind(i, 0, false, true, true);
} }
} }
@ -678,7 +678,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 int parse_control_parameters(struct userdata *u, const char *cdata, double *read_values, pa_bool_t *use_default) { static int parse_control_parameters(struct userdata *u, const char *cdata, double *read_values, bool *use_default) {
unsigned long p = 0; unsigned long p = 0;
const char *state = NULL; const char *state = NULL;
char *k; char *k;
@ -699,7 +699,7 @@ static int parse_control_parameters(struct userdata *u, const char *cdata, doubl
if (*k == 0) { if (*k == 0) {
pa_log_debug("Read empty config value (p=%lu)", p); pa_log_debug("Read empty config value (p=%lu)", p);
use_default[p++] = TRUE; use_default[p++] = true;
pa_xfree(k); pa_xfree(k);
continue; continue;
} }
@ -714,7 +714,7 @@ static int parse_control_parameters(struct userdata *u, const char *cdata, doubl
pa_log_debug("Read config value %f (p=%lu)", f, p); pa_log_debug("Read config value %f (p=%lu)", f, p);
use_default[p] = FALSE; use_default[p] = false;
read_values[p++] = f; read_values[p++] = f;
} }
@ -722,7 +722,7 @@ static int parse_control_parameters(struct userdata *u, const char *cdata, doubl
if it is left empty, so we do it here. */ if it is left empty, so we do it here. */
if (*cdata == 0 || cdata[strlen(cdata) - 1] == ',') { if (*cdata == 0 || cdata[strlen(cdata) - 1] == ',') {
if (p < u->n_control) if (p < u->n_control)
use_default[p] = TRUE; use_default[p] = true;
p++; p++;
} }
@ -771,7 +771,7 @@ static void connect_control_ports(struct userdata *u) {
} }
} }
static int validate_control_parameters(struct userdata *u, double *control_values, pa_bool_t *use_default) { static int validate_control_parameters(struct userdata *u, double *control_values, bool *use_default) {
unsigned long p = 0, h = 0; unsigned long p = 0, h = 0;
const LADSPA_Descriptor *d; const LADSPA_Descriptor *d;
pa_sample_spec ss; pa_sample_spec ss;
@ -834,7 +834,7 @@ static int validate_control_parameters(struct userdata *u, double *control_value
return 0; return 0;
} }
static int write_control_parameters(struct userdata *u, double *control_values, pa_bool_t *use_default) { static int write_control_parameters(struct userdata *u, double *control_values, bool *use_default) {
unsigned long p = 0, h = 0, c; unsigned long p = 0, h = 0, c;
const LADSPA_Descriptor *d; const LADSPA_Descriptor *d;
pa_sample_spec ss; pa_sample_spec ss;
@ -1177,15 +1177,15 @@ int pa__init(pa_module*m) {
if (u->n_control > 0) { if (u->n_control > 0) {
double *control_values; double *control_values;
pa_bool_t *use_default; bool *use_default;
/* temporary storage for parser */ /* temporary storage for parser */
control_values = pa_xnew(double, (unsigned) u->n_control); control_values = pa_xnew(double, (unsigned) u->n_control);
use_default = pa_xnew(pa_bool_t, (unsigned) u->n_control); use_default = pa_xnew(bool, (unsigned) u->n_control);
/* real storage */ /* real storage */
u->control = pa_xnew(LADSPA_Data, (unsigned) u->n_control); u->control = pa_xnew(LADSPA_Data, (unsigned) u->n_control);
u->use_default = pa_xnew(pa_bool_t, (unsigned) u->n_control); u->use_default = pa_xnew(bool, (unsigned) u->n_control);
if ((parse_control_parameters(u, cdata, control_values, use_default) < 0) || if ((parse_control_parameters(u, cdata, control_values, use_default) < 0) ||
(write_control_parameters(u, control_values, use_default) < 0)) { (write_control_parameters(u, control_values, use_default) < 0)) {
@ -1257,7 +1257,7 @@ int pa__init(pa_module*m) {
pa_sink_input_new_data_init(&sink_input_data); pa_sink_input_new_data_init(&sink_input_data);
sink_input_data.driver = __FILE__; sink_input_data.driver = __FILE__;
sink_input_data.module = m; sink_input_data.module = m;
pa_sink_input_new_data_set_sink(&sink_input_data, master, FALSE); pa_sink_input_new_data_set_sink(&sink_input_data, master, false);
sink_input_data.origin_sink = u->sink; sink_input_data.origin_sink = u->sink;
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "LADSPA Stream"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "LADSPA Stream");
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");

View file

@ -44,7 +44,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("LIRC volume control"); PA_MODULE_DESCRIPTION("LIRC volume control");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE("config=<config file> sink=<sink name> appname=<lirc application name> volume_limit=<volume limit> volume_step=<volume change step>"); PA_MODULE_USAGE("config=<config file> sink=<sink name> appname=<lirc application name> volume_limit=<volume limit> volume_step=<volume change step>");
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -123,29 +123,29 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event
if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK)))
pa_log("Failed to get sink '%s'", u->sink_name); pa_log("Failed to get sink '%s'", u->sink_name);
else { else {
pa_cvolume cv = *pa_sink_get_volume(s, FALSE); pa_cvolume cv = *pa_sink_get_volume(s, false);
switch (volchange) { switch (volchange) {
case UP: case UP:
pa_cvolume_inc_clamp(&cv, u->volume_step, u->volume_limit); pa_cvolume_inc_clamp(&cv, u->volume_step, u->volume_limit);
pa_sink_set_volume(s, &cv, TRUE, TRUE); pa_sink_set_volume(s, &cv, true, true);
break; break;
case DOWN: case DOWN:
pa_cvolume_dec(&cv, u->volume_step); pa_cvolume_dec(&cv, u->volume_step);
pa_sink_set_volume(s, &cv, TRUE, TRUE); pa_sink_set_volume(s, &cv, true, true);
break; break;
case MUTE: case MUTE:
pa_sink_set_mute(s, TRUE, TRUE); pa_sink_set_mute(s, true, true);
break; break;
case RESET: case RESET:
pa_sink_set_mute(s, FALSE, TRUE); pa_sink_set_mute(s, false, true);
break; break;
case MUTE_TOGGLE: case MUTE_TOGGLE:
pa_sink_set_mute(s, !pa_sink_get_mute(s, FALSE), TRUE); pa_sink_set_mute(s, !pa_sink_get_mute(s, false), true);
break; break;
case INVALID: case INVALID:
@ -164,7 +164,7 @@ fail:
u->module->core->mainloop->io_free(u->io); u->module->core->mainloop->io_free(u->io);
u->io = NULL; u->io = NULL;
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
pa_xfree(code); pa_xfree(code);
} }

View file

@ -43,7 +43,7 @@
PA_MODULE_AUTHOR("Pierre-Louis Bossart"); PA_MODULE_AUTHOR("Pierre-Louis Bossart");
PA_MODULE_DESCRIPTION("Loopback from source to sink"); PA_MODULE_DESCRIPTION("Loopback from source to sink");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"source=<source to connect to> " "source=<source to connect to> "
"sink=<sink to connect to> " "sink=<sink to connect to> "
@ -86,7 +86,7 @@ struct userdata {
size_t skip; size_t skip;
pa_usec_t latency; pa_usec_t latency;
pa_bool_t in_pop; bool in_pop;
size_t min_memblockq_length; size_t min_memblockq_length;
struct { struct {
@ -381,7 +381,7 @@ static void source_output_kill_cb(pa_source_output *o) {
pa_assert_se(u = o->userdata); pa_assert_se(u = o->userdata);
teardown(u); teardown(u);
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from main thread */ /* Called from main thread */
@ -422,7 +422,7 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) {
} }
/* Called from main thread */ /* Called from main thread */
static void source_output_suspend_cb(pa_source_output *o, pa_bool_t suspended) { static void source_output_suspend_cb(pa_source_output *o, bool suspended) {
struct userdata *u; struct userdata *u;
pa_source_output_assert_ref(o); pa_source_output_assert_ref(o);
@ -457,10 +457,10 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
pa_assert_se(u = i->userdata); pa_assert_se(u = i->userdata);
pa_assert(chunk); pa_assert(chunk);
u->in_pop = TRUE; u->in_pop = true;
while (pa_asyncmsgq_process_one(u->asyncmsgq) > 0) while (pa_asyncmsgq_process_one(u->asyncmsgq) > 0)
; ;
u->in_pop = FALSE; u->in_pop = false;
if (pa_memblockq_peek(u->memblockq, chunk) < 0) { if (pa_memblockq_peek(u->memblockq, chunk) < 0) {
pa_log_info("Could not peek into queue"); pa_log_info("Could not peek into queue");
@ -511,7 +511,7 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in
if (PA_SINK_IS_OPENED(u->sink_input->sink->thread_info.state)) if (PA_SINK_IS_OPENED(u->sink_input->sink->thread_info.state))
pa_memblockq_push_align(u->memblockq, chunk); pa_memblockq_push_align(u->memblockq, chunk);
else else
pa_memblockq_flush_write(u->memblockq, TRUE); pa_memblockq_flush_write(u->memblockq, true);
update_min_memblockq_length(u); update_min_memblockq_length(u);
@ -524,7 +524,7 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in
pa_log_debug("Requesting rewind due to end of underrun."); pa_log_debug("Requesting rewind due to end of underrun.");
pa_sink_input_request_rewind(u->sink_input, pa_sink_input_request_rewind(u->sink_input,
(size_t) (u->sink_input->thread_info.underrun_for == (size_t) -1 ? 0 : u->sink_input->thread_info.underrun_for), (size_t) (u->sink_input->thread_info.underrun_for == (size_t) -1 ? 0 : u->sink_input->thread_info.underrun_for),
FALSE, TRUE, FALSE); false, true, false);
} }
u->recv_counter += (int64_t) chunk->length; u->recv_counter += (int64_t) chunk->length;
@ -536,9 +536,9 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in
pa_sink_input_assert_io_context(u->sink_input); pa_sink_input_assert_io_context(u->sink_input);
if (PA_SINK_IS_OPENED(u->sink_input->sink->thread_info.state)) if (PA_SINK_IS_OPENED(u->sink_input->sink->thread_info.state))
pa_memblockq_seek(u->memblockq, -offset, PA_SEEK_RELATIVE, TRUE); pa_memblockq_seek(u->memblockq, -offset, PA_SEEK_RELATIVE, true);
else else
pa_memblockq_flush_write(u->memblockq, TRUE); pa_memblockq_flush_write(u->memblockq, true);
u->recv_counter -= offset; u->recv_counter -= offset;
@ -649,7 +649,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
pa_assert_se(u = i->userdata); pa_assert_se(u = i->userdata);
teardown(u); teardown(u);
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from the output thread context */ /* Called from the output thread context */
@ -701,7 +701,7 @@ static bool sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) {
} }
/* Called from main thread */ /* Called from main thread */
static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspended) { static void sink_input_suspend_cb(pa_sink_input *i, bool suspended) {
struct userdata *u; struct userdata *u;
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
@ -718,10 +718,10 @@ int pa__init(pa_module *m) {
struct userdata *u; struct userdata *u;
pa_sink *sink = NULL; pa_sink *sink = NULL;
pa_sink_input_new_data sink_input_data; pa_sink_input_new_data sink_input_data;
pa_bool_t sink_dont_move; bool sink_dont_move;
pa_source *source = NULL; pa_source *source = NULL;
pa_source_output_new_data source_output_data; pa_source_output_new_data source_output_data;
pa_bool_t source_dont_move; bool source_dont_move;
uint32_t latency_msec; uint32_t latency_msec;
pa_sample_spec ss; pa_sample_spec ss;
pa_channel_map map; pa_channel_map map;
@ -731,7 +731,7 @@ int pa__init(pa_module *m) {
pa_memchunk silence; pa_memchunk silence;
uint32_t adjust_time_sec; uint32_t adjust_time_sec;
const char *n; const char *n;
pa_bool_t remix = TRUE; bool remix = true;
pa_assert(m); pa_assert(m);
@ -823,7 +823,7 @@ int pa__init(pa_module *m) {
sink_input_data.module = m; sink_input_data.module = m;
if (sink) if (sink)
pa_sink_input_new_data_set_sink(&sink_input_data, sink, FALSE); pa_sink_input_new_data_set_sink(&sink_input_data, sink, false);
if (pa_modargs_get_proplist(ma, "sink_input_properties", sink_input_data.proplist, PA_UPDATE_REPLACE) < 0) { if (pa_modargs_get_proplist(ma, "sink_input_properties", sink_input_data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Failed to parse the sink_input_properties value."); pa_log("Failed to parse the sink_input_properties value.");
@ -850,7 +850,7 @@ int pa__init(pa_module *m) {
if (!channels_set) if (!channels_set)
sink_input_data.flags |= PA_SINK_INPUT_FIX_CHANNELS; sink_input_data.flags |= PA_SINK_INPUT_FIX_CHANNELS;
sink_dont_move = FALSE; sink_dont_move = false;
if (pa_modargs_get_value_boolean(ma, "sink_dont_move", &sink_dont_move) < 0) { if (pa_modargs_get_value_boolean(ma, "sink_dont_move", &sink_dont_move) < 0) {
pa_log("sink_dont_move= expects a boolean argument."); pa_log("sink_dont_move= expects a boolean argument.");
goto fail; goto fail;
@ -890,7 +890,7 @@ int pa__init(pa_module *m) {
source_output_data.driver = __FILE__; source_output_data.driver = __FILE__;
source_output_data.module = m; source_output_data.module = m;
if (source) if (source)
pa_source_output_new_data_set_source(&source_output_data, source, FALSE); pa_source_output_new_data_set_source(&source_output_data, source, false);
if (pa_modargs_get_proplist(ma, "source_output_properties", source_output_data.proplist, PA_UPDATE_REPLACE) < 0) { if (pa_modargs_get_proplist(ma, "source_output_properties", source_output_data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Failed to parse the source_output_properties value."); pa_log("Failed to parse the source_output_properties value.");
@ -908,7 +908,7 @@ int pa__init(pa_module *m) {
if (!remix) if (!remix)
source_output_data.flags |= PA_SOURCE_OUTPUT_NO_REMIX; source_output_data.flags |= PA_SOURCE_OUTPUT_NO_REMIX;
source_dont_move = FALSE; source_dont_move = false;
if (pa_modargs_get_value_boolean(ma, "source_dont_move", &source_dont_move) < 0) { if (pa_modargs_get_value_boolean(ma, "source_dont_move", &source_dont_move) < 0) {
pa_log("source_dont_move= expects a boolean argument."); pa_log("source_dont_move= expects a boolean argument.");
goto fail; goto fail;
@ -972,10 +972,10 @@ int pa__init(pa_module *m) {
pa_source_output_put(u->source_output); pa_source_output_put(u->source_output);
if (pa_source_get_state(u->source_output->source) != PA_SOURCE_SUSPENDED) if (pa_source_get_state(u->source_output->source) != PA_SOURCE_SUSPENDED)
pa_sink_input_cork(u->sink_input, FALSE); pa_sink_input_cork(u->sink_input, false);
if (pa_sink_get_state(u->sink_input->sink) != PA_SINK_SUSPENDED) if (pa_sink_get_state(u->sink_input->sink) != PA_SINK_SUSPENDED)
pa_source_output_cork(u->source_output, FALSE); pa_source_output_cork(u->source_output, false);
update_adjust_timer(u); update_adjust_timer(u);

View file

@ -51,7 +51,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Playback stream expression matching module"); PA_MODULE_DESCRIPTION("Playback stream expression matching module");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE("table=<filename> " PA_MODULE_USAGE("table=<filename> "
"key=<property_key>"); "key=<property_key>");

View file

@ -47,7 +47,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Multimedia keyboard support via Linux evdev"); PA_MODULE_DESCRIPTION("Multimedia keyboard support via Linux evdev");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE("device=<evdev device> sink=<sink name> volume_limit=<volume limit> volume_step=<volume change step>"); PA_MODULE_USAGE("device=<evdev device> sink=<sink name> volume_limit=<volume limit> volume_step=<volume change step>");
#define DEFAULT_DEVICE "/dev/input/event0" #define DEFAULT_DEVICE "/dev/input/event0"
@ -118,21 +118,21 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event
if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK)))
pa_log("Failed to get sink '%s'", u->sink_name); pa_log("Failed to get sink '%s'", u->sink_name);
else { else {
pa_cvolume cv = *pa_sink_get_volume(s, FALSE); pa_cvolume cv = *pa_sink_get_volume(s, false);
switch (volchange) { switch (volchange) {
case UP: case UP:
pa_cvolume_inc_clamp(&cv, u->volume_step, u->volume_limit); pa_cvolume_inc_clamp(&cv, u->volume_step, u->volume_limit);
pa_sink_set_volume(s, &cv, TRUE, TRUE); pa_sink_set_volume(s, &cv, true, true);
break; break;
case DOWN: case DOWN:
pa_cvolume_dec(&cv, u->volume_step); pa_cvolume_dec(&cv, u->volume_step);
pa_sink_set_volume(s, &cv, TRUE, TRUE); pa_sink_set_volume(s, &cv, true, true);
break; break;
case MUTE_TOGGLE: case MUTE_TOGGLE:
pa_sink_set_mute(s, !pa_sink_get_mute(s, FALSE), TRUE); pa_sink_set_mute(s, !pa_sink_get_mute(s, false), true);
break; break;
case INVALID: case INVALID:
@ -149,7 +149,7 @@ fail:
u->module->core->mainloop->io_free(u->io); u->module->core->mainloop->io_free(u->io);
u->io = NULL; u->io = NULL;
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
#define test_bit(bit, array) (array[bit/8] & (1<<(bit%8))) #define test_bit(bit, array) (array[bit/8] & (1<<(bit%8)))

View file

@ -38,7 +38,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Native protocol autospawn helper"); PA_MODULE_DESCRIPTION("Native protocol autospawn helper");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"fd", "fd",
@ -70,7 +70,7 @@ int pa__init(pa_module*m) {
options = pa_native_options_new(); options = pa_native_options_new();
options->module = m; options->module = m;
options->auth_anonymous = TRUE; options->auth_anonymous = true;
pa_native_protocol_connect(m->userdata, io, options); pa_native_protocol_connect(m->userdata, io, options);

View file

@ -48,7 +48,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION(_("Clocked NULL sink")); PA_MODULE_DESCRIPTION(_("Clocked NULL sink"));
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name of sink> " "sink_name=<name of sink> "
"sink_properties=<properties for the sink> " "sink_properties=<properties for the sink> "
@ -226,7 +226,7 @@ static void thread_func(void *userdata) {
pa_rtpoll_set_timer_disabled(u->rtpoll); pa_rtpoll_set_timer_disabled(u->rtpoll);
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)

View file

@ -48,7 +48,7 @@
PA_MODULE_AUTHOR("Lennart Poettering & Marc-Andre Lureau"); PA_MODULE_AUTHOR("Lennart Poettering & Marc-Andre Lureau");
PA_MODULE_DESCRIPTION("Clocked NULL source"); PA_MODULE_DESCRIPTION("Clocked NULL source");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"format=<sample format> " "format=<sample format> "
"channels=<number of channels> " "channels=<number of channels> "
@ -159,7 +159,7 @@ static void thread_func(void *userdata) {
pa_rtpoll_set_timer_disabled(u->rtpoll); pa_rtpoll_set_timer_disabled(u->rtpoll);
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)

View file

@ -53,7 +53,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("UNIX pipe sink"); PA_MODULE_DESCRIPTION("UNIX pipe sink");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> " "sink_properties=<properties for the sink> "
@ -196,7 +196,7 @@ static void thread_func(void *userdata) {
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */
pollfd->events = (short) (u->sink->thread_info.state == PA_SINK_RUNNING ? POLLOUT : 0); pollfd->events = (short) (u->sink->thread_info.state == PA_SINK_RUNNING ? POLLOUT : 0);
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)

View file

@ -53,7 +53,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("UNIX pipe source"); PA_MODULE_DESCRIPTION("UNIX pipe source");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"source_name=<name for the source> " "source_name=<name for the source> "
"source_properties=<properties for the source> " "source_properties=<properties for the source> "
@ -184,7 +184,7 @@ static void thread_func(void *userdata) {
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */
pollfd->events = (short) (u->source->thread_info.state == PA_SOURCE_RUNNING ? POLLIN : 0); pollfd->events = (short) (u->source->thread_info.state == PA_SOURCE_RUNNING ? POLLIN : 0);
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)

View file

@ -44,7 +44,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Position event sounds between L and R depending on the position on screen of the widget triggering them."); PA_MODULE_DESCRIPTION("Position event sounds between L and R depending on the position on screen of the widget triggering them.");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
NULL NULL

View file

@ -169,7 +169,7 @@
# error "Broken build system" # error "Broken build system"
#endif #endif
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
@ -239,7 +239,7 @@ int pa__init(pa_module*m) {
#if defined(USE_TCP_SOCKETS) #if defined(USE_TCP_SOCKETS)
uint32_t port = IPV4_PORT; uint32_t port = IPV4_PORT;
pa_bool_t port_fallback = TRUE; bool port_fallback = true;
const char *listen_on; const char *listen_on;
#else #else
int r; int r;
@ -289,7 +289,7 @@ int pa__init(pa_module*m) {
#if defined(USE_TCP_SOCKETS) #if defined(USE_TCP_SOCKETS)
if (pa_in_system_mode() || pa_modargs_get_value(ma, "port", NULL)) if (pa_in_system_mode() || pa_modargs_get_value(ma, "port", NULL))
port_fallback = FALSE; port_fallback = false;
if (pa_modargs_get_value_u32(ma, "port", &port) < 0 || port < 1 || port > 0xFFFF) { if (pa_modargs_get_value_u32(ma, "port", &port) < 0 || port < 1 || port > 0xFFFF) {
pa_log("port= expects a numerical argument between 1 and 65535."); pa_log("port= expects a numerical argument between 1 and 65535.");
@ -337,7 +337,7 @@ int pa__init(pa_module*m) {
/* This socket doesn't reside in our own runtime dir but in /* This socket doesn't reside in our own runtime dir but in
* /tmp/.esd/, hence we have to create the dir first */ * /tmp/.esd/, hence we have to create the dir first */
if (pa_make_secure_parent_dir(u->socket_path, pa_in_system_mode() ? 0755U : 0700U, (uid_t)-1, (gid_t)-1, FALSE) < 0) { if (pa_make_secure_parent_dir(u->socket_path, pa_in_system_mode() ? 0755U : 0700U, (uid_t)-1, (gid_t)-1, false) < 0) {
pa_log("Failed to create socket directory '%s': %s\n", u->socket_path, pa_cstrerror(errno)); pa_log("Failed to create socket directory '%s': %s\n", u->socket_path, pa_cstrerror(errno));
goto fail; goto fail;
} }

View file

@ -38,7 +38,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Virtual channel remapping sink"); PA_MODULE_DESCRIPTION("Virtual channel remapping sink");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> " "sink_properties=<properties for the sink> "
@ -56,7 +56,7 @@ struct userdata {
pa_sink *sink; pa_sink *sink;
pa_sink_input *sink_input; pa_sink_input *sink_input;
pa_bool_t auto_desc; bool auto_desc;
}; };
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -127,7 +127,7 @@ static void sink_request_rewind(pa_sink *s) {
!PA_SINK_INPUT_IS_LINKED(u->sink_input->thread_info.state)) !PA_SINK_INPUT_IS_LINKED(u->sink_input->thread_info.state))
return; return;
pa_sink_input_request_rewind(u->sink_input, s->thread_info.rewind_nbytes, TRUE, FALSE, FALSE); pa_sink_input_request_rewind(u->sink_input, s->thread_info.rewind_nbytes, true, false, false);
} }
/* Called from I/O thread context */ /* Called from I/O thread context */
@ -270,7 +270,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
pa_sink_unref(u->sink); pa_sink_unref(u->sink);
u->sink = NULL; u->sink = NULL;
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from IO thread context */ /* Called from IO thread context */
@ -285,7 +285,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
if (PA_SINK_INPUT_IS_LINKED(state) && if (PA_SINK_INPUT_IS_LINKED(state) &&
i->thread_info.state == PA_SINK_INPUT_INIT) { i->thread_info.state == PA_SINK_INPUT_INIT) {
pa_log_debug("Requesting rewind due to state change."); pa_log_debug("Requesting rewind due to state change.");
pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); pa_sink_input_request_rewind(i, 0, false, true, true);
} }
} }
@ -323,7 +323,7 @@ int pa__init(pa_module*m) {
pa_sink *master; pa_sink *master;
pa_sink_input_new_data sink_input_data; pa_sink_input_new_data sink_input_data;
pa_sink_new_data sink_data; pa_sink_new_data sink_data;
pa_bool_t remix = TRUE; bool remix = true;
pa_assert(m); pa_assert(m);
@ -411,7 +411,7 @@ int pa__init(pa_module*m) {
pa_sink_input_new_data_init(&sink_input_data); pa_sink_input_new_data_init(&sink_input_data);
sink_input_data.driver = __FILE__; sink_input_data.driver = __FILE__;
sink_input_data.module = m; sink_input_data.module = m;
pa_sink_input_new_data_set_sink(&sink_input_data, master, FALSE); pa_sink_input_new_data_set_sink(&sink_input_data, master, false);
sink_input_data.origin_sink = u->sink; sink_input_data.origin_sink = u->sink;
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Remapped Stream"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Remapped Stream");
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");

View file

@ -38,7 +38,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("When a sink/source is removed, try to move its streams to the default sink/source"); PA_MODULE_DESCRIPTION("When a sink/source is removed, try to move its streams to the default sink/source");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
NULL, NULL,
@ -104,7 +104,7 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, voi
if (!(target = find_evacuation_sink(c, i, sink))) if (!(target = find_evacuation_sink(c, i, sink)))
continue; continue;
if (pa_sink_input_move_to(i, target, FALSE) < 0) if (pa_sink_input_move_to(i, target, false) < 0)
pa_log_info("Failed to move sink input %u \"%s\" to %s.", i->index, pa_log_info("Failed to move sink input %u \"%s\" to %s.", i->index,
pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), target->name); pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), target->name);
else else
@ -128,7 +128,7 @@ static pa_hook_result_t sink_input_move_fail_hook_callback(pa_core *c, pa_sink_i
if (!(target = find_evacuation_sink(c, i, NULL))) if (!(target = find_evacuation_sink(c, i, NULL)))
return PA_HOOK_OK; return PA_HOOK_OK;
if (pa_sink_input_finish_move(i, target, FALSE) < 0) { if (pa_sink_input_finish_move(i, target, false) < 0) {
pa_log_info("Failed to move sink input %u \"%s\" to %s.", i->index, pa_log_info("Failed to move sink input %u \"%s\" to %s.", i->index,
pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), target->name); pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), target->name);
return PA_HOOK_OK; return PA_HOOK_OK;
@ -195,7 +195,7 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc
if (!(target = find_evacuation_source(c, o, source))) if (!(target = find_evacuation_source(c, o, source)))
continue; continue;
if (pa_source_output_move_to(o, target, FALSE) < 0) if (pa_source_output_move_to(o, target, false) < 0)
pa_log_info("Failed to move source output %u \"%s\" to %s.", o->index, pa_log_info("Failed to move source output %u \"%s\" to %s.", o->index,
pa_strnull(pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME)), target->name); pa_strnull(pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME)), target->name);
else else
@ -219,7 +219,7 @@ static pa_hook_result_t source_output_move_fail_hook_callback(pa_core *c, pa_sou
if (!(target = find_evacuation_source(c, i, NULL))) if (!(target = find_evacuation_source(c, i, NULL)))
return PA_HOOK_OK; return PA_HOOK_OK;
if (pa_source_output_finish_move(i, target, FALSE) < 0) { if (pa_source_output_finish_move(i, target, false) < 0) {
pa_log_info("Failed to move source input %u \"%s\" to %s.", i->index, pa_log_info("Failed to move source input %u \"%s\" to %s.", i->index,
pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), target->name); pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), target->name);
return PA_HOOK_OK; return PA_HOOK_OK;

View file

@ -38,7 +38,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Mute & cork streams with certain roles while others exist"); PA_MODULE_DESCRIPTION("Mute & cork streams with certain roles while others exist");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"trigger_roles=<Comma separated list of roles which will trigger a cork> " "trigger_roles=<Comma separated list of roles which will trigger a cork> "
"cork_roles=<Comma separated list of roles which will be corked> " "cork_roles=<Comma separated list of roles which will be corked> "
@ -56,7 +56,7 @@ struct userdata {
pa_hashmap *cork_state; pa_hashmap *cork_state;
pa_idxset *trigger_roles; pa_idxset *trigger_roles;
pa_idxset *cork_roles; pa_idxset *cork_roles;
pa_bool_t global:1; bool global:1;
pa_hook_slot pa_hook_slot
*sink_input_put_slot, *sink_input_put_slot,
*sink_input_unlink_slot, *sink_input_unlink_slot,
@ -64,7 +64,7 @@ struct userdata {
*sink_input_move_finish_slot; *sink_input_move_finish_slot;
}; };
static pa_bool_t shall_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore) { static bool shall_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore) {
pa_sink_input *j; pa_sink_input *j;
uint32_t idx, role_idx; uint32_t idx, role_idx;
const char *trigger_role; const char *trigger_role;
@ -84,25 +84,25 @@ static pa_bool_t shall_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignor
PA_IDXSET_FOREACH(trigger_role, u->trigger_roles, role_idx) { PA_IDXSET_FOREACH(trigger_role, u->trigger_roles, role_idx) {
if (pa_streq(role, trigger_role)) { if (pa_streq(role, trigger_role)) {
pa_log_debug("Found a '%s' stream that will trigger the auto-cork.", trigger_role); pa_log_debug("Found a '%s' stream that will trigger the auto-cork.", trigger_role);
return TRUE; return true;
} }
} }
} }
return FALSE; return false;
} }
static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_input *ignore, pa_bool_t cork) { static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_input *ignore, bool cork) {
pa_sink_input *j; pa_sink_input *j;
uint32_t idx, role_idx; uint32_t idx, role_idx;
const char *cork_role; const char *cork_role;
pa_bool_t trigger = FALSE; bool trigger = false;
pa_assert(u); pa_assert(u);
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
for (j = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); j; j = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx))) { for (j = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); j; j = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx))) {
pa_bool_t corked, muted, corked_here; bool corked, muted, corked_here;
const char *role; const char *role;
if (j == ignore) if (j == ignore)
@ -126,7 +126,7 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in
pa_log_debug("Found a '%s' stream that should be corked/muted.", cork_role); pa_log_debug("Found a '%s' stream that should be corked/muted.", cork_role);
if (!corked_here) if (!corked_here)
pa_hashmap_put(u->cork_state, j, PA_INT_TO_PTR(1)); pa_hashmap_put(u->cork_state, j, PA_INT_TO_PTR(1));
pa_sink_input_set_mute(j, TRUE, FALSE); pa_sink_input_set_mute(j, true, false);
pa_sink_input_send_event(j, PA_STREAM_EVENT_REQUEST_CORK, NULL); pa_sink_input_send_event(j, PA_STREAM_EVENT_REQUEST_CORK, NULL);
} else if (!cork) { } else if (!cork) {
pa_hashmap_remove(u->cork_state, j); pa_hashmap_remove(u->cork_state, j);
@ -134,7 +134,7 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in
if (corked_here && (corked || muted)) { if (corked_here && (corked || muted)) {
pa_log_debug("Found a '%s' stream that should be uncorked/unmuted.", cork_role); pa_log_debug("Found a '%s' stream that should be uncorked/unmuted.", cork_role);
if (muted) if (muted)
pa_sink_input_set_mute(j, FALSE, FALSE); pa_sink_input_set_mute(j, false, false);
if (corked) if (corked)
pa_sink_input_send_event(j, PA_STREAM_EVENT_REQUEST_UNCORK, NULL); pa_sink_input_send_event(j, PA_STREAM_EVENT_REQUEST_UNCORK, NULL);
} }
@ -142,7 +142,7 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in
} }
} }
static void apply_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore, pa_bool_t cork) { static void apply_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore, bool cork) {
pa_assert(u); pa_assert(u);
if (u->global) { if (u->global) {
@ -153,8 +153,8 @@ static void apply_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore, pa
apply_cork_to_sink(u, s, ignore, cork); apply_cork_to_sink(u, s, ignore, cork);
} }
static pa_hook_result_t process(struct userdata *u, pa_sink_input *i, pa_bool_t create) { static pa_hook_result_t process(struct userdata *u, pa_sink_input *i, bool create) {
pa_bool_t cork = FALSE; bool cork = false;
const char *role; const char *role;
pa_assert(u); pa_assert(u);
@ -179,34 +179,34 @@ static pa_hook_result_t sink_input_put_cb(pa_core *core, pa_sink_input *i, struc
pa_core_assert_ref(core); pa_core_assert_ref(core);
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
return process(u, i, TRUE); return process(u, i, true);
} }
static pa_hook_result_t sink_input_unlink_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { static pa_hook_result_t sink_input_unlink_cb(pa_core *core, pa_sink_input *i, struct userdata *u) {
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
return process(u, i, FALSE); return process(u, i, false);
} }
static pa_hook_result_t sink_input_move_start_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { static pa_hook_result_t sink_input_move_start_cb(pa_core *core, pa_sink_input *i, struct userdata *u) {
pa_core_assert_ref(core); pa_core_assert_ref(core);
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
return process(u, i, FALSE); return process(u, i, false);
} }
static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *i, struct userdata *u) {
pa_core_assert_ref(core); pa_core_assert_ref(core);
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
return process(u, i, TRUE); return process(u, i, true);
} }
int pa__init(pa_module *m) { int pa__init(pa_module *m) {
pa_modargs *ma = NULL; pa_modargs *ma = NULL;
struct userdata *u; struct userdata *u;
const char *roles; const char *roles;
pa_bool_t global = FALSE; bool global = false;
pa_assert(m); pa_assert(m);

View file

@ -51,7 +51,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("UPnP MediaServer Plugin for Rygel"); PA_MODULE_DESCRIPTION("UPnP MediaServer Plugin for Rygel");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE("display_name=<UPnP Media Server name>"); PA_MODULE_USAGE("display_name=<UPnP Media Server name>");
/* This implements http://live.gnome.org/Rygel/MediaServer2Spec */ /* This implements http://live.gnome.org/Rygel/MediaServer2Spec */
@ -170,7 +170,7 @@ struct userdata {
pa_module *module; pa_module *module;
pa_dbus_connection *bus; pa_dbus_connection *bus;
pa_bool_t got_name:1; bool got_name:1;
char *display_name; char *display_name;
@ -211,7 +211,7 @@ static pa_hook_result_t source_new_or_unlink_cb(pa_core *c, pa_source *s, struct
return PA_HOOK_OK; return PA_HOOK_OK;
} }
static pa_bool_t message_is_property_get(DBusMessage *m, const char *interface, const char *property) { static bool message_is_property_get(DBusMessage *m, const char *interface, const char *property) {
const char *i, *p; const char *i, *p;
DBusError error; DBusError error;
@ -220,17 +220,17 @@ static pa_bool_t message_is_property_get(DBusMessage *m, const char *interface,
pa_assert(m); pa_assert(m);
if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Get")) if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Get"))
return FALSE; return false;
if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_STRING, &p, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) { if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_STRING, &p, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
dbus_error_free(&error); dbus_error_free(&error);
return FALSE; return false;
} }
return pa_streq(i, interface) && pa_streq(p, property); return pa_streq(i, interface) && pa_streq(p, property);
} }
static pa_bool_t message_is_property_get_all(DBusMessage *m, const char *interface) { static bool message_is_property_get_all(DBusMessage *m, const char *interface) {
const char *i; const char *i;
DBusError error; DBusError error;
@ -239,11 +239,11 @@ static pa_bool_t message_is_property_get_all(DBusMessage *m, const char *interfa
pa_assert(m); pa_assert(m);
if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "GetAll")) if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "GetAll"))
return FALSE; return false;
if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) { if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
dbus_error_free(&error); dbus_error_free(&error);
return FALSE; return false;
} }
return pa_streq(i, interface); return pa_streq(i, interface);
@ -473,7 +473,7 @@ static void append_property_dict_entry_item_display_name(DBusMessage *m, DBusMes
pa_assert_se(dbus_message_iter_close_container(iter, &sub)); pa_assert_se(dbus_message_iter_close_container(iter, &sub));
} }
static pa_bool_t get_mediacontainer2_list_args(DBusMessage *m, unsigned *offset, unsigned *max_entries, char ***filter, int *filter_len) { static bool get_mediacontainer2_list_args(DBusMessage *m, unsigned *offset, unsigned *max_entries, char ***filter, int *filter_len) {
DBusError error; DBusError error;
dbus_error_init(&error); dbus_error_init(&error);
@ -485,10 +485,10 @@ static pa_bool_t get_mediacontainer2_list_args(DBusMessage *m, unsigned *offset,
if (!dbus_message_get_args(m, &error, DBUS_TYPE_UINT32, offset, DBUS_TYPE_UINT32, max_entries, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, filter, filter_len, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) { if (!dbus_message_get_args(m, &error, DBUS_TYPE_UINT32, offset, DBUS_TYPE_UINT32, max_entries, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, filter, filter_len, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
dbus_error_free(&error); dbus_error_free(&error);
return FALSE; return false;
} }
return TRUE; return true;
} }
static unsigned get_sinks_or_sources_count(const char *path, const struct userdata *u) { static unsigned get_sinks_or_sources_count(const char *path, const struct userdata *u) {
@ -528,7 +528,7 @@ static void append_sink_or_source_container_properties(
if (filter_len == 1 && (*filter)[0] == '*' && (*filter)[1] == '\0') { if (filter_len == 1 && (*filter)[0] == '*' && (*filter)[1] == '\0') {
append_sink_or_source_container_mediaobject2_properties(r, &sub, path); append_sink_or_source_container_mediaobject2_properties(r, &sub, path);
append_property_dict_entry_unsigned(r, &sub, "ChildCount", get_sinks_or_sources_count(path, user_data)); append_property_dict_entry_unsigned(r, &sub, "ChildCount", get_sinks_or_sources_count(path, user_data));
append_property_dict_entry_boolean(r, &sub, "Searchable", FALSE); append_property_dict_entry_boolean(r, &sub, "Searchable", false);
} }
else { else {
for (int i = 0; i < filter_len; ++i) { for (int i = 0; i < filter_len; ++i) {
@ -552,7 +552,7 @@ static void append_sink_or_source_container_properties(
append_property_dict_entry_unsigned(r, &sub, "ChildCount", get_sinks_or_sources_count(path, user_data)); append_property_dict_entry_unsigned(r, &sub, "ChildCount", get_sinks_or_sources_count(path, user_data));
} }
else if (pa_streq(property_name, "Searchable")) { else if (pa_streq(property_name, "Searchable")) {
append_property_dict_entry_boolean(r, &sub, "Searchable", FALSE); append_property_dict_entry_boolean(r, &sub, "Searchable", false);
} }
} }
} }
@ -642,7 +642,7 @@ static DBusHandlerResult root_handler(DBusConnection *c, DBusMessage *m, void *u
} else if (message_is_property_get(m, "org.gnome.UPnP.MediaContainer2", "Searchable")) { } else if (message_is_property_get(m, "org.gnome.UPnP.MediaContainer2", "Searchable")) {
pa_assert_se(r = dbus_message_new_method_return(m)); pa_assert_se(r = dbus_message_new_method_return(m));
append_variant_boolean(r, NULL, FALSE); append_variant_boolean(r, NULL, false);
} else if (message_is_property_get_all(m, "org.gnome.UPnP.MediaContainer2")) { } else if (message_is_property_get_all(m, "org.gnome.UPnP.MediaContainer2")) {
DBusMessageIter iter, sub; DBusMessageIter iter, sub;
@ -654,7 +654,7 @@ static DBusHandlerResult root_handler(DBusConnection *c, DBusMessage *m, void *u
append_property_dict_entry_unsigned(r, &sub, "ChildCount", PA_ELEMENTSOF(array_root_containers)); append_property_dict_entry_unsigned(r, &sub, "ChildCount", PA_ELEMENTSOF(array_root_containers));
append_property_dict_entry_unsigned(r, &sub, "ItemCount", PA_ELEMENTSOF(array_no_children)); append_property_dict_entry_unsigned(r, &sub, "ItemCount", PA_ELEMENTSOF(array_no_children));
append_property_dict_entry_unsigned(r, &sub, "ContainerCount", PA_ELEMENTSOF(array_root_containers)); append_property_dict_entry_unsigned(r, &sub, "ContainerCount", PA_ELEMENTSOF(array_root_containers));
append_property_dict_entry_boolean(r, &sub, "Searchable", FALSE); append_property_dict_entry_boolean(r, &sub, "Searchable", false);
pa_assert_se(dbus_message_iter_close_container(&iter, &sub)); pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
} else if (dbus_message_is_method_call(m, "org.gnome.UPnP.MediaContainer2", "ListChildren") } else if (dbus_message_is_method_call(m, "org.gnome.UPnP.MediaContainer2", "ListChildren")
@ -803,7 +803,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
} else if (message_is_property_get(m, "org.gnome.UPnP.MediaContainer2", "Searchable")) { } else if (message_is_property_get(m, "org.gnome.UPnP.MediaContainer2", "Searchable")) {
pa_assert_se(r = dbus_message_new_method_return(m)); pa_assert_se(r = dbus_message_new_method_return(m));
append_variant_boolean(r, NULL, FALSE); append_variant_boolean(r, NULL, false);
} else if (message_is_property_get_all(m, "org.gnome.UPnP.MediaContainer2")) { } else if (message_is_property_get_all(m, "org.gnome.UPnP.MediaContainer2")) {
DBusMessageIter iter, sub; DBusMessageIter iter, sub;
@ -819,7 +819,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
append_property_dict_entry_unsigned(r, &sub, "ChildCount", item_count); append_property_dict_entry_unsigned(r, &sub, "ChildCount", item_count);
append_property_dict_entry_unsigned(r, &sub, "ItemCount", item_count); append_property_dict_entry_unsigned(r, &sub, "ItemCount", item_count);
append_property_dict_entry_unsigned(r, &sub, "ContainerCount", 0); append_property_dict_entry_unsigned(r, &sub, "ContainerCount", 0);
append_property_dict_entry_boolean(r, &sub, "Searchable", FALSE); append_property_dict_entry_boolean(r, &sub, "Searchable", false);
pa_assert_se(dbus_message_iter_close_container(&iter, &sub)); pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
@ -1081,7 +1081,7 @@ int pa__init(pa_module *m) {
goto fail; goto fail;
} }
u->got_name = TRUE; u->got_name = true;
pa_modargs_free(ma); pa_modargs_free(ma);

View file

@ -46,7 +46,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Sine wave generator source"); PA_MODULE_DESCRIPTION("Sine wave generator source");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"source_name=<name for the source> " "source_name=<name for the source> "
"source_properties=<properties for the source> " "source_properties=<properties for the source> "
@ -178,7 +178,7 @@ static void thread_func(void *userdata) {
pa_rtpoll_set_timer_disabled(u->rtpoll); pa_rtpoll_set_timer_disabled(u->rtpoll);
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)

View file

@ -38,7 +38,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Sine wave generator"); PA_MODULE_DESCRIPTION("Sine wave generator");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink=<sink to connect to> " "sink=<sink to connect to> "
"frequency=<frequency in Hz>"); "frequency=<frequency in Hz>");
@ -99,7 +99,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
pa_sink_input_unref(u->sink_input); pa_sink_input_unref(u->sink_input);
u->sink_input = NULL; u->sink_input = NULL;
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from IO thread context */ /* Called from IO thread context */
@ -113,7 +113,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
* we are heard right-away. */ * we are heard right-away. */
if (PA_SINK_INPUT_IS_LINKED(state) && if (PA_SINK_INPUT_IS_LINKED(state) &&
i->thread_info.state == PA_SINK_INPUT_INIT) i->thread_info.state == PA_SINK_INPUT_INIT)
pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); pa_sink_input_request_rewind(i, 0, false, true, true);
} }
int pa__init(pa_module*m) { int pa__init(pa_module*m) {
@ -155,7 +155,7 @@ int pa__init(pa_module*m) {
pa_sink_input_new_data_init(&data); pa_sink_input_new_data_init(&data);
data.driver = __FILE__; data.driver = __FILE__;
data.module = m; data.module = m;
pa_sink_input_new_data_set_sink(&data, sink, FALSE); pa_sink_input_new_data_set_sink(&data, sink, false);
pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME, "%u Hz Sine", frequency); pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME, "%u Hz Sine", frequency);
pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "abstract"); pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "abstract");
pa_proplist_setf(data.proplist, "sine.hz", "%u", frequency); pa_proplist_setf(data.proplist, "sine.hz", "%u", frequency);

View file

@ -75,7 +75,7 @@ PA_MODULE_USAGE(
"rate=<sample rate> " "rate=<sample rate> "
"buffer_length=<milliseconds> " "buffer_length=<milliseconds> "
"channel_map=<channel map>"); "channel_map=<channel map>");
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
struct userdata { struct userdata {
pa_core *core; pa_core *core;
@ -100,7 +100,7 @@ struct userdata {
pa_rtpoll_item *rtpoll_item; pa_rtpoll_item *rtpoll_item;
pa_module *module; pa_module *module;
pa_bool_t sink_suspended, source_suspended; bool sink_suspended, source_suspended;
uint32_t play_samples_msw, record_samples_msw; uint32_t play_samples_msw, record_samples_msw;
uint32_t prev_playback_samples, prev_record_samples; uint32_t prev_playback_samples, prev_record_samples;
@ -404,14 +404,14 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
if (suspend(u) < 0) if (suspend(u) < 0)
return -1; return -1;
} }
u->sink_suspended = TRUE; u->sink_suspended = true;
break; break;
case PA_SINK_IDLE: case PA_SINK_IDLE:
case PA_SINK_RUNNING: case PA_SINK_RUNNING:
if (u->sink->thread_info.state == PA_SINK_SUSPENDED) { if (u->sink->thread_info.state == PA_SINK_SUSPENDED) {
pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE); pa_smoother_resume(u->smoother, pa_rtclock_now(), true);
if (!u->source || u->source_suspended) { if (!u->source || u->source_suspended) {
if (unsuspend(u) < 0) if (unsuspend(u) < 0)
@ -419,7 +419,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
u->sink->get_volume(u->sink); u->sink->get_volume(u->sink);
u->sink->get_mute(u->sink); u->sink->get_mute(u->sink);
} }
u->sink_suspended = FALSE; u->sink_suspended = false;
} }
break; break;
@ -456,7 +456,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
if (suspend(u) < 0) if (suspend(u) < 0)
return -1; return -1;
} }
u->source_suspended = TRUE; u->source_suspended = true;
break; break;
case PA_SOURCE_IDLE: case PA_SOURCE_IDLE:
@ -468,7 +468,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
return -1; return -1;
u->source->get_volume(u->source); u->source->get_volume(u->source);
} }
u->source_suspended = FALSE; u->source_suspended = false;
} }
break; break;
@ -652,7 +652,7 @@ static void thread_func(void *userdata) {
if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0)
pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno)); pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
pa_smoother_reset(u->smoother, pa_rtclock_now(), TRUE); pa_smoother_reset(u->smoother, pa_rtclock_now(), true);
} }
for (;;) { for (;;) {
@ -778,7 +778,7 @@ static void thread_func(void *userdata) {
} }
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)
@ -817,17 +817,17 @@ static void sig_callback(pa_mainloop_api *api, pa_signal_event*e, int sig, void
pa_log_debug("caught signal"); pa_log_debug("caught signal");
if (u->sink) { if (u->sink) {
pa_sink_get_volume(u->sink, TRUE); pa_sink_get_volume(u->sink, true);
pa_sink_get_mute(u->sink, TRUE); pa_sink_get_mute(u->sink, true);
} }
if (u->source) if (u->source)
pa_source_get_volume(u->source, TRUE); pa_source_get_volume(u->source, true);
} }
int pa__init(pa_module *m) { int pa__init(pa_module *m) {
struct userdata *u = NULL; struct userdata *u = NULL;
pa_bool_t record = TRUE, playback = TRUE; bool record = true, playback = true;
pa_sample_spec ss; pa_sample_spec ss;
pa_channel_map map; pa_channel_map map;
pa_modargs *ma = NULL; pa_modargs *ma = NULL;
@ -837,7 +837,7 @@ int pa__init(pa_module *m) {
pa_source_new_data source_new_data; pa_source_new_data source_new_data;
char const *name; char const *name;
char *name_buf; char *name_buf;
pa_bool_t namereg_fail; bool namereg_fail;
pa_assert(m); pa_assert(m);
@ -858,7 +858,7 @@ int pa__init(pa_module *m) {
u = pa_xnew0(struct userdata, 1); u = pa_xnew0(struct userdata, 1);
if (!(u->smoother = pa_smoother_new(PA_USEC_PER_SEC, PA_USEC_PER_SEC * 2, TRUE, TRUE, 10, pa_rtclock_now(), TRUE))) if (!(u->smoother = pa_smoother_new(PA_USEC_PER_SEC, PA_USEC_PER_SEC * 2, true, true, 10, pa_rtclock_now(), true)))
goto fail; goto fail;
/* /*
@ -913,11 +913,11 @@ int pa__init(pa_module *m) {
if (u->mode != O_WRONLY) { if (u->mode != O_WRONLY) {
name_buf = NULL; name_buf = NULL;
namereg_fail = TRUE; namereg_fail = true;
if (!(name = pa_modargs_get_value(ma, "source_name", NULL))) { if (!(name = pa_modargs_get_value(ma, "source_name", NULL))) {
name = name_buf = pa_sprintf_malloc("solaris_input.%s", pa_path_get_filename(u->device_name)); name = name_buf = pa_sprintf_malloc("solaris_input.%s", pa_path_get_filename(u->device_name));
namereg_fail = FALSE; namereg_fail = false;
} }
pa_source_new_data_init(&source_new_data); pa_source_new_data_init(&source_new_data);
@ -957,16 +957,16 @@ int pa__init(pa_module *m) {
pa_source_set_get_volume_callback(u->source, source_get_volume); pa_source_set_get_volume_callback(u->source, source_get_volume);
pa_source_set_set_volume_callback(u->source, source_set_volume); pa_source_set_set_volume_callback(u->source, source_set_volume);
u->source->refresh_volume = TRUE; u->source->refresh_volume = true;
} else } else
u->source = NULL; u->source = NULL;
if (u->mode != O_RDONLY) { if (u->mode != O_RDONLY) {
name_buf = NULL; name_buf = NULL;
namereg_fail = TRUE; namereg_fail = true;
if (!(name = pa_modargs_get_value(ma, "sink_name", NULL))) { if (!(name = pa_modargs_get_value(ma, "sink_name", NULL))) {
name = name_buf = pa_sprintf_malloc("solaris_output.%s", pa_path_get_filename(u->device_name)); name = name_buf = pa_sprintf_malloc("solaris_output.%s", pa_path_get_filename(u->device_name));
namereg_fail = FALSE; namereg_fail = false;
} }
pa_sink_new_data_init(&sink_new_data); pa_sink_new_data_init(&sink_new_data);
@ -1004,7 +1004,7 @@ int pa__init(pa_module *m) {
pa_sink_set_set_volume_callback(u->sink, sink_set_volume); pa_sink_set_set_volume_callback(u->sink, sink_set_volume);
pa_sink_set_get_mute_callback(u->sink, sink_get_mute); pa_sink_set_get_mute_callback(u->sink, sink_get_mute);
pa_sink_set_set_mute_callback(u->sink, sink_set_mute); pa_sink_set_set_mute_callback(u->sink, sink_set_mute);
u->sink->refresh_volume = u->sink->refresh_muted = TRUE; u->sink->refresh_volume = u->sink->refresh_muted = true;
} else } else
u->sink = NULL; u->sink = NULL;

View file

@ -63,7 +63,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Automatically restore the volume/mute/device state of streams"); PA_MODULE_DESCRIPTION("Automatically restore the volume/mute/device state of streams");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"restore_device=<Save/restore sinks/sources?> " "restore_device=<Save/restore sinks/sources?> "
"restore_volume=<Save/restore volumes?> " "restore_volume=<Save/restore volumes?> "
@ -107,11 +107,11 @@ struct userdata {
pa_time_event *save_time_event; pa_time_event *save_time_event;
pa_database* database; pa_database* database;
pa_bool_t restore_device:1; bool restore_device:1;
pa_bool_t restore_volume:1; bool restore_volume:1;
pa_bool_t restore_muted:1; bool restore_muted:1;
pa_bool_t on_hotplug:1; bool on_hotplug:1;
pa_bool_t on_rescue:1; bool on_rescue:1;
pa_native_protocol *protocol; pa_native_protocol *protocol;
pa_idxset *subscribed; pa_idxset *subscribed;
@ -127,8 +127,8 @@ struct userdata {
struct entry { struct entry {
uint8_t version; uint8_t version;
pa_bool_t muted_valid, volume_valid, device_valid, card_valid; bool muted_valid, volume_valid, device_valid, card_valid;
pa_bool_t muted; bool muted;
pa_channel_map channel_map; pa_channel_map channel_map;
pa_cvolume volume; pa_cvolume volume;
char* device; char* device;
@ -147,7 +147,7 @@ enum {
static struct entry* entry_new(void); static struct entry* entry_new(void);
static void entry_free(struct entry *e); static void entry_free(struct entry *e);
static struct entry *entry_read(struct userdata *u, const char *name); static struct entry *entry_read(struct userdata *u, const char *name);
static pa_bool_t entry_write(struct userdata *u, const char *name, const struct entry *e, pa_bool_t replace); static bool entry_write(struct userdata *u, const char *name, const struct entry *e, bool replace);
static struct entry* entry_copy(const struct entry *e); static struct entry* entry_copy(const struct entry *e);
static void entry_apply(struct userdata *u, const char *name, struct entry *e); static void entry_apply(struct userdata *u, const char *name, struct entry *e);
static void trigger_save(struct userdata *u); static void trigger_save(struct userdata *u);
@ -603,8 +603,8 @@ static void handle_add_entry(DBusConnection *conn, DBusMessage *msg, void *userd
const char *device = NULL; const char *device = NULL;
pa_channel_map map; pa_channel_map map;
pa_cvolume vol; pa_cvolume vol;
dbus_bool_t muted = FALSE; dbus_bool_t muted = false;
dbus_bool_t apply_immediately = FALSE; dbus_bool_t apply_immediately = false;
struct dbus_entry *dbus_entry = NULL; struct dbus_entry *dbus_entry = NULL;
struct entry *e = NULL; struct entry *e = NULL;
@ -633,14 +633,14 @@ static void handle_add_entry(DBusConnection *conn, DBusMessage *msg, void *userd
} }
if ((dbus_entry = pa_hashmap_get(u->dbus_entries, name))) { if ((dbus_entry = pa_hashmap_get(u->dbus_entries, name))) {
pa_bool_t mute_updated = FALSE; bool mute_updated = false;
pa_bool_t volume_updated = FALSE; bool volume_updated = false;
pa_bool_t device_updated = FALSE; bool device_updated = false;
pa_assert_se(e = entry_read(u, name)); pa_assert_se(e = entry_read(u, name));
mute_updated = e->muted != muted; mute_updated = e->muted != muted;
e->muted = muted; e->muted = muted;
e->muted_valid = TRUE; e->muted_valid = true;
volume_updated = (e->volume_valid != !!map.channels) || !pa_cvolume_equal(&e->volume, &vol); volume_updated = (e->volume_valid != !!map.channels) || !pa_cvolume_equal(&e->volume, &vol);
e->volume = vol; e->volume = vol;
@ -664,7 +664,7 @@ static void handle_add_entry(DBusConnection *conn, DBusMessage *msg, void *userd
pa_assert_se(pa_hashmap_put(u->dbus_entries, dbus_entry->entry_name, dbus_entry) == 0); pa_assert_se(pa_hashmap_put(u->dbus_entries, dbus_entry->entry_name, dbus_entry) == 0);
e = entry_new(); e = entry_new();
e->muted_valid = TRUE; e->muted_valid = true;
e->volume_valid = !!map.channels; e->volume_valid = !!map.channels;
e->device_valid = !!device[0]; e->device_valid = !!device[0];
e->muted = muted; e->muted = muted;
@ -675,7 +675,7 @@ static void handle_add_entry(DBusConnection *conn, DBusMessage *msg, void *userd
send_new_entry_signal(dbus_entry); send_new_entry_signal(dbus_entry);
} }
pa_assert_se(entry_write(u, name, e, TRUE)); pa_assert_se(entry_write(u, name, e, true));
if (apply_immediately) if (apply_immediately)
entry_apply(u, name, e); entry_apply(u, name, e);
@ -748,7 +748,7 @@ static void handle_entry_set_device(DBusConnection *conn, DBusMessage *msg, DBus
struct dbus_entry *de = userdata; struct dbus_entry *de = userdata;
const char *device; const char *device;
struct entry *e; struct entry *e;
pa_bool_t updated; bool updated;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
@ -766,7 +766,7 @@ static void handle_entry_set_device(DBusConnection *conn, DBusMessage *msg, DBus
e->device = pa_xstrdup(device); e->device = pa_xstrdup(device);
e->device_valid = !!device[0]; e->device_valid = !!device[0];
pa_assert_se(entry_write(de->userdata, de->entry_name, e, TRUE)); pa_assert_se(entry_write(de->userdata, de->entry_name, e, true));
entry_apply(de->userdata, de->entry_name, e); entry_apply(de->userdata, de->entry_name, e);
send_device_updated_signal(de, e); send_device_updated_signal(de, e);
@ -805,7 +805,7 @@ static void handle_entry_set_volume(DBusConnection *conn, DBusMessage *msg, DBus
pa_channel_map map; pa_channel_map map;
pa_cvolume vol; pa_cvolume vol;
struct entry *e = NULL; struct entry *e = NULL;
pa_bool_t updated = FALSE; bool updated = false;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
@ -824,7 +824,7 @@ static void handle_entry_set_volume(DBusConnection *conn, DBusMessage *msg, DBus
e->channel_map = map; e->channel_map = map;
e->volume_valid = !!map.channels; e->volume_valid = !!map.channels;
pa_assert_se(entry_write(de->userdata, de->entry_name, e, TRUE)); pa_assert_se(entry_write(de->userdata, de->entry_name, e, true));
entry_apply(de->userdata, de->entry_name, e); entry_apply(de->userdata, de->entry_name, e);
send_volume_updated_signal(de, e); send_volume_updated_signal(de, e);
@ -847,7 +847,7 @@ static void handle_entry_get_mute(DBusConnection *conn, DBusMessage *msg, void *
pa_assert_se(e = entry_read(de->userdata, de->entry_name)); pa_assert_se(e = entry_read(de->userdata, de->entry_name));
mute = e->muted_valid ? e->muted : FALSE; mute = e->muted_valid ? e->muted : false;
pa_dbus_send_basic_variant_reply(conn, msg, DBUS_TYPE_BOOLEAN, &mute); pa_dbus_send_basic_variant_reply(conn, msg, DBUS_TYPE_BOOLEAN, &mute);
@ -858,7 +858,7 @@ static void handle_entry_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMe
struct dbus_entry *de = userdata; struct dbus_entry *de = userdata;
dbus_bool_t mute; dbus_bool_t mute;
struct entry *e; struct entry *e;
pa_bool_t updated; bool updated;
pa_assert(conn); pa_assert(conn);
pa_assert(msg); pa_assert(msg);
@ -873,9 +873,9 @@ static void handle_entry_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMe
if (updated) { if (updated) {
e->muted = mute; e->muted = mute;
e->muted_valid = TRUE; e->muted_valid = true;
pa_assert_se(entry_write(de->userdata, de->entry_name, e, TRUE)); pa_assert_se(entry_write(de->userdata, de->entry_name, e, true));
entry_apply(de->userdata, de->entry_name, e); entry_apply(de->userdata, de->entry_name, e);
send_mute_updated_signal(de, e); send_mute_updated_signal(de, e);
@ -904,7 +904,7 @@ static void handle_entry_get_all(DBusConnection *conn, DBusMessage *msg, void *u
pa_assert_se(e = entry_read(de->userdata, de->entry_name)); pa_assert_se(e = entry_read(de->userdata, de->entry_name));
device = e->device_valid ? e->device : ""; device = e->device_valid ? e->device : "";
mute = e->muted_valid ? e->muted : FALSE; mute = e->muted_valid ? e->muted : false;
pa_assert_se((reply = dbus_message_new_method_return(msg))); pa_assert_se((reply = dbus_message_new_method_return(msg)));
@ -986,10 +986,10 @@ static void entry_free(struct entry* e) {
pa_xfree(e); pa_xfree(e);
} }
static pa_bool_t entry_write(struct userdata *u, const char *name, const struct entry *e, pa_bool_t replace) { static bool entry_write(struct userdata *u, const char *name, const struct entry *e, bool replace) {
pa_tagstruct *t; pa_tagstruct *t;
pa_datum key, data; pa_datum key, data;
pa_bool_t r; bool r;
pa_assert(u); pa_assert(u);
pa_assert(name); pa_assert(name);
@ -1025,8 +1025,8 @@ static pa_bool_t entry_write(struct userdata *u, const char *name, const struct
static struct entry *legacy_entry_read(struct userdata *u, const char *name) { static struct entry *legacy_entry_read(struct userdata *u, const char *name) {
struct legacy_entry { struct legacy_entry {
uint8_t version; uint8_t version;
pa_bool_t muted_valid:1, volume_valid:1, device_valid:1, card_valid:1; bool muted_valid:1, volume_valid:1, device_valid:1, card_valid:1;
pa_bool_t muted:1; bool muted:1;
pa_channel_map channel_map; pa_channel_map channel_map;
pa_cvolume volume; pa_cvolume volume;
char device[PA_NAME_MAX]; char device[PA_NAME_MAX];
@ -1220,7 +1220,7 @@ static void trigger_save(struct userdata *u) {
u->save_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + SAVE_INTERVAL, save_time_callback, u); u->save_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + SAVE_INTERVAL, save_time_callback, u);
} }
static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) { static bool entries_equal(const struct entry *a, const struct entry *b) {
pa_cvolume t; pa_cvolume t;
pa_assert(a); pa_assert(a);
@ -1228,22 +1228,22 @@ static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) {
if (a->device_valid != b->device_valid || if (a->device_valid != b->device_valid ||
(a->device_valid && !pa_streq(a->device, b->device))) (a->device_valid && !pa_streq(a->device, b->device)))
return FALSE; return false;
if (a->card_valid != b->card_valid || if (a->card_valid != b->card_valid ||
(a->card_valid && !pa_streq(a->card, b->card))) (a->card_valid && !pa_streq(a->card, b->card)))
return FALSE; return false;
if (a->muted_valid != b->muted_valid || if (a->muted_valid != b->muted_valid ||
(a->muted_valid && (a->muted != b->muted))) (a->muted_valid && (a->muted != b->muted)))
return FALSE; return false;
t = b->volume; t = b->volume;
if (a->volume_valid != b->volume_valid || if (a->volume_valid != b->volume_valid ||
(a->volume_valid && !pa_cvolume_equal(pa_cvolume_remap(&t, &b->channel_map, &a->channel_map), &a->volume))) (a->volume_valid && !pa_cvolume_equal(pa_cvolume_remap(&t, &b->channel_map, &a->channel_map), &a->volume)))
return FALSE; return false;
return TRUE; return true;
} }
static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata) { static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata) {
@ -1253,10 +1253,10 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
/* These are only used when D-Bus is enabled, but in order to reduce ifdef /* These are only used when D-Bus is enabled, but in order to reduce ifdef
* clutter these are defined here unconditionally. */ * clutter these are defined here unconditionally. */
pa_bool_t created_new_entry = TRUE; bool created_new_entry = true;
pa_bool_t device_updated = FALSE; bool device_updated = false;
pa_bool_t volume_updated = FALSE; bool volume_updated = false;
pa_bool_t mute_updated = FALSE; bool mute_updated = false;
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
struct dbus_entry *de = NULL; struct dbus_entry *de = NULL;
@ -1282,7 +1282,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if ((old = entry_read(u, name))) { if ((old = entry_read(u, name))) {
entry = entry_copy(old); entry = entry_copy(old);
created_new_entry = FALSE; created_new_entry = false;
} else } else
entry = entry_new(); entry = entry_new();
@ -1290,8 +1290,8 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
pa_assert(sink_input->volume_writable); pa_assert(sink_input->volume_writable);
entry->channel_map = sink_input->channel_map; entry->channel_map = sink_input->channel_map;
pa_sink_input_get_volume(sink_input, &entry->volume, FALSE); pa_sink_input_get_volume(sink_input, &entry->volume, false);
entry->volume_valid = TRUE; entry->volume_valid = true;
volume_updated = !created_new_entry volume_updated = !created_new_entry
&& (!old->volume_valid && (!old->volume_valid
@ -1301,7 +1301,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if (sink_input->save_muted) { if (sink_input->save_muted) {
entry->muted = pa_sink_input_get_mute(sink_input); entry->muted = pa_sink_input_get_mute(sink_input);
entry->muted_valid = TRUE; entry->muted_valid = true;
mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted); mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted);
} }
@ -1309,13 +1309,13 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if (sink_input->save_sink) { if (sink_input->save_sink) {
pa_xfree(entry->device); pa_xfree(entry->device);
entry->device = pa_xstrdup(sink_input->sink->name); entry->device = pa_xstrdup(sink_input->sink->name);
entry->device_valid = TRUE; entry->device_valid = true;
device_updated = !created_new_entry && (!old->device_valid || !pa_streq(entry->device, old->device)); device_updated = !created_new_entry && (!old->device_valid || !pa_streq(entry->device, old->device));
if (sink_input->sink->card) { if (sink_input->sink->card) {
pa_xfree(entry->card); pa_xfree(entry->card);
entry->card = pa_xstrdup(sink_input->sink->card->name); entry->card = pa_xstrdup(sink_input->sink->card->name);
entry->card_valid = TRUE; entry->card_valid = true;
} }
} }
@ -1332,7 +1332,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if ((old = entry_read(u, name))) { if ((old = entry_read(u, name))) {
entry = entry_copy(old); entry = entry_copy(old);
created_new_entry = FALSE; created_new_entry = false;
} else } else
entry = entry_new(); entry = entry_new();
@ -1340,8 +1340,8 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
pa_assert(source_output->volume_writable); pa_assert(source_output->volume_writable);
entry->channel_map = source_output->channel_map; entry->channel_map = source_output->channel_map;
pa_source_output_get_volume(source_output, &entry->volume, FALSE); pa_source_output_get_volume(source_output, &entry->volume, false);
entry->volume_valid = TRUE; entry->volume_valid = true;
volume_updated = !created_new_entry volume_updated = !created_new_entry
&& (!old->volume_valid && (!old->volume_valid
@ -1351,7 +1351,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if (source_output->save_muted) { if (source_output->save_muted) {
entry->muted = pa_source_output_get_mute(source_output); entry->muted = pa_source_output_get_mute(source_output);
entry->muted_valid = TRUE; entry->muted_valid = true;
mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted); mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted);
} }
@ -1359,14 +1359,14 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if (source_output->save_source) { if (source_output->save_source) {
pa_xfree(entry->device); pa_xfree(entry->device);
entry->device = pa_xstrdup(source_output->source->name); entry->device = pa_xstrdup(source_output->source->name);
entry->device_valid = TRUE; entry->device_valid = true;
device_updated = !created_new_entry && (!old->device_valid || !pa_streq(entry->device, old->device)); device_updated = !created_new_entry && (!old->device_valid || !pa_streq(entry->device, old->device));
if (source_output->source->card) { if (source_output->source->card) {
pa_xfree(entry->card); pa_xfree(entry->card);
entry->card = pa_xstrdup(source_output->source->card->name); entry->card = pa_xstrdup(source_output->source->card->name);
entry->card_valid = TRUE; entry->card_valid = true;
} }
} }
} }
@ -1387,7 +1387,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
pa_log_info("Storing volume/mute/device for stream %s.", name); pa_log_info("Storing volume/mute/device for stream %s.", name);
if (entry_write(u, name, entry, TRUE)) if (entry_write(u, name, entry, true))
trigger_save(u); trigger_save(u);
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
@ -1442,7 +1442,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
same time, in which case we want to make sure we don't same time, in which case we want to make sure we don't
interfere with that */ interfere with that */
if (s && PA_SINK_IS_LINKED(pa_sink_get_state(s))) if (s && PA_SINK_IS_LINKED(pa_sink_get_state(s)))
if (pa_sink_input_new_data_set_sink(new_data, s, TRUE)) if (pa_sink_input_new_data_set_sink(new_data, s, true))
pa_log_info("Restoring device for stream %s.", name); pa_log_info("Restoring device for stream %s.", name);
entry_free(e); entry_free(e);
@ -1481,8 +1481,8 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *c, pa_sink_inpu
pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map); pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map);
pa_sink_input_new_data_set_volume(new_data, &v); pa_sink_input_new_data_set_volume(new_data, &v);
new_data->volume_is_absolute = FALSE; new_data->volume_is_absolute = false;
new_data->save_volume = TRUE; new_data->save_volume = true;
} }
} }
@ -1491,7 +1491,7 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *c, pa_sink_inpu
if (!new_data->muted_is_set) { if (!new_data->muted_is_set) {
pa_log_info("Restoring mute state for sink input %s.", name); pa_log_info("Restoring mute state for sink input %s.", name);
pa_sink_input_new_data_set_muted(new_data, e->muted); pa_sink_input_new_data_set_muted(new_data, e->muted);
new_data->save_muted = TRUE; new_data->save_muted = true;
} else } else
pa_log_debug("Not restoring mute state for sink input %s, because already set.", name); pa_log_debug("Not restoring mute state for sink input %s, because already set.", name);
} }
@ -1539,7 +1539,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
interfere with that */ interfere with that */
if (s && PA_SOURCE_IS_LINKED(pa_source_get_state(s))) { if (s && PA_SOURCE_IS_LINKED(pa_source_get_state(s))) {
pa_log_info("Restoring device for stream %s.", name); pa_log_info("Restoring device for stream %s.", name);
pa_source_output_new_data_set_source(new_data, s, TRUE); pa_source_output_new_data_set_source(new_data, s, true);
} }
entry_free(e); entry_free(e);
@ -1578,8 +1578,8 @@ static pa_hook_result_t source_output_fixate_hook_callback(pa_core *c, pa_source
pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map); pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map);
pa_source_output_new_data_set_volume(new_data, &v); pa_source_output_new_data_set_volume(new_data, &v);
new_data->volume_is_absolute = FALSE; new_data->volume_is_absolute = false;
new_data->save_volume = TRUE; new_data->save_volume = true;
} }
} }
@ -1588,7 +1588,7 @@ static pa_hook_result_t source_output_fixate_hook_callback(pa_core *c, pa_source
if (!new_data->muted_is_set) { if (!new_data->muted_is_set) {
pa_log_info("Restoring mute state for source output %s.", name); pa_log_info("Restoring mute state for source output %s.", name);
pa_source_output_new_data_set_muted(new_data, e->muted); pa_source_output_new_data_set_muted(new_data, e->muted);
new_data->save_muted = TRUE; new_data->save_muted = true;
} else } else
pa_log_debug("Not restoring mute state for source output %s, because already set.", name); pa_log_debug("Not restoring mute state for source output %s, because already set.", name);
} }
@ -1636,7 +1636,7 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, struct
if ((e = entry_read(u, name))) { if ((e = entry_read(u, name))) {
if (e->device_valid && pa_streq(e->device, sink->name)) if (e->device_valid && pa_streq(e->device, sink->name))
pa_sink_input_move_to(si, sink, TRUE); pa_sink_input_move_to(si, sink, true);
entry_free(e); entry_free(e);
} }
@ -1684,7 +1684,7 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source,
if ((e = entry_read(u, name))) { if ((e = entry_read(u, name))) {
if (e->device_valid && pa_streq(e->device, source->name)) if (e->device_valid && pa_streq(e->device, source->name))
pa_source_output_move_to(so, source, TRUE); pa_source_output_move_to(so, source, true);
entry_free(e); entry_free(e);
} }
@ -1726,7 +1726,7 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, str
if ((d = pa_namereg_get(c, e->device, PA_NAMEREG_SINK)) && if ((d = pa_namereg_get(c, e->device, PA_NAMEREG_SINK)) &&
d != sink && d != sink &&
PA_SINK_IS_LINKED(pa_sink_get_state(d))) PA_SINK_IS_LINKED(pa_sink_get_state(d)))
pa_sink_input_move_to(si, d, TRUE); pa_sink_input_move_to(si, d, true);
} }
entry_free(e); entry_free(e);
@ -1772,7 +1772,7 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc
if ((d = pa_namereg_get(c, e->device, PA_NAMEREG_SOURCE)) && if ((d = pa_namereg_get(c, e->device, PA_NAMEREG_SOURCE)) &&
d != source && d != source &&
PA_SOURCE_IS_LINKED(pa_source_get_state(d))) PA_SOURCE_IS_LINKED(pa_source_get_state(d)))
pa_source_output_move_to(so, d, TRUE); pa_source_output_move_to(so, d, true);
} }
entry_free(e); entry_free(e);
@ -1837,7 +1837,7 @@ static int fill_db(struct userdata *u, const char *filename) {
pa_zero(e); pa_zero(e);
e.version = ENTRY_VERSION; e.version = ENTRY_VERSION;
e.volume_valid = TRUE; e.volume_valid = true;
pa_cvolume_set(&e.volume, 1, pa_sw_volume_from_dB(db)); pa_cvolume_set(&e.volume, 1, pa_sw_volume_from_dB(db));
pa_channel_map_init_mono(&e.channel_map); pa_channel_map_init_mono(&e.channel_map);
@ -1847,7 +1847,7 @@ static int fill_db(struct userdata *u, const char *filename) {
data.data = (void *) &e; data.data = (void *) &e;
data.size = sizeof(e); data.size = sizeof(e);
if (pa_database_set(u->database, &key, &data, FALSE) == 0) if (pa_database_set(u->database, &key, &data, false) == 0)
pa_log_debug("Setting %s to %0.2f dB.", ln, db); pa_log_debug("Setting %s to %0.2f dB.", ln, db);
} else } else
pa_log_warn("[%s:%u] Positive dB values are not allowed, not setting entry %s.", fn, n, ln); pa_log_warn("[%s:%u] Positive dB values are not allowed, not setting entry %s.", fn, n, ln);
@ -1895,12 +1895,12 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) {
v = e->volume; v = e->volume;
pa_log_info("Restoring volume for sink input %s.", name); pa_log_info("Restoring volume for sink input %s.", name);
pa_cvolume_remap(&v, &e->channel_map, &si->channel_map); pa_cvolume_remap(&v, &e->channel_map, &si->channel_map);
pa_sink_input_set_volume(si, &v, TRUE, FALSE); pa_sink_input_set_volume(si, &v, true, false);
} }
if (u->restore_muted && e->muted_valid) { if (u->restore_muted && e->muted_valid) {
pa_log_info("Restoring mute state for sink input %s.", name); pa_log_info("Restoring mute state for sink input %s.", name);
pa_sink_input_set_mute(si, e->muted, TRUE); pa_sink_input_set_mute(si, e->muted, true);
} }
if (u->restore_device) { if (u->restore_device) {
@ -1910,7 +1910,7 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) {
/* If the device is not valid we should make sure the /* If the device is not valid we should make sure the
save flag is cleared as the user may have specifically save flag is cleared as the user may have specifically
removed the sink element from the rule. */ removed the sink element from the rule. */
si->save_sink = FALSE; si->save_sink = false;
/* This is cheating a bit. The sink input itself has not changed /* This is cheating a bit. The sink input itself has not changed
but the rules governing it's routing have, so we fire this event but the rules governing it's routing have, so we fire this event
such that other routing modules (e.g. module-device-manager) such that other routing modules (e.g. module-device-manager)
@ -1919,7 +1919,7 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) {
} }
} else if ((s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SINK))) { } else if ((s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SINK))) {
pa_log_info("Restoring device for stream %s.", name); pa_log_info("Restoring device for stream %s.", name);
pa_sink_input_move_to(si, s, TRUE); pa_sink_input_move_to(si, s, true);
} }
} }
} }
@ -1943,12 +1943,12 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) {
v = e->volume; v = e->volume;
pa_log_info("Restoring volume for source output %s.", name); pa_log_info("Restoring volume for source output %s.", name);
pa_cvolume_remap(&v, &e->channel_map, &so->channel_map); pa_cvolume_remap(&v, &e->channel_map, &so->channel_map);
pa_source_output_set_volume(so, &v, TRUE, FALSE); pa_source_output_set_volume(so, &v, true, false);
} }
if (u->restore_muted && e->muted_valid) { if (u->restore_muted && e->muted_valid) {
pa_log_info("Restoring mute state for source output %s.", name); pa_log_info("Restoring mute state for source output %s.", name);
pa_source_output_set_mute(so, e->muted, TRUE); pa_source_output_set_mute(so, e->muted, true);
} }
if (u->restore_device) { if (u->restore_device) {
@ -1958,7 +1958,7 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) {
/* If the device is not valid we should make sure the /* If the device is not valid we should make sure the
save flag is cleared as the user may have specifically save flag is cleared as the user may have specifically
removed the source element from the rule. */ removed the source element from the rule. */
so->save_source = FALSE; so->save_source = false;
/* This is cheating a bit. The source output itself has not changed /* This is cheating a bit. The source output itself has not changed
but the rules governing it's routing have, so we fire this event but the rules governing it's routing have, so we fire this event
such that other routing modules (e.g. module-device-manager) such that other routing modules (e.g. module-device-manager)
@ -1967,7 +1967,7 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) {
} }
} else if ((s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SOURCE))) { } else if ((s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SOURCE))) {
pa_log_info("Restoring device for stream %s.", name); pa_log_info("Restoring device for stream %s.", name);
pa_source_output_move_to(so, s, TRUE); pa_source_output_move_to(so, s, true);
} }
} }
} }
@ -1976,7 +1976,7 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) {
#ifdef DEBUG_VOLUME #ifdef DEBUG_VOLUME
PA_GCC_UNUSED static void stream_restore_dump_database(struct userdata *u) { PA_GCC_UNUSED static void stream_restore_dump_database(struct userdata *u) {
pa_datum key; pa_datum key;
pa_bool_t done; bool done;
done = !pa_database_first(u->database, &key, NULL); done = !pa_database_first(u->database, &key, NULL);
@ -2039,7 +2039,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
case SUBCOMMAND_READ: { case SUBCOMMAND_READ: {
pa_datum key; pa_datum key;
pa_bool_t done; bool done;
if (!pa_tagstruct_eof(t)) if (!pa_tagstruct_eof(t))
goto fail; goto fail;
@ -2064,7 +2064,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
pa_tagstruct_put_channel_map(reply, e->volume_valid ? &e->channel_map : pa_channel_map_init(&cm)); pa_tagstruct_put_channel_map(reply, e->volume_valid ? &e->channel_map : pa_channel_map_init(&cm));
pa_tagstruct_put_cvolume(reply, e->volume_valid ? &e->volume : pa_cvolume_init(&r)); pa_tagstruct_put_cvolume(reply, e->volume_valid ? &e->volume : pa_cvolume_init(&r));
pa_tagstruct_puts(reply, e->device_valid ? e->device : NULL); pa_tagstruct_puts(reply, e->device_valid ? e->device : NULL);
pa_tagstruct_put_boolean(reply, e->muted_valid ? e->muted : FALSE); pa_tagstruct_put_boolean(reply, e->muted_valid ? e->muted : false);
entry_free(e); entry_free(e);
} }
@ -2079,7 +2079,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
case SUBCOMMAND_WRITE: { case SUBCOMMAND_WRITE: {
uint32_t mode; uint32_t mode;
pa_bool_t apply_immediately = FALSE; bool apply_immediately = false;
if (pa_tagstruct_getu32(t, &mode) < 0 || if (pa_tagstruct_getu32(t, &mode) < 0 ||
pa_tagstruct_get_boolean(t, &apply_immediately) < 0) pa_tagstruct_get_boolean(t, &apply_immediately) < 0)
@ -2105,7 +2105,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
while (!pa_tagstruct_eof(t)) { while (!pa_tagstruct_eof(t)) {
const char *name, *device; const char *name, *device;
pa_bool_t muted; bool muted;
struct entry *entry; struct entry *entry;
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
struct entry *old; struct entry *old;
@ -2134,7 +2134,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
} }
entry->muted = muted; entry->muted = muted;
entry->muted_valid = TRUE; entry->muted_valid = true;
entry->device = pa_xstrdup(device); entry->device = pa_xstrdup(device);
entry->device_valid = device && !!entry->device[0]; entry->device_valid = device && !!entry->device[0];
@ -2225,7 +2225,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
case SUBCOMMAND_SUBSCRIBE: { case SUBCOMMAND_SUBSCRIBE: {
pa_bool_t enabled; bool enabled;
if (pa_tagstruct_get_boolean(t, &enabled) < 0 || if (pa_tagstruct_get_boolean(t, &enabled) < 0 ||
!pa_tagstruct_eof(t)) !pa_tagstruct_eof(t))
@ -2274,7 +2274,7 @@ static void clean_up_db(struct userdata *u) {
#ifdef ENABLE_LEGACY_DATABASE_ENTRY_FORMAT #ifdef ENABLE_LEGACY_DATABASE_ENTRY_FORMAT
PA_LLIST_HEAD(struct clean_up_item, to_be_converted); PA_LLIST_HEAD(struct clean_up_item, to_be_converted);
#endif #endif
pa_bool_t done = FALSE; bool done = false;
pa_datum key; pa_datum key;
struct clean_up_item *item = NULL; struct clean_up_item *item = NULL;
struct clean_up_item *next = NULL; struct clean_up_item *next = NULL;
@ -2347,7 +2347,7 @@ static void clean_up_db(struct userdata *u) {
PA_LLIST_FOREACH_SAFE(item, next, to_be_converted) { PA_LLIST_FOREACH_SAFE(item, next, to_be_converted) {
pa_log_debug("Upgrading a legacy entry to the current format: %s", item->entry_name); pa_log_debug("Upgrading a legacy entry to the current format: %s", item->entry_name);
pa_assert_se(entry_write(u, item->entry_name, item->entry, TRUE) >= 0); pa_assert_se(entry_write(u, item->entry_name, item->entry, true) >= 0);
trigger_save(u); trigger_save(u);
PA_LLIST_REMOVE(struct clean_up_item, to_be_converted, item); PA_LLIST_REMOVE(struct clean_up_item, to_be_converted, item);
@ -2365,10 +2365,10 @@ int pa__init(pa_module*m) {
pa_sink_input *si; pa_sink_input *si;
pa_source_output *so; pa_source_output *so;
uint32_t idx; uint32_t idx;
pa_bool_t restore_device = TRUE, restore_volume = TRUE, restore_muted = TRUE, on_hotplug = TRUE, on_rescue = TRUE; bool restore_device = true, restore_volume = true, restore_muted = true, on_hotplug = true, on_rescue = true;
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
pa_datum key; pa_datum key;
pa_bool_t done; bool done;
#endif #endif
pa_assert(m); pa_assert(m);
@ -2430,10 +2430,10 @@ int pa__init(pa_module*m) {
u->source_output_fixate_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_FIXATE], PA_HOOK_EARLY, (pa_hook_cb_t) source_output_fixate_hook_callback, u); u->source_output_fixate_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_FIXATE], PA_HOOK_EARLY, (pa_hook_cb_t) source_output_fixate_hook_callback, u);
} }
if (!(fname = pa_state_path("stream-volumes", TRUE))) if (!(fname = pa_state_path("stream-volumes", true)))
goto fail; goto fail;
if (!(u->database = pa_database_open(fname, TRUE))) { if (!(u->database = pa_database_open(fname, true))) {
pa_log("Failed to open volume database '%s': %s", fname, pa_cstrerror(errno)); pa_log("Failed to open volume database '%s': %s", fname, pa_cstrerror(errno));
pa_xfree(fname); pa_xfree(fname);
goto fail; goto fail;

View file

@ -39,7 +39,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("When a sink/source is idle for too long, suspend it"); PA_MODULE_DESCRIPTION("When a sink/source is idle for too long, suspend it");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE("timeout=<timeout>"); PA_MODULE_USAGE("timeout=<timeout>");
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -89,13 +89,13 @@ static void timeout_cb(pa_mainloop_api*a, pa_time_event* e, const struct timeval
if (d->sink && pa_sink_check_suspend(d->sink) <= 0 && !(d->sink->suspend_cause & PA_SUSPEND_IDLE)) { if (d->sink && pa_sink_check_suspend(d->sink) <= 0 && !(d->sink->suspend_cause & PA_SUSPEND_IDLE)) {
pa_log_info("Sink %s idle for too long, suspending ...", d->sink->name); pa_log_info("Sink %s idle for too long, suspending ...", d->sink->name);
pa_sink_suspend(d->sink, TRUE, PA_SUSPEND_IDLE); pa_sink_suspend(d->sink, true, PA_SUSPEND_IDLE);
pa_core_maybe_vacuum(d->userdata->core); pa_core_maybe_vacuum(d->userdata->core);
} }
if (d->source && pa_source_check_suspend(d->source) <= 0 && !(d->source->suspend_cause & PA_SUSPEND_IDLE)) { if (d->source && pa_source_check_suspend(d->source) <= 0 && !(d->source->suspend_cause & PA_SUSPEND_IDLE)) {
pa_log_info("Source %s idle for too long, suspending ...", d->source->name); pa_log_info("Source %s idle for too long, suspending ...", d->source->name);
pa_source_suspend(d->source, TRUE, PA_SUSPEND_IDLE); pa_source_suspend(d->source, true, PA_SUSPEND_IDLE);
pa_core_maybe_vacuum(d->userdata->core); pa_core_maybe_vacuum(d->userdata->core);
} }
} }
@ -129,12 +129,12 @@ static void resume(struct device_info *d) {
if (d->sink) { if (d->sink) {
pa_log_debug("Sink %s becomes busy, resuming.", d->sink->name); pa_log_debug("Sink %s becomes busy, resuming.", d->sink->name);
pa_sink_suspend(d->sink, FALSE, PA_SUSPEND_IDLE); pa_sink_suspend(d->sink, false, PA_SUSPEND_IDLE);
} }
if (d->source) { if (d->source) {
pa_log_debug("Source %s becomes busy, resuming.", d->source->name); pa_log_debug("Source %s becomes busy, resuming.", d->source->name);
pa_source_suspend(d->source, FALSE, PA_SUSPEND_IDLE); pa_source_suspend(d->source, false, PA_SUSPEND_IDLE);
} }
} }

View file

@ -40,7 +40,7 @@
PA_MODULE_AUTHOR("Michael Terry"); PA_MODULE_AUTHOR("Michael Terry");
PA_MODULE_DESCRIPTION("When a sink/source is added, switch to it"); PA_MODULE_DESCRIPTION("When a sink/source is added, switch to it");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
NULL, NULL,
@ -90,7 +90,7 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, void*
if (i->save_sink || !PA_SINK_INPUT_IS_LINKED(i->state)) if (i->save_sink || !PA_SINK_INPUT_IS_LINKED(i->state))
continue; continue;
if (pa_sink_input_move_to(i, sink, FALSE) < 0) if (pa_sink_input_move_to(i, sink, false) < 0)
pa_log_info("Failed to move sink input %u \"%s\" to %s.", i->index, pa_log_info("Failed to move sink input %u \"%s\" to %s.", i->index,
pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), sink->name); pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), sink->name);
else else
@ -143,7 +143,7 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source,
if (o->save_source || !PA_SOURCE_OUTPUT_IS_LINKED(o->state)) if (o->save_source || !PA_SOURCE_OUTPUT_IS_LINKED(o->state))
continue; continue;
if (pa_source_output_move_to(o, source, FALSE) < 0) if (pa_source_output_move_to(o, source, false) < 0)
pa_log_info("Failed to move source output %u \"%s\" to %s.", o->index, pa_log_info("Failed to move source output %u \"%s\" to %s.", o->index,
pa_strnull(pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME)), source->name); pa_strnull(pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME)), source->name);
else else

View file

@ -121,7 +121,7 @@ static int try_to_switch_profile(pa_device_port *port) {
return -1; return -1;
} }
if (pa_card_set_profile(port->card, best_profile->name, FALSE) != 0) { if (pa_card_set_profile(port->card, best_profile->name, false) != 0) {
pa_log_debug("Could not set profile %s", best_profile->name); pa_log_debug("Could not set profile %s", best_profile->name);
return -1; return -1;
} }
@ -157,7 +157,7 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
pa_card* card; pa_card* card;
pa_sink *sink; pa_sink *sink;
pa_source *source; pa_source *source;
pa_bool_t is_active_profile, is_active_port; bool is_active_profile, is_active_port;
if (port->available == PA_AVAILABLE_UNKNOWN) if (port->available == PA_AVAILABLE_UNKNOWN)
return PA_HOOK_OK; return PA_HOOK_OK;
@ -196,9 +196,9 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
} }
if (source) if (source)
pa_source_set_port(source, port->name, FALSE); pa_source_set_port(source, port->name, false);
if (sink) if (sink)
pa_sink_set_port(sink, port->name, FALSE); pa_sink_set_port(sink, port->name, false);
} }
if (port->available == PA_AVAILABLE_NO) { if (port->available == PA_AVAILABLE_NO) {
@ -206,7 +206,7 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
pa_device_port *p2 = find_best_port(sink->ports); pa_device_port *p2 = find_best_port(sink->ports);
if (p2 && p2->available != PA_AVAILABLE_NO) if (p2 && p2->available != PA_AVAILABLE_NO)
pa_sink_set_port(sink, p2->name, FALSE); pa_sink_set_port(sink, p2->name, false);
else { else {
/* Maybe try to switch to another profile? */ /* Maybe try to switch to another profile? */
} }
@ -216,7 +216,7 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
pa_device_port *p2 = find_best_port(source->ports); pa_device_port *p2 = find_best_port(source->ports);
if (p2 && p2->available != PA_AVAILABLE_NO) if (p2 && p2->available != PA_AVAILABLE_NO)
pa_source_set_port(source, p2->name, FALSE); pa_source_set_port(source, p2->name, false);
else { else {
/* Maybe try to switch to another profile? */ /* Maybe try to switch to another profile? */
} }

View file

@ -45,7 +45,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Create a client for each login session of this user"); PA_MODULE_DESCRIPTION("Create a client for each login session of this user");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
NULL NULL

View file

@ -89,7 +89,7 @@ PA_MODULE_USAGE(
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"server", "server",
@ -205,8 +205,8 @@ struct userdata {
int64_t counter, counter_delta; int64_t counter, counter_delta;
pa_bool_t remote_corked:1; bool remote_corked:1;
pa_bool_t remote_suspended:1; bool remote_suspended:1;
pa_usec_t transport_usec; /* maintained in the main thread */ pa_usec_t transport_usec; /* maintained in the main thread */
pa_usec_t thread_transport_usec; /* maintained in the IO thread */ pa_usec_t thread_transport_usec; /* maintained in the IO thread */
@ -248,7 +248,7 @@ static void command_stream_killed(pa_pdispatch *pd, uint32_t command, uint32_t
pa_assert(u->pdispatch == pd); pa_assert(u->pdispatch == pd);
pa_log_warn("Stream killed"); pa_log_warn("Stream killed");
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from main context */ /* Called from main context */
@ -268,7 +268,7 @@ static void command_overflow_or_underflow(pa_pdispatch *pd, uint32_t command,
static void command_suspended(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { static void command_suspended(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
struct userdata *u = userdata; struct userdata *u = userdata;
uint32_t channel; uint32_t channel;
pa_bool_t suspended; bool suspended;
pa_assert(pd); pa_assert(pd);
pa_assert(t); pa_assert(t);
@ -280,7 +280,7 @@ static void command_suspended(pa_pdispatch *pd, uint32_t command, uint32_t tag
!pa_tagstruct_eof(t)) { !pa_tagstruct_eof(t)) {
pa_log("Invalid packet."); pa_log("Invalid packet.");
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
return; return;
} }
@ -300,7 +300,7 @@ static void command_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
struct userdata *u = userdata; struct userdata *u = userdata;
uint32_t channel, di; uint32_t channel, di;
const char *dn; const char *dn;
pa_bool_t suspended; bool suspended;
pa_assert(pd); pa_assert(pd);
pa_assert(t); pa_assert(t);
@ -313,7 +313,7 @@ static void command_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
pa_tagstruct_get_boolean(t, &suspended) < 0) { pa_tagstruct_get_boolean(t, &suspended) < 0) {
pa_log_error("Invalid packet."); pa_log_error("Invalid packet.");
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
return; return;
} }
@ -342,7 +342,7 @@ static void command_stream_buffer_attr_changed(pa_pdispatch *pd, uint32_t comman
pa_tagstruct_getu32(t, &maxlength) < 0) { pa_tagstruct_getu32(t, &maxlength) < 0) {
pa_log_error("Invalid packet."); pa_log_error("Invalid packet.");
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
return; return;
} }
@ -351,7 +351,7 @@ static void command_stream_buffer_attr_changed(pa_pdispatch *pd, uint32_t comman
pa_tagstruct_get_usec(t, &usec) < 0) { pa_tagstruct_get_usec(t, &usec) < 0) {
pa_log_error("Invalid packet."); pa_log_error("Invalid packet.");
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
return; return;
} }
} else { } else {
@ -361,7 +361,7 @@ static void command_stream_buffer_attr_changed(pa_pdispatch *pd, uint32_t comman
pa_tagstruct_get_usec(t, &usec) < 0) { pa_tagstruct_get_usec(t, &usec) < 0) {
pa_log_error("Invalid packet."); pa_log_error("Invalid packet.");
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
return; return;
} }
} }
@ -391,7 +391,7 @@ static void command_started(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
#endif #endif
/* Called from IO thread context */ /* Called from IO thread context */
static void check_smoother_status(struct userdata *u, pa_bool_t past) { static void check_smoother_status(struct userdata *u, bool past) {
pa_usec_t x; pa_usec_t x;
pa_assert(u); pa_assert(u);
@ -410,22 +410,22 @@ static void check_smoother_status(struct userdata *u, pa_bool_t past) {
if (u->remote_suspended || u->remote_corked) if (u->remote_suspended || u->remote_corked)
pa_smoother_pause(u->smoother, x); pa_smoother_pause(u->smoother, x);
else else
pa_smoother_resume(u->smoother, x, TRUE); pa_smoother_resume(u->smoother, x, true);
} }
/* Called from IO thread context */ /* Called from IO thread context */
static void stream_cork_within_thread(struct userdata *u, pa_bool_t cork) { static void stream_cork_within_thread(struct userdata *u, bool cork) {
pa_assert(u); pa_assert(u);
if (u->remote_corked == cork) if (u->remote_corked == cork)
return; return;
u->remote_corked = cork; u->remote_corked = cork;
check_smoother_status(u, FALSE); check_smoother_status(u, false);
} }
/* Called from main context */ /* Called from main context */
static void stream_cork(struct userdata *u, pa_bool_t cork) { static void stream_cork(struct userdata *u, bool cork) {
pa_tagstruct *t; pa_tagstruct *t;
pa_assert(u); pa_assert(u);
@ -447,14 +447,14 @@ static void stream_cork(struct userdata *u, pa_bool_t cork) {
} }
/* Called from IO thread context */ /* Called from IO thread context */
static void stream_suspend_within_thread(struct userdata *u, pa_bool_t suspend) { static void stream_suspend_within_thread(struct userdata *u, bool suspend) {
pa_assert(u); pa_assert(u);
if (u->remote_suspended == suspend) if (u->remote_suspended == suspend)
return; return;
u->remote_suspended = suspend; u->remote_suspended = suspend;
check_smoother_status(u, TRUE); check_smoother_status(u, true);
} }
#ifdef TUNNEL_SINK #ifdef TUNNEL_SINK
@ -567,13 +567,13 @@ static int sink_set_state(pa_sink *s, pa_sink_state_t state) {
case PA_SINK_SUSPENDED: case PA_SINK_SUSPENDED:
pa_assert(PA_SINK_IS_OPENED(s->state)); pa_assert(PA_SINK_IS_OPENED(s->state));
stream_cork(u, TRUE); stream_cork(u, true);
break; break;
case PA_SINK_IDLE: case PA_SINK_IDLE:
case PA_SINK_RUNNING: case PA_SINK_RUNNING:
if (s->state == PA_SINK_SUSPENDED) if (s->state == PA_SINK_SUSPENDED)
stream_cork(u, FALSE); stream_cork(u, false);
break; break;
case PA_SINK_UNLINKED: case PA_SINK_UNLINKED:
@ -663,13 +663,13 @@ static int source_set_state(pa_source *s, pa_source_state_t state) {
case PA_SOURCE_SUSPENDED: case PA_SOURCE_SUSPENDED:
pa_assert(PA_SOURCE_IS_OPENED(s->state)); pa_assert(PA_SOURCE_IS_OPENED(s->state));
stream_cork(u, TRUE); stream_cork(u, true);
break; break;
case PA_SOURCE_IDLE: case PA_SOURCE_IDLE:
case PA_SOURCE_RUNNING: case PA_SOURCE_RUNNING:
if (s->state == PA_SOURCE_SUSPENDED) if (s->state == PA_SOURCE_SUSPENDED)
stream_cork(u, FALSE); stream_cork(u, false);
break; break;
case PA_SOURCE_UNLINKED: case PA_SOURCE_UNLINKED:
@ -700,7 +700,7 @@ static void thread_func(void *userdata) {
pa_sink_process_rewind(u->sink, 0); pa_sink_process_rewind(u->sink, 0);
#endif #endif
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)
@ -744,7 +744,7 @@ static void command_request(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
return; return;
fail: fail:
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
#endif #endif
@ -753,7 +753,7 @@ fail:
static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
struct userdata *u = userdata; struct userdata *u = userdata;
pa_usec_t sink_usec, source_usec; pa_usec_t sink_usec, source_usec;
pa_bool_t playing; bool playing;
int64_t write_index, read_index; int64_t write_index, read_index;
struct timeval local, remote, now; struct timeval local, remote, now;
pa_sample_spec *ss; pa_sample_spec *ss;
@ -855,7 +855,7 @@ static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, uint
fail: fail:
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from main context */ /* Called from main context */
@ -990,7 +990,7 @@ static void server_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
return; return;
fail: fail:
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
static int read_ports(struct userdata *u, pa_tagstruct *t) { static int read_ports(struct userdata *u, pa_tagstruct *t) {
@ -1058,7 +1058,7 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t
pa_sample_spec ss; pa_sample_spec ss;
pa_channel_map cm; pa_channel_map cm;
pa_cvolume volume; pa_cvolume volume;
pa_bool_t mute; bool mute;
pa_usec_t latency; pa_usec_t latency;
pa_assert(pd); pa_assert(pd);
@ -1137,7 +1137,7 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t
return; return;
fail: fail:
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from main context */ /* Called from main context */
@ -1146,11 +1146,11 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag
uint32_t idx, owner_module, client, sink; uint32_t idx, owner_module, client, sink;
pa_usec_t buffer_usec, sink_usec; pa_usec_t buffer_usec, sink_usec;
const char *name, *driver, *resample_method; const char *name, *driver, *resample_method;
pa_bool_t mute = FALSE; bool mute = false;
pa_sample_spec sample_spec; pa_sample_spec sample_spec;
pa_channel_map channel_map; pa_channel_map channel_map;
pa_cvolume volume; pa_cvolume volume;
pa_bool_t b; bool b;
pa_assert(pd); pa_assert(pd);
pa_assert(u); pa_assert(u);
@ -1246,7 +1246,7 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag
return; return;
fail: fail:
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
#else #else
@ -1259,7 +1259,7 @@ static void source_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
pa_sample_spec ss; pa_sample_spec ss;
pa_channel_map cm; pa_channel_map cm;
pa_cvolume volume; pa_cvolume volume;
pa_bool_t mute; bool mute;
pa_usec_t latency, configured_latency; pa_usec_t latency, configured_latency;
pa_assert(pd); pa_assert(pd);
@ -1336,7 +1336,7 @@ static void source_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
return; return;
fail: fail:
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
#endif #endif
@ -1397,7 +1397,7 @@ static void command_subscribe_event(pa_pdispatch *pd, uint32_t command, uint32
if (pa_tagstruct_getu32(t, &e) < 0 || if (pa_tagstruct_getu32(t, &e) < 0 ||
pa_tagstruct_getu32(t, &idx) < 0) { pa_tagstruct_getu32(t, &idx) < 0) {
pa_log("Invalid protocol reply"); pa_log("Invalid protocol reply");
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
return; return;
} }
@ -1479,7 +1479,7 @@ static void create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t
pa_channel_map cm; pa_channel_map cm;
uint32_t device_index; uint32_t device_index;
const char *dn; const char *dn;
pa_bool_t suspended; bool suspended;
if (pa_tagstruct_get_sample_spec(t, &ss) < 0 || if (pa_tagstruct_get_sample_spec(t, &ss) < 0 ||
pa_tagstruct_get_channel_map(t, &cm) < 0 || pa_tagstruct_get_channel_map(t, &cm) < 0 ||
@ -1544,7 +1544,7 @@ parse_error:
pa_log("Invalid reply. (Create stream)"); pa_log("Invalid reply. (Create stream)");
fail: fail:
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
@ -1672,20 +1672,20 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
#endif #endif
if (u->version >= 12) { if (u->version >= 12) {
pa_tagstruct_put_boolean(reply, FALSE); /* no_remap */ pa_tagstruct_put_boolean(reply, false); /* no_remap */
pa_tagstruct_put_boolean(reply, FALSE); /* no_remix */ pa_tagstruct_put_boolean(reply, false); /* no_remix */
pa_tagstruct_put_boolean(reply, FALSE); /* fix_format */ pa_tagstruct_put_boolean(reply, false); /* fix_format */
pa_tagstruct_put_boolean(reply, FALSE); /* fix_rate */ pa_tagstruct_put_boolean(reply, false); /* fix_rate */
pa_tagstruct_put_boolean(reply, FALSE); /* fix_channels */ pa_tagstruct_put_boolean(reply, false); /* fix_channels */
pa_tagstruct_put_boolean(reply, TRUE); /* no_move */ pa_tagstruct_put_boolean(reply, true); /* no_move */
pa_tagstruct_put_boolean(reply, FALSE); /* variable_rate */ pa_tagstruct_put_boolean(reply, false); /* variable_rate */
} }
if (u->version >= 13) { if (u->version >= 13) {
pa_proplist *pl; pa_proplist *pl;
pa_tagstruct_put_boolean(reply, FALSE); /* start muted/peak detect*/ pa_tagstruct_put_boolean(reply, false); /* start muted/peak detect*/
pa_tagstruct_put_boolean(reply, TRUE); /* adjust_latency */ pa_tagstruct_put_boolean(reply, true); /* adjust_latency */
pl = pa_proplist_new(); pl = pa_proplist_new();
pa_proplist_sets(pl, PA_PROP_MEDIA_NAME, name); pa_proplist_sets(pl, PA_PROP_MEDIA_NAME, name);
@ -1700,25 +1700,25 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
if (u->version >= 14) { if (u->version >= 14) {
#ifdef TUNNEL_SINK #ifdef TUNNEL_SINK
pa_tagstruct_put_boolean(reply, FALSE); /* volume_set */ pa_tagstruct_put_boolean(reply, false); /* volume_set */
#endif #endif
pa_tagstruct_put_boolean(reply, TRUE); /* early rquests */ pa_tagstruct_put_boolean(reply, true); /* early rquests */
} }
if (u->version >= 15) { if (u->version >= 15) {
#ifdef TUNNEL_SINK #ifdef TUNNEL_SINK
pa_tagstruct_put_boolean(reply, FALSE); /* muted_set */ pa_tagstruct_put_boolean(reply, false); /* muted_set */
#endif #endif
pa_tagstruct_put_boolean(reply, FALSE); /* don't inhibit auto suspend */ pa_tagstruct_put_boolean(reply, false); /* don't inhibit auto suspend */
pa_tagstruct_put_boolean(reply, FALSE); /* fail on suspend */ pa_tagstruct_put_boolean(reply, false); /* fail on suspend */
} }
#ifdef TUNNEL_SINK #ifdef TUNNEL_SINK
if (u->version >= 17) if (u->version >= 17)
pa_tagstruct_put_boolean(reply, FALSE); /* relative volume */ pa_tagstruct_put_boolean(reply, false); /* relative volume */
if (u->version >= 18) if (u->version >= 18)
pa_tagstruct_put_boolean(reply, FALSE); /* passthrough stream */ pa_tagstruct_put_boolean(reply, false); /* passthrough stream */
#endif #endif
#ifdef TUNNEL_SINK #ifdef TUNNEL_SINK
@ -1732,11 +1732,11 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
pa_tagstruct_putu8(reply, 0); pa_tagstruct_putu8(reply, 0);
pa_cvolume_reset(&volume, u->source->sample_spec.channels); pa_cvolume_reset(&volume, u->source->sample_spec.channels);
pa_tagstruct_put_cvolume(reply, &volume); pa_tagstruct_put_cvolume(reply, &volume);
pa_tagstruct_put_boolean(reply, FALSE); /* muted */ pa_tagstruct_put_boolean(reply, false); /* muted */
pa_tagstruct_put_boolean(reply, FALSE); /* volume_set */ pa_tagstruct_put_boolean(reply, false); /* volume_set */
pa_tagstruct_put_boolean(reply, FALSE); /* muted_set */ pa_tagstruct_put_boolean(reply, false); /* muted_set */
pa_tagstruct_put_boolean(reply, FALSE); /* relative volume */ pa_tagstruct_put_boolean(reply, false); /* relative volume */
pa_tagstruct_put_boolean(reply, FALSE); /* passthrough stream */ pa_tagstruct_put_boolean(reply, false); /* passthrough stream */
} }
#endif #endif
@ -1748,7 +1748,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
return; return;
fail: fail:
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from main context */ /* Called from main context */
@ -1759,7 +1759,7 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) {
pa_assert(u); pa_assert(u);
pa_log_warn("Stream died."); pa_log_warn("Stream died.");
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from main context */ /* Called from main context */
@ -1772,7 +1772,7 @@ static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_c
if (pa_pdispatch_run(u->pdispatch, packet, creds, u) < 0) { if (pa_pdispatch_run(u->pdispatch, packet, creds, u) < 0) {
pa_log("Invalid packet"); pa_log("Invalid packet");
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
return; return;
} }
} }
@ -1788,7 +1788,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
if (channel != u->channel) { if (channel != u->channel) {
pa_log("Received memory block on bad channel."); pa_log("Received memory block on bad channel.");
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
return; return;
} }
@ -1813,12 +1813,12 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata
if (!io) { if (!io) {
pa_log("Connection failed: %s", pa_cstrerror(errno)); pa_log("Connection failed: %s", pa_cstrerror(errno));
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
return; return;
} }
u->pstream = pa_pstream_new(u->core->mainloop, io, u->core->mempool); u->pstream = pa_pstream_new(u->core->mainloop, io, u->core->mempool);
u->pdispatch = pa_pdispatch_new(u->core->mainloop, TRUE, command_table, PA_COMMAND_MAX); u->pdispatch = pa_pdispatch_new(u->core->mainloop, true, command_table, PA_COMMAND_MAX);
pa_pstream_set_die_callback(u->pstream, pstream_die_callback, u); pa_pstream_set_die_callback(u->pstream, pstream_die_callback, u);
pa_pstream_set_receive_packet_callback(u->pstream, pstream_packet_callback, u); pa_pstream_set_receive_packet_callback(u->pstream, pstream_packet_callback, u);
@ -1932,23 +1932,23 @@ int pa__init(pa_module*m) {
u->smoother = pa_smoother_new( u->smoother = pa_smoother_new(
PA_USEC_PER_SEC, PA_USEC_PER_SEC,
PA_USEC_PER_SEC*2, PA_USEC_PER_SEC*2,
TRUE, true,
TRUE, true,
10, 10,
pa_rtclock_now(), pa_rtclock_now(),
FALSE); false);
u->ctag = 1; u->ctag = 1;
u->device_index = u->channel = PA_INVALID_INDEX; u->device_index = u->channel = PA_INVALID_INDEX;
u->time_event = NULL; u->time_event = NULL;
u->ignore_latency_before = 0; u->ignore_latency_before = 0;
u->transport_usec = u->thread_transport_usec = 0; u->transport_usec = u->thread_transport_usec = 0;
u->remote_suspended = u->remote_corked = FALSE; u->remote_suspended = u->remote_corked = false;
u->counter = u->counter_delta = 0; u->counter = u->counter_delta = 0;
u->rtpoll = pa_rtpoll_new(); u->rtpoll = pa_rtpoll_new();
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
if (!(u->auth_cookie = pa_auth_cookie_get(u->core, pa_modargs_get_value(ma, "cookie", PA_NATIVE_COOKIE_FILE), TRUE, PA_NATIVE_COOKIE_LENGTH))) if (!(u->auth_cookie = pa_auth_cookie_get(u->core, pa_modargs_get_value(ma, "cookie", PA_NATIVE_COOKIE_FILE), true, PA_NATIVE_COOKIE_LENGTH)))
goto fail; goto fail;
if (!(u->server_name = pa_xstrdup(pa_modargs_get_value(ma, "server", NULL)))) { if (!(u->server_name = pa_xstrdup(pa_modargs_get_value(ma, "server", NULL)))) {
@ -1963,7 +1963,7 @@ int pa__init(pa_module*m) {
goto fail; goto fail;
} }
if (!(u->client = pa_socket_client_new_string(m->core->mainloop, TRUE, u->server_name, PA_NATIVE_DEFAULT_PORT))) { if (!(u->client = pa_socket_client_new_string(m->core->mainloop, true, u->server_name, PA_NATIVE_DEFAULT_PORT))) {
pa_log("Failed to connect to server '%s'", u->server_name); pa_log("Failed to connect to server '%s'", u->server_name);
goto fail; goto fail;
} }
@ -1978,7 +1978,7 @@ int pa__init(pa_module*m) {
pa_sink_new_data_init(&data); pa_sink_new_data_init(&data);
data.driver = __FILE__; data.driver = __FILE__;
data.module = m; data.module = m;
data.namereg_fail = TRUE; data.namereg_fail = true;
pa_sink_new_data_set_name(&data, dn); pa_sink_new_data_set_name(&data, dn);
pa_sink_new_data_set_sample_spec(&data, &ss); pa_sink_new_data_set_sample_spec(&data, &ss);
pa_sink_new_data_set_channel_map(&data, &map); pa_sink_new_data_set_channel_map(&data, &map);
@ -2007,7 +2007,7 @@ int pa__init(pa_module*m) {
pa_sink_set_set_volume_callback(u->sink, sink_set_volume); pa_sink_set_set_volume_callback(u->sink, sink_set_volume);
pa_sink_set_set_mute_callback(u->sink, sink_set_mute); pa_sink_set_set_mute_callback(u->sink, sink_set_mute);
u->sink->refresh_volume = u->sink->refresh_muted = FALSE; u->sink->refresh_volume = u->sink->refresh_muted = false;
/* pa_sink_set_latency_range(u->sink, MIN_NETWORK_LATENCY_USEC, 0); */ /* pa_sink_set_latency_range(u->sink, MIN_NETWORK_LATENCY_USEC, 0); */
@ -2022,7 +2022,7 @@ int pa__init(pa_module*m) {
pa_source_new_data_init(&data); pa_source_new_data_init(&data);
data.driver = __FILE__; data.driver = __FILE__;
data.module = m; data.module = m;
data.namereg_fail = TRUE; data.namereg_fail = true;
pa_source_new_data_set_name(&data, dn); pa_source_new_data_set_name(&data, dn);
pa_source_new_data_set_sample_spec(&data, &ss); pa_source_new_data_set_sample_spec(&data, &ss);
pa_source_new_data_set_channel_map(&data, &map); pa_source_new_data_set_channel_map(&data, &map);

View file

@ -43,7 +43,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Detect available audio hardware and load matching drivers"); PA_MODULE_DESCRIPTION("Detect available audio hardware and load matching drivers");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"tsched=<enable system timer based scheduling mode?> " "tsched=<enable system timer based scheduling mode?> "
"tsched_buffer_size=<buffer size when using timer based scheduling> " "tsched_buffer_size=<buffer size when using timer based scheduling> "
@ -54,7 +54,7 @@ PA_MODULE_USAGE(
struct device { struct device {
char *path; char *path;
pa_bool_t need_verify; bool need_verify;
char *card_name; char *card_name;
char *args; char *args;
uint32_t module; uint32_t module;
@ -65,11 +65,11 @@ struct userdata {
pa_core *core; pa_core *core;
pa_hashmap *devices; pa_hashmap *devices;
pa_bool_t use_tsched:1; bool use_tsched:1;
bool tsched_buffer_size_valid:1; bool tsched_buffer_size_valid:1;
pa_bool_t fixed_latency_range:1; bool fixed_latency_range:1;
pa_bool_t ignore_dB:1; bool ignore_dB:1;
pa_bool_t deferred_volume:1; bool deferred_volume:1;
bool use_ucm:1; bool use_ucm:1;
uint32_t tsched_buffer_size; uint32_t tsched_buffer_size;
@ -155,9 +155,9 @@ finish:
return r; return r;
} }
static pa_bool_t pcm_is_modem(const char *card_idx, const char *pcm) { static bool pcm_is_modem(const char *card_idx, const char *pcm) {
char *sysfs_path, *pcm_class; char *sysfs_path, *pcm_class;
pa_bool_t is_modem; bool is_modem;
pa_assert(card_idx); pa_assert(card_idx);
pa_assert(pcm); pa_assert(pcm);
@ -175,13 +175,13 @@ static pa_bool_t pcm_is_modem(const char *card_idx, const char *pcm) {
return is_modem; return is_modem;
} }
static pa_bool_t is_card_busy(const char *id) { static bool is_card_busy(const char *id) {
char *card_path = NULL, *pcm_path = NULL, *sub_status = NULL; char *card_path = NULL, *pcm_path = NULL, *sub_status = NULL;
DIR *card_dir = NULL, *pcm_dir = NULL; DIR *card_dir = NULL, *pcm_dir = NULL;
FILE *status_file = NULL; FILE *status_file = NULL;
size_t len; size_t len;
struct dirent *space = NULL, *de; struct dirent *space = NULL, *de;
pa_bool_t busy = FALSE; bool busy = false;
int r; int r;
pa_assert(id); pa_assert(id);
@ -258,7 +258,7 @@ static pa_bool_t is_card_busy(const char *id) {
} }
if (!pa_streq(line, "closed\n")) { if (!pa_streq(line, "closed\n")) {
busy = TRUE; busy = true;
break; break;
} }
} }
@ -286,7 +286,7 @@ fail:
static void verify_access(struct userdata *u, struct device *d) { static void verify_access(struct userdata *u, struct device *d) {
char *cd; char *cd;
pa_card *card; pa_card *card;
pa_bool_t accessible; bool accessible;
pa_assert(u); pa_assert(u);
pa_assert(d); pa_assert(d);
@ -303,7 +303,7 @@ static void verify_access(struct userdata *u, struct device *d) {
if (accessible) { if (accessible) {
pa_module *m; pa_module *m;
pa_bool_t busy; bool busy;
/* Check if any of the PCM devices that belong to this /* Check if any of the PCM devices that belong to this
* card are currently busy. If they are, don't try to load * card are currently busy. If they are, don't try to load
@ -442,7 +442,7 @@ static void remove_card(struct userdata *u, struct udev_device *dev) {
pa_log_info("Card %s removed.", d->path); pa_log_info("Card %s removed.", d->path);
if (d->module != PA_INVALID_INDEX) if (d->module != PA_INVALID_INDEX)
pa_module_unload_request_by_index(u->core, d->module, TRUE); pa_module_unload_request_by_index(u->core, d->module, true);
device_free(d); device_free(d);
} }
@ -521,12 +521,12 @@ fail:
u->udev_io = NULL; u->udev_io = NULL;
} }
static pa_bool_t pcm_node_belongs_to_device( static bool pcm_node_belongs_to_device(
struct device *d, struct device *d,
const char *node) { const char *node) {
char *cd; char *cd;
pa_bool_t b; bool b;
cd = pa_sprintf_malloc("pcmC%sD", path_get_card_id(d->path)); cd = pa_sprintf_malloc("pcmC%sD", path_get_card_id(d->path));
b = pa_startswith(node, cd); b = pa_startswith(node, cd);
@ -535,12 +535,12 @@ static pa_bool_t pcm_node_belongs_to_device(
return b; return b;
} }
static pa_bool_t control_node_belongs_to_device( static bool control_node_belongs_to_device(
struct device *d, struct device *d,
const char *node) { const char *node) {
char *cd; char *cd;
pa_bool_t b; bool b;
cd = pa_sprintf_malloc("controlC%s", path_get_card_id(d->path)); cd = pa_sprintf_malloc("controlC%s", path_get_card_id(d->path));
b = pa_streq(node, cd); b = pa_streq(node, cd);
@ -562,7 +562,7 @@ static void inotify_cb(
} buf; } buf;
struct userdata *u = userdata; struct userdata *u = userdata;
static int type = 0; static int type = 0;
pa_bool_t deleted = FALSE; bool deleted = false;
struct device *d; struct device *d;
void *state; void *state;
@ -602,18 +602,18 @@ static void inotify_cb(
if (((event->mask & IN_ATTRIB) && pa_startswith(event->name, "controlC"))) if (((event->mask & IN_ATTRIB) && pa_startswith(event->name, "controlC")))
PA_HASHMAP_FOREACH(d, u->devices, state) PA_HASHMAP_FOREACH(d, u->devices, state)
if (control_node_belongs_to_device(d, event->name)) if (control_node_belongs_to_device(d, event->name))
d->need_verify = TRUE; d->need_verify = true;
/* ALSA doesn't really give us any guarantee on the closing /* ALSA doesn't really give us any guarantee on the closing
* order, so let's simply hope */ * order, so let's simply hope */
if (((event->mask & IN_CLOSE_WRITE) && pa_startswith(event->name, "pcmC"))) if (((event->mask & IN_CLOSE_WRITE) && pa_startswith(event->name, "pcmC")))
PA_HASHMAP_FOREACH(d, u->devices, state) PA_HASHMAP_FOREACH(d, u->devices, state)
if (pcm_node_belongs_to_device(d, event->name)) if (pcm_node_belongs_to_device(d, event->name))
d->need_verify = TRUE; d->need_verify = true;
/* /dev/snd/ might have been removed */ /* /dev/snd/ might have been removed */
if ((event->mask & (IN_DELETE_SELF|IN_MOVE_SELF))) if ((event->mask & (IN_DELETE_SELF|IN_MOVE_SELF)))
deleted = TRUE; deleted = true;
event = (struct inotify_event*) ((uint8_t*) event + len); event = (struct inotify_event*) ((uint8_t*) event + len);
r -= len; r -= len;
@ -622,7 +622,7 @@ static void inotify_cb(
PA_HASHMAP_FOREACH(d, u->devices, state) PA_HASHMAP_FOREACH(d, u->devices, state)
if (d->need_verify) { if (d->need_verify) {
d->need_verify = FALSE; d->need_verify = false;
verify_access(u, d); verify_access(u, d);
} }
@ -688,7 +688,7 @@ int pa__init(pa_module *m) {
struct udev_enumerate *enumerate = NULL; struct udev_enumerate *enumerate = NULL;
struct udev_list_entry *item = NULL, *first = NULL; struct udev_list_entry *item = NULL, *first = NULL;
int fd; int fd;
pa_bool_t use_tsched = TRUE, fixed_latency_range = FALSE, ignore_dB = FALSE, deferred_volume = m->core->deferred_volume; bool use_tsched = true, fixed_latency_range = false, ignore_dB = false, deferred_volume = m->core->deferred_volume;
bool use_ucm = true; bool use_ucm = true;
pa_assert(m); pa_assert(m);

View file

@ -43,7 +43,7 @@
PA_MODULE_AUTHOR("Pierre-Louis Bossart"); PA_MODULE_AUTHOR("Pierre-Louis Bossart");
PA_MODULE_DESCRIPTION(_("Virtual sink")); PA_MODULE_DESCRIPTION(_("Virtual sink"));
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
_("sink_name=<name for the sink> " _("sink_name=<name for the sink> "
"sink_properties=<properties for the sink> " "sink_properties=<properties for the sink> "
@ -61,14 +61,14 @@ struct userdata {
pa_module *module; pa_module *module;
/* FIXME: Uncomment this and take "autoloaded" as a modarg if this is a filter */ /* FIXME: Uncomment this and take "autoloaded" as a modarg if this is a filter */
/* pa_bool_t autoloaded; */ /* bool autoloaded; */
pa_sink *sink; pa_sink *sink;
pa_sink_input *sink_input; pa_sink_input *sink_input;
pa_memblockq *memblockq; pa_memblockq *memblockq;
pa_bool_t auto_desc; bool auto_desc;
unsigned channels; unsigned channels;
}; };
@ -144,7 +144,7 @@ static void sink_request_rewind_cb(pa_sink *s) {
/* Just hand this one over to the master sink */ /* Just hand this one over to the master sink */
pa_sink_input_request_rewind(u->sink_input, pa_sink_input_request_rewind(u->sink_input,
s->thread_info.rewind_nbytes + s->thread_info.rewind_nbytes +
pa_memblockq_get_length(u->memblockq), TRUE, FALSE, FALSE); pa_memblockq_get_length(u->memblockq), true, false, false);
} }
/* Called from I/O thread context */ /* Called from I/O thread context */
@ -175,7 +175,7 @@ static void sink_set_volume_cb(pa_sink *s) {
!PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input))) !PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input)))
return; return;
pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, TRUE); pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, true);
} }
/* Called from main context */ /* Called from main context */
@ -281,7 +281,7 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
u->sink->thread_info.rewind_nbytes = 0; u->sink->thread_info.rewind_nbytes = 0;
if (amount > 0) { if (amount > 0) {
pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE, TRUE); pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE, true);
/* (5) PUT YOUR CODE HERE TO RESET YOUR FILTER */ /* (5) PUT YOUR CODE HERE TO RESET YOUR FILTER */
} }
@ -398,7 +398,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
pa_sink_unref(u->sink); pa_sink_unref(u->sink);
u->sink = NULL; u->sink = NULL;
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from IO thread context */ /* Called from IO thread context */
@ -413,7 +413,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
if (PA_SINK_INPUT_IS_LINKED(state) && if (PA_SINK_INPUT_IS_LINKED(state) &&
i->thread_info.state == PA_SINK_INPUT_INIT) { i->thread_info.state == PA_SINK_INPUT_INIT) {
pa_log_debug("Requesting rewind due to state change."); pa_log_debug("Requesting rewind due to state change.");
pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); pa_sink_input_request_rewind(i, 0, false, true, true);
} }
} }
@ -472,8 +472,8 @@ int pa__init(pa_module*m) {
pa_sink *master=NULL; pa_sink *master=NULL;
pa_sink_input_new_data sink_input_data; pa_sink_input_new_data sink_input_data;
pa_sink_new_data sink_data; pa_sink_new_data sink_data;
pa_bool_t use_volume_sharing = TRUE; bool use_volume_sharing = true;
pa_bool_t force_flat_volume = FALSE; bool force_flat_volume = false;
pa_memchunk silence; pa_memchunk silence;
pa_assert(m); pa_assert(m);
@ -559,7 +559,7 @@ int pa__init(pa_module*m) {
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb); pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
if (!use_volume_sharing) { if (!use_volume_sharing) {
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb); pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
pa_sink_enable_decibel_volume(u->sink, TRUE); pa_sink_enable_decibel_volume(u->sink, true);
} }
/* Normally this flag would be enabled automatically be we can force it. */ /* Normally this flag would be enabled automatically be we can force it. */
if (force_flat_volume) if (force_flat_volume)
@ -572,7 +572,7 @@ int pa__init(pa_module*m) {
pa_sink_input_new_data_init(&sink_input_data); pa_sink_input_new_data_init(&sink_input_data);
sink_input_data.driver = __FILE__; sink_input_data.driver = __FILE__;
sink_input_data.module = m; sink_input_data.module = m;
pa_sink_input_new_data_set_sink(&sink_input_data, master, FALSE); pa_sink_input_new_data_set_sink(&sink_input_data, master, false);
sink_input_data.origin_sink = u->sink; sink_input_data.origin_sink = u->sink;
pa_proplist_setf(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Sink Stream from %s", pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)); pa_proplist_setf(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Sink Stream from %s", pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION));
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");

View file

@ -46,7 +46,7 @@
PA_MODULE_AUTHOR("Pierre-Louis Bossart"); PA_MODULE_AUTHOR("Pierre-Louis Bossart");
PA_MODULE_DESCRIPTION("Virtual source"); PA_MODULE_DESCRIPTION("Virtual source");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
_("source_name=<name for the source> " _("source_name=<name for the source> "
"source_properties=<properties for the source> " "source_properties=<properties for the source> "
@ -67,14 +67,14 @@ struct userdata {
pa_module *module; pa_module *module;
/* FIXME: Uncomment this and take "autoloaded" as a modarg if this is a filter */ /* FIXME: Uncomment this and take "autoloaded" as a modarg if this is a filter */
/* pa_bool_t autoloaded; */ /* bool autoloaded; */
pa_source *source; pa_source *source;
pa_source_output *source_output; pa_source_output *source_output;
pa_memblockq *memblockq; pa_memblockq *memblockq;
pa_bool_t auto_desc; bool auto_desc;
unsigned channels; unsigned channels;
/* optional fields for uplink sink */ /* optional fields for uplink sink */
@ -128,7 +128,7 @@ static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) {
if (state == PA_SINK_RUNNING) { if (state == PA_SINK_RUNNING) {
/* need to wake-up source if it was suspended */ /* need to wake-up source if it was suspended */
pa_log_debug("Resuming source %s, because its uplink sink became active.", u->source->name); pa_log_debug("Resuming source %s, because its uplink sink became active.", u->source->name);
pa_source_suspend(u->source, FALSE, PA_SUSPEND_ALL); pa_source_suspend(u->source, false, PA_SUSPEND_ALL);
/* FIXME: if there's no client connected, the source will suspend /* FIXME: if there's no client connected, the source will suspend
and playback will be stuck. You'd want to prevent the source from and playback will be stuck. You'd want to prevent the source from
@ -240,7 +240,7 @@ static void source_set_volume_cb(pa_source *s) {
!PA_SOURCE_OUTPUT_IS_LINKED(pa_source_output_get_state(u->source_output))) !PA_SOURCE_OUTPUT_IS_LINKED(pa_source_output_get_state(u->source_output)))
return; return;
pa_source_output_set_volume(u->source_output, &s->real_volume, s->save_volume, TRUE); pa_source_output_set_volume(u->source_output, &s->real_volume, s->save_volume, true);
} }
/* Called from main context */ /* Called from main context */
@ -333,7 +333,7 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk)
chunk->length, /* same length as input */ chunk->length, /* same length as input */
(const pa_sample_spec *)&o->sample_spec, /* same sample spec for input and output */ (const pa_sample_spec *)&o->sample_spec, /* same sample spec for input and output */
NULL, /* no volume information */ NULL, /* no volume information */
FALSE); /* no mute */ false); /* no mute */
pa_memblock_release(target_chunk.memblock); pa_memblock_release(target_chunk.memblock);
pa_memblock_unref(tchunk.memblock); /* clean-up */ pa_memblock_unref(tchunk.memblock); /* clean-up */
@ -434,7 +434,7 @@ static void source_output_kill_cb(pa_source_output *o) {
pa_source_unref(u->source); pa_source_unref(u->source);
u->source = NULL; u->source = NULL;
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from main thread */ /* Called from main thread */
@ -473,8 +473,8 @@ int pa__init(pa_module*m) {
pa_source *master=NULL; pa_source *master=NULL;
pa_source_output_new_data source_output_data; pa_source_output_new_data source_output_data;
pa_source_new_data source_data; pa_source_new_data source_data;
pa_bool_t use_volume_sharing = TRUE; bool use_volume_sharing = true;
pa_bool_t force_flat_volume = FALSE; bool force_flat_volume = false;
/* optional for uplink_sink */ /* optional for uplink_sink */
pa_sink_new_data sink_data; pa_sink_new_data sink_data;
@ -568,7 +568,7 @@ int pa__init(pa_module*m) {
pa_source_set_set_mute_callback(u->source, source_set_mute_cb); pa_source_set_set_mute_callback(u->source, source_set_mute_cb);
if (!use_volume_sharing) { if (!use_volume_sharing) {
pa_source_set_set_volume_callback(u->source, source_set_volume_cb); pa_source_set_set_volume_callback(u->source, source_set_volume_cb);
pa_source_enable_decibel_volume(u->source, TRUE); pa_source_enable_decibel_volume(u->source, true);
} }
/* Normally this flag would be enabled automatically be we can force it. */ /* Normally this flag would be enabled automatically be we can force it. */
if (force_flat_volume) if (force_flat_volume)
@ -581,7 +581,7 @@ int pa__init(pa_module*m) {
pa_source_output_new_data_init(&source_output_data); pa_source_output_new_data_init(&source_output_data);
source_output_data.driver = __FILE__; source_output_data.driver = __FILE__;
source_output_data.module = m; source_output_data.module = m;
pa_source_output_new_data_set_source(&source_output_data, master, FALSE); pa_source_output_new_data_set_source(&source_output_data, master, false);
source_output_data.destination_source = u->source; source_output_data.destination_source = u->source;
pa_proplist_setf(source_output_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Source Stream of %s", pa_proplist_gets(u->source->proplist, PA_PROP_DEVICE_DESCRIPTION)); pa_proplist_setf(source_output_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Source Stream of %s", pa_proplist_gets(u->source->proplist, PA_PROP_DEVICE_DESCRIPTION));

View file

@ -48,7 +48,7 @@
PA_MODULE_AUTHOR("Niels Ole Salscheider"); PA_MODULE_AUTHOR("Niels Ole Salscheider");
PA_MODULE_DESCRIPTION(_("Virtual surround sink")); PA_MODULE_DESCRIPTION(_("Virtual surround sink"));
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
_("sink_name=<name for the sink> " _("sink_name=<name for the sink> "
"sink_properties=<properties for the sink> " "sink_properties=<properties for the sink> "
@ -68,14 +68,14 @@ struct userdata {
pa_module *module; pa_module *module;
/* FIXME: Uncomment this and take "autoloaded" as a modarg if this is a filter */ /* FIXME: Uncomment this and take "autoloaded" as a modarg if this is a filter */
/* pa_bool_t autoloaded; */ /* bool autoloaded; */
pa_sink *sink; pa_sink *sink;
pa_sink_input *sink_input; pa_sink_input *sink_input;
pa_memblockq *memblockq; pa_memblockq *memblockq;
pa_bool_t auto_desc; bool auto_desc;
unsigned channels; unsigned channels;
unsigned hrir_channels; unsigned hrir_channels;
@ -165,7 +165,7 @@ static void sink_request_rewind_cb(pa_sink *s) {
/* Just hand this one over to the master sink */ /* Just hand this one over to the master sink */
pa_sink_input_request_rewind(u->sink_input, pa_sink_input_request_rewind(u->sink_input,
s->thread_info.rewind_nbytes + s->thread_info.rewind_nbytes +
pa_memblockq_get_length(u->memblockq), TRUE, FALSE, FALSE); pa_memblockq_get_length(u->memblockq), true, false, false);
} }
/* Called from I/O thread context */ /* Called from I/O thread context */
@ -196,7 +196,7 @@ static void sink_set_volume_cb(pa_sink *s) {
!PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input))) !PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input)))
return; return;
pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, TRUE); pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, true);
} }
/* Called from main context */ /* Called from main context */
@ -303,7 +303,7 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
u->sink->thread_info.rewind_nbytes = 0; u->sink->thread_info.rewind_nbytes = 0;
if (amount > 0) { if (amount > 0) {
pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE, TRUE); pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE, true);
/* Reset the input buffer */ /* Reset the input buffer */
memset(u->input_buffer, 0, u->hrir_samples * u->sink_fs); memset(u->input_buffer, 0, u->hrir_samples * u->sink_fs);
@ -410,7 +410,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
pa_sink_unref(u->sink); pa_sink_unref(u->sink);
u->sink = NULL; u->sink = NULL;
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
/* Called from IO thread context */ /* Called from IO thread context */
@ -425,7 +425,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
if (PA_SINK_INPUT_IS_LINKED(state) && if (PA_SINK_INPUT_IS_LINKED(state) &&
i->thread_info.state == PA_SINK_INPUT_INIT) { i->thread_info.state == PA_SINK_INPUT_INIT) {
pa_log_debug("Requesting rewind due to state change."); pa_log_debug("Requesting rewind due to state change.");
pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); pa_sink_input_request_rewind(i, 0, false, true, true);
} }
} }
@ -527,8 +527,8 @@ int pa__init(pa_module*m) {
pa_sink *master=NULL; pa_sink *master=NULL;
pa_sink_input_new_data sink_input_data; pa_sink_input_new_data sink_input_data;
pa_sink_new_data sink_data; pa_sink_new_data sink_data;
pa_bool_t use_volume_sharing = TRUE; bool use_volume_sharing = true;
pa_bool_t force_flat_volume = FALSE; bool force_flat_volume = false;
pa_memchunk silence; pa_memchunk silence;
const char *hrir_file; const char *hrir_file;
@ -661,7 +661,7 @@ int pa__init(pa_module*m) {
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb); pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
if (!use_volume_sharing) { if (!use_volume_sharing) {
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb); pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
pa_sink_enable_decibel_volume(u->sink, TRUE); pa_sink_enable_decibel_volume(u->sink, true);
} }
/* Normally this flag would be enabled automatically be we can force it. */ /* Normally this flag would be enabled automatically be we can force it. */
if (force_flat_volume) if (force_flat_volume)
@ -674,7 +674,7 @@ int pa__init(pa_module*m) {
pa_sink_input_new_data_init(&sink_input_data); pa_sink_input_new_data_init(&sink_input_data);
sink_input_data.driver = __FILE__; sink_input_data.driver = __FILE__;
sink_input_data.module = m; sink_input_data.module = m;
pa_sink_input_new_data_set_sink(&sink_input_data, master, FALSE); pa_sink_input_new_data_set_sink(&sink_input_data, master, false);
sink_input_data.origin_sink = u->sink; sink_input_data.origin_sink = u->sink;
pa_proplist_setf(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Surround Sink Stream from %s", pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)); pa_proplist_setf(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Surround Sink Stream from %s", pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION));
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");

View file

@ -35,7 +35,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Compatibility module"); PA_MODULE_DESCRIPTION("Compatibility module");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
PA_MODULE_DEPRECATED("Please use module-stream-restore instead of module-volume-restore!"); PA_MODULE_DEPRECATED("Please use module-stream-restore instead of module-volume-restore!");
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
@ -47,7 +47,7 @@ static const char* const valid_modargs[] = {
int pa__init(pa_module*m) { int pa__init(pa_module*m) {
pa_modargs *ma = NULL; pa_modargs *ma = NULL;
pa_bool_t restore_device = TRUE, restore_volume = TRUE; bool restore_device = true, restore_volume = true;
pa_module *n; pa_module *n;
char *t; char *t;
@ -71,7 +71,7 @@ int pa__init(pa_module*m) {
pa_xfree(t); pa_xfree(t);
if (n) if (n)
pa_module_unload_request(m, TRUE); pa_module_unload_request(m, true);
pa_modargs_free(ma); pa_modargs_free(ma);

View file

@ -253,7 +253,7 @@ static void thread_func(void *userdata) {
for (;;) { for (;;) {
int ret; int ret;
pa_bool_t need_timer = FALSE; bool need_timer = false;
if (u->sink) { if (u->sink) {
if (PA_UNLIKELY(u->sink->thread_info.rewind_requested)) if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
@ -261,13 +261,13 @@ static void thread_func(void *userdata) {
if (PA_SINK_IS_OPENED(u->sink->thread_info.state)) { if (PA_SINK_IS_OPENED(u->sink->thread_info.state)) {
do_write(u); do_write(u);
need_timer = TRUE; need_timer = true;
} }
} }
if (u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state)) { if (u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state)) {
do_read(u); do_read(u);
need_timer = TRUE; need_timer = true;
} }
if (need_timer) if (need_timer)
@ -276,7 +276,7 @@ static void thread_func(void *userdata) {
pa_rtpoll_set_timer_disabled(u->rtpoll); pa_rtpoll_set_timer_disabled(u->rtpoll);
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)
@ -499,7 +499,7 @@ int pa__init(pa_module *m) {
WAVEOUTCAPS pwoc; WAVEOUTCAPS pwoc;
MMRESULT result; MMRESULT result;
int nfrags, frag_size; int nfrags, frag_size;
pa_bool_t record = TRUE, playback = TRUE; bool record = true, playback = true;
unsigned int device; unsigned int device;
pa_sample_spec ss; pa_sample_spec ss;
pa_channel_map map; pa_channel_map map;

View file

@ -49,7 +49,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Discovery"); PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Discovery");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
#define SERVICE_TYPE_SINK "_pulse-sink._tcp" #define SERVICE_TYPE_SINK "_pulse-sink._tcp"
#define SERVICE_TYPE_SOURCE "_non-monitor._sub._pulse-source._tcp" #define SERVICE_TYPE_SOURCE "_non-monitor._sub._pulse-source._tcp"
@ -153,7 +153,7 @@ static void resolver_cb(
pa_sample_spec ss; pa_sample_spec ss;
pa_channel_map cm; pa_channel_map cm;
AvahiStringList *l; AvahiStringList *l;
pa_bool_t channel_map_set = FALSE; bool channel_map_set = false;
pa_module *m; pa_module *m;
ss = u->core->default_sample_spec; ss = u->core->default_sample_spec;
@ -175,7 +175,7 @@ static void resolver_cb(
ss.format = pa_parse_sample_format(value); ss.format = pa_parse_sample_format(value);
else if (pa_streq(key, "channel_map")) { else if (pa_streq(key, "channel_map")) {
pa_channel_map_parse(&cm, value); pa_channel_map_parse(&cm, value);
channel_map_set = TRUE; channel_map_set = true;
} }
avahi_free(key); avahi_free(key);
@ -281,7 +281,7 @@ static void browser_cb(
struct tunnel *t2; struct tunnel *t2;
if ((t2 = pa_hashmap_get(u->tunnels, t))) { if ((t2 = pa_hashmap_get(u->tunnels, t))) {
pa_module_unload_request_by_index(u->core, t2->module_index, TRUE); pa_module_unload_request_by_index(u->core, t2->module_index, true);
pa_hashmap_remove(u->tunnels, t2); pa_hashmap_remove(u->tunnels, t2);
tunnel_free(t2); tunnel_free(t2);
} }
@ -314,7 +314,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda
browser_cb, u))) { browser_cb, u))) {
pa_log("avahi_service_browser_new() failed: %s", avahi_strerror(avahi_client_errno(c))); pa_log("avahi_service_browser_new() failed: %s", avahi_strerror(avahi_client_errno(c)));
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
} }
@ -329,7 +329,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda
browser_cb, u))) { browser_cb, u))) {
pa_log("avahi_service_browser_new() failed: %s", avahi_strerror(avahi_client_errno(c))); pa_log("avahi_service_browser_new() failed: %s", avahi_strerror(avahi_client_errno(c)));
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
} }
@ -343,7 +343,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda
if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error))) { if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error))) {
pa_log("avahi_client_new() failed: %s", avahi_strerror(error)); pa_log("avahi_client_new() failed: %s", avahi_strerror(error));
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
} }
@ -422,7 +422,7 @@ void pa__done(pa_module*m) {
struct tunnel *t; struct tunnel *t;
while ((t = pa_hashmap_steal_first(u->tunnels))) { while ((t = pa_hashmap_steal_first(u->tunnels))) {
pa_module_unload_request_by_index(u->core, t->module_index, TRUE); pa_module_unload_request_by_index(u->core, t->module_index, true);
tunnel_free(t); tunnel_free(t);
} }

View file

@ -53,7 +53,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Publisher"); PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Publisher");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
#define SERVICE_TYPE_SINK "_pulse-sink._tcp" #define SERVICE_TYPE_SINK "_pulse-sink._tcp"
#define SERVICE_TYPE_SOURCE "_pulse-source._tcp" #define SERVICE_TYPE_SOURCE "_pulse-source._tcp"
@ -150,7 +150,7 @@ static void get_service_data(struct service *s, pa_object *device) {
if (pa_sink_isinstance(device)) { if (pa_sink_isinstance(device)) {
pa_sink *sink = PA_SINK(device); pa_sink *sink = PA_SINK(device);
s->is_sink = TRUE; s->is_sink = true;
s->service_type = SERVICE_TYPE_SINK; s->service_type = SERVICE_TYPE_SINK;
s->ss = sink->sample_spec; s->ss = sink->sample_spec;
s->cm = sink->channel_map; s->cm = sink->channel_map;
@ -161,7 +161,7 @@ static void get_service_data(struct service *s, pa_object *device) {
} else if (pa_source_isinstance(device)) { } else if (pa_source_isinstance(device)) {
pa_source *source = PA_SOURCE(device); pa_source *source = PA_SOURCE(device);
s->is_sink = FALSE; s->is_sink = false;
s->service_type = SERVICE_TYPE_SOURCE; s->service_type = SERVICE_TYPE_SOURCE;
s->ss = source->sample_spec; s->ss = source->sample_spec;
s->cm = source->channel_map; s->cm = source->channel_map;
@ -439,7 +439,7 @@ static void service_free(struct service *s) {
} }
/* Runs in PA mainloop context */ /* Runs in PA mainloop context */
static pa_bool_t shall_ignore(pa_object *o) { static bool shall_ignore(pa_object *o) {
pa_object_assert_ref(o); pa_object_assert_ref(o);
if (pa_sink_isinstance(o)) if (pa_sink_isinstance(o))
@ -601,7 +601,7 @@ fail:
} }
/* Runs in Avahi mainloop context */ /* Runs in Avahi mainloop context */
static void unpublish_all_services(struct userdata *u, pa_bool_t rem) { static void unpublish_all_services(struct userdata *u, bool rem) {
void *state = NULL; void *state = NULL;
struct service *s; struct service *s;
@ -675,7 +675,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda
case AVAHI_CLIENT_S_COLLISION: case AVAHI_CLIENT_S_COLLISION:
pa_log_debug("Host name collision"); pa_log_debug("Host name collision");
unpublish_all_services(u, FALSE); unpublish_all_services(u, false);
break; break;
case AVAHI_CLIENT_FAILURE: case AVAHI_CLIENT_FAILURE:
@ -684,12 +684,12 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda
pa_log_debug("Avahi daemon disconnected."); pa_log_debug("Avahi daemon disconnected.");
unpublish_all_services(u, TRUE); unpublish_all_services(u, true);
avahi_client_free(u->client); avahi_client_free(u->client);
if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error))) { if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error))) {
pa_log("avahi_client_new() failed: %s", avahi_strerror(error)); pa_log("avahi_client_new() failed: %s", avahi_strerror(error));
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
} }

View file

@ -78,7 +78,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("OSS Sink/Source"); PA_MODULE_DESCRIPTION("OSS Sink/Source");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> " "sink_properties=<properties for the sink> "
@ -116,10 +116,10 @@ struct userdata {
size_t frame_size; size_t frame_size;
uint32_t in_fragment_size, out_fragment_size, in_nfrags, out_nfrags, in_hwbuf_size, out_hwbuf_size; uint32_t in_fragment_size, out_fragment_size, in_nfrags, out_nfrags, in_hwbuf_size, out_hwbuf_size;
pa_bool_t use_getospace, use_getispace; bool use_getospace, use_getispace;
pa_bool_t use_getodelay; bool use_getodelay;
pa_bool_t sink_suspended, source_suspended; bool sink_suspended, source_suspended;
int fd; int fd;
int mode; int mode;
@ -129,7 +129,7 @@ struct userdata {
int nfrags, frag_size, orig_frag_size; int nfrags, frag_size, orig_frag_size;
pa_bool_t use_mmap; bool use_mmap;
unsigned out_mmap_current, in_mmap_current; unsigned out_mmap_current, in_mmap_current;
void *in_mmap, *out_mmap; void *in_mmap, *out_mmap;
pa_memblock **in_mmap_memblocks, **out_mmap_memblocks; pa_memblock **in_mmap_memblocks, **out_mmap_memblocks;
@ -157,7 +157,7 @@ static const char* const valid_modargs[] = {
NULL NULL
}; };
static int trigger(struct userdata *u, pa_bool_t quick) { static int trigger(struct userdata *u, bool quick) {
int enable_bits = 0, zero = 0; int enable_bits = 0, zero = 0;
pa_assert(u); pa_assert(u);
@ -647,7 +647,7 @@ fail:
static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) { static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
struct userdata *u = PA_SINK(o)->userdata; struct userdata *u = PA_SINK(o)->userdata;
int ret; int ret;
pa_bool_t do_trigger = FALSE, quick = TRUE; bool do_trigger = false, quick = true;
switch (code) { switch (code) {
@ -678,16 +678,16 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
return -1; return -1;
} }
do_trigger = TRUE; do_trigger = true;
u->sink_suspended = TRUE; u->sink_suspended = true;
break; break;
case PA_SINK_IDLE: case PA_SINK_IDLE:
case PA_SINK_RUNNING: case PA_SINK_RUNNING:
if (u->sink->thread_info.state == PA_SINK_INIT) { if (u->sink->thread_info.state == PA_SINK_INIT) {
do_trigger = TRUE; do_trigger = true;
quick = u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state); quick = u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state);
} }
@ -696,15 +696,15 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
if (!u->source || u->source_suspended) { if (!u->source || u->source_suspended) {
if (unsuspend(u) < 0) if (unsuspend(u) < 0)
return -1; return -1;
quick = FALSE; quick = false;
} }
do_trigger = TRUE; do_trigger = true;
u->out_mmap_current = 0; u->out_mmap_current = 0;
u->out_mmap_saved_nfrags = 0; u->out_mmap_saved_nfrags = 0;
u->sink_suspended = FALSE; u->sink_suspended = false;
} }
break; break;
@ -732,7 +732,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) { static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
struct userdata *u = PA_SOURCE(o)->userdata; struct userdata *u = PA_SOURCE(o)->userdata;
int ret; int ret;
int do_trigger = FALSE, quick = TRUE; int do_trigger = false, quick = true;
switch (code) { switch (code) {
@ -761,16 +761,16 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
return -1; return -1;
} }
do_trigger = TRUE; do_trigger = true;
u->source_suspended = TRUE; u->source_suspended = true;
break; break;
case PA_SOURCE_IDLE: case PA_SOURCE_IDLE:
case PA_SOURCE_RUNNING: case PA_SOURCE_RUNNING:
if (u->source->thread_info.state == PA_SOURCE_INIT) { if (u->source->thread_info.state == PA_SOURCE_INIT) {
do_trigger = TRUE; do_trigger = true;
quick = u->sink && PA_SINK_IS_OPENED(u->sink->thread_info.state); quick = u->sink && PA_SINK_IS_OPENED(u->sink->thread_info.state);
} }
@ -779,15 +779,15 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
if (!u->sink || u->sink_suspended) { if (!u->sink || u->sink_suspended) {
if (unsuspend(u) < 0) if (unsuspend(u) < 0)
return -1; return -1;
quick = FALSE; quick = false;
} }
do_trigger = TRUE; do_trigger = true;
u->in_mmap_current = 0; u->in_mmap_current = 0;
u->in_mmap_saved_nfrags = 0; u->in_mmap_saved_nfrags = 0;
u->source_suspended = FALSE; u->source_suspended = false;
} }
break; break;
@ -921,7 +921,7 @@ static void thread_func(void *userdata) {
} else { } else {
ssize_t l; ssize_t l;
pa_bool_t loop = FALSE, work_done = FALSE; bool loop = false, work_done = false;
l = (ssize_t) u->out_fragment_size; l = (ssize_t) u->out_fragment_size;
@ -930,14 +930,14 @@ static void thread_func(void *userdata) {
if (ioctl(u->fd, SNDCTL_DSP_GETOSPACE, &info) < 0) { if (ioctl(u->fd, SNDCTL_DSP_GETOSPACE, &info) < 0) {
pa_log_info("Device doesn't support SNDCTL_DSP_GETOSPACE: %s", pa_cstrerror(errno)); pa_log_info("Device doesn't support SNDCTL_DSP_GETOSPACE: %s", pa_cstrerror(errno));
u->use_getospace = FALSE; u->use_getospace = false;
} else { } else {
l = info.bytes; l = info.bytes;
/* We loop only if GETOSPACE worked and we /* We loop only if GETOSPACE worked and we
* actually *know* that we can write more than * actually *know* that we can write more than
* one fragment at a time */ * one fragment at a time */
loop = TRUE; loop = true;
} }
} }
@ -952,7 +952,7 @@ static void thread_func(void *userdata) {
* avoid spinning forever. */ * avoid spinning forever. */
if (l <= 0 && (revents & POLLOUT)) { if (l <= 0 && (revents & POLLOUT)) {
l = (ssize_t) u->out_fragment_size; l = (ssize_t) u->out_fragment_size;
loop = FALSE; loop = false;
} }
while (l > 0) { while (l > 0) {
@ -1001,7 +1001,7 @@ static void thread_func(void *userdata) {
l -= t; l -= t;
revents &= ~POLLOUT; revents &= ~POLLOUT;
work_done = TRUE; work_done = true;
} }
if (!loop) if (!loop)
@ -1032,7 +1032,7 @@ static void thread_func(void *userdata) {
void *p; void *p;
ssize_t l; ssize_t l;
pa_memchunk memchunk; pa_memchunk memchunk;
pa_bool_t loop = FALSE, work_done = FALSE; bool loop = false, work_done = false;
l = (ssize_t) u->in_fragment_size; l = (ssize_t) u->in_fragment_size;
@ -1041,10 +1041,10 @@ static void thread_func(void *userdata) {
if (ioctl(u->fd, SNDCTL_DSP_GETISPACE, &info) < 0) { if (ioctl(u->fd, SNDCTL_DSP_GETISPACE, &info) < 0) {
pa_log_info("Device doesn't support SNDCTL_DSP_GETISPACE: %s", pa_cstrerror(errno)); pa_log_info("Device doesn't support SNDCTL_DSP_GETISPACE: %s", pa_cstrerror(errno));
u->use_getispace = FALSE; u->use_getispace = false;
} else { } else {
l = info.bytes; l = info.bytes;
loop = TRUE; loop = true;
} }
} }
@ -1052,7 +1052,7 @@ static void thread_func(void *userdata) {
if (l <= 0 && (revents & POLLIN)) { if (l <= 0 && (revents & POLLIN)) {
l = (ssize_t) u->in_fragment_size; l = (ssize_t) u->in_fragment_size;
loop = FALSE; loop = false;
} }
while (l > 0) { while (l > 0) {
@ -1105,7 +1105,7 @@ static void thread_func(void *userdata) {
l -= t; l -= t;
revents &= ~POLLIN; revents &= ~POLLIN;
work_done = TRUE; work_done = true;
} }
if (!loop) if (!loop)
@ -1131,7 +1131,7 @@ static void thread_func(void *userdata) {
} }
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)
@ -1170,13 +1170,13 @@ int pa__init(pa_module*m) {
int fd = -1; int fd = -1;
int nfrags, orig_frag_size, frag_size; int nfrags, orig_frag_size, frag_size;
int mode, caps; int mode, caps;
pa_bool_t record = TRUE, playback = TRUE, use_mmap = TRUE; bool record = true, playback = true, use_mmap = true;
pa_sample_spec ss; pa_sample_spec ss;
pa_channel_map map; pa_channel_map map;
pa_modargs *ma = NULL; pa_modargs *ma = NULL;
char hwdesc[64]; char hwdesc[64];
const char *name; const char *name;
pa_bool_t namereg_fail; bool namereg_fail;
pa_sink_new_data sink_new_data; pa_sink_new_data sink_new_data;
pa_source_new_data source_new_data; pa_source_new_data source_new_data;
@ -1226,12 +1226,12 @@ int pa__init(pa_module*m) {
if (use_mmap && (!(caps & DSP_CAP_MMAP) || !(caps & DSP_CAP_TRIGGER))) { if (use_mmap && (!(caps & DSP_CAP_MMAP) || !(caps & DSP_CAP_TRIGGER))) {
pa_log_info("OSS device not mmap capable, falling back to UNIX read/write mode."); pa_log_info("OSS device not mmap capable, falling back to UNIX read/write mode.");
use_mmap = FALSE; use_mmap = false;
} }
if (use_mmap && mode == O_WRONLY) { if (use_mmap && mode == O_WRONLY) {
pa_log_info("Device opened for playback only, cannot do memory mapping, falling back to UNIX write() mode."); pa_log_info("Device opened for playback only, cannot do memory mapping, falling back to UNIX write() mode.");
use_mmap = FALSE; use_mmap = false;
} }
if (pa_oss_get_hw_description(dev, hwdesc, sizeof(hwdesc)) >= 0) if (pa_oss_get_hw_description(dev, hwdesc, sizeof(hwdesc)) >= 0)
@ -1262,8 +1262,8 @@ int pa__init(pa_module*m) {
u->fd = fd; u->fd = fd;
u->mixer_fd = -1; u->mixer_fd = -1;
u->mixer_devmask = 0; u->mixer_devmask = 0;
u->use_getospace = u->use_getispace = TRUE; u->use_getospace = u->use_getispace = true;
u->use_getodelay = TRUE; u->use_getodelay = true;
u->mode = mode; u->mode = mode;
u->frame_size = pa_frame_size(&ss); u->frame_size = pa_frame_size(&ss);
u->device_name = pa_xstrdup(dev); u->device_name = pa_xstrdup(dev);
@ -1280,14 +1280,14 @@ int pa__init(pa_module*m) {
pa_log_info("Input -- %u fragments of size %u.", info.fragstotal, info.fragsize); pa_log_info("Input -- %u fragments of size %u.", info.fragstotal, info.fragsize);
u->in_fragment_size = (uint32_t) info.fragsize; u->in_fragment_size = (uint32_t) info.fragsize;
u->in_nfrags = (uint32_t) info.fragstotal; u->in_nfrags = (uint32_t) info.fragstotal;
u->use_getispace = TRUE; u->use_getispace = true;
} }
if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) >= 0) { if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) >= 0) {
pa_log_info("Output -- %u fragments of size %u.", info.fragstotal, info.fragsize); pa_log_info("Output -- %u fragments of size %u.", info.fragstotal, info.fragsize);
u->out_fragment_size = (uint32_t) info.fragsize; u->out_fragment_size = (uint32_t) info.fragsize;
u->out_nfrags = (uint32_t) info.fragstotal; u->out_nfrags = (uint32_t) info.fragstotal;
u->use_getospace = TRUE; u->use_getospace = true;
} }
u->in_hwbuf_size = u->in_nfrags * u->in_fragment_size; u->in_hwbuf_size = u->in_nfrags * u->in_fragment_size;
@ -1299,17 +1299,17 @@ int pa__init(pa_module*m) {
if (use_mmap) { if (use_mmap) {
if ((u->in_mmap = mmap(NULL, u->in_hwbuf_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) { if ((u->in_mmap = mmap(NULL, u->in_hwbuf_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) {
pa_log_warn("mmap(PROT_READ) failed, reverting to non-mmap mode: %s", pa_cstrerror(errno)); pa_log_warn("mmap(PROT_READ) failed, reverting to non-mmap mode: %s", pa_cstrerror(errno));
use_mmap = u->use_mmap = FALSE; use_mmap = u->use_mmap = false;
u->in_mmap = NULL; u->in_mmap = NULL;
} else } else
pa_log_debug("Successfully mmap()ed input buffer."); pa_log_debug("Successfully mmap()ed input buffer.");
} }
if ((name = pa_modargs_get_value(ma, "source_name", NULL))) if ((name = pa_modargs_get_value(ma, "source_name", NULL)))
namereg_fail = TRUE; namereg_fail = true;
else { else {
name = name_buf = pa_sprintf_malloc("oss_input.%s", pa_path_get_filename(dev)); name = name_buf = pa_sprintf_malloc("oss_input.%s", pa_path_get_filename(dev));
namereg_fail = FALSE; namereg_fail = false;
} }
pa_source_new_data_init(&source_new_data); pa_source_new_data_init(&source_new_data);
@ -1347,7 +1347,7 @@ int pa__init(pa_module*m) {
pa_source_set_asyncmsgq(u->source, u->thread_mq.inq); pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
pa_source_set_rtpoll(u->source, u->rtpoll); pa_source_set_rtpoll(u->source, u->rtpoll);
pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(u->in_hwbuf_size, &u->source->sample_spec)); pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(u->in_hwbuf_size, &u->source->sample_spec));
u->source->refresh_volume = TRUE; u->source->refresh_volume = true;
if (use_mmap) if (use_mmap)
u->in_mmap_memblocks = pa_xnew0(pa_memblock*, u->in_nfrags); u->in_mmap_memblocks = pa_xnew0(pa_memblock*, u->in_nfrags);
@ -1364,7 +1364,7 @@ int pa__init(pa_module*m) {
goto go_on; goto go_on;
} else { } else {
pa_log_warn("mmap(PROT_WRITE) failed, reverting to non-mmap mode: %s", pa_cstrerror(errno)); pa_log_warn("mmap(PROT_WRITE) failed, reverting to non-mmap mode: %s", pa_cstrerror(errno));
u->use_mmap = use_mmap = FALSE; u->use_mmap = use_mmap = false;
u->out_mmap = NULL; u->out_mmap = NULL;
} }
} else { } else {
@ -1374,10 +1374,10 @@ int pa__init(pa_module*m) {
} }
if ((name = pa_modargs_get_value(ma, "sink_name", NULL))) if ((name = pa_modargs_get_value(ma, "sink_name", NULL)))
namereg_fail = TRUE; namereg_fail = true;
else { else {
name = name_buf = pa_sprintf_malloc("oss_output.%s", pa_path_get_filename(dev)); name = name_buf = pa_sprintf_malloc("oss_output.%s", pa_path_get_filename(dev));
namereg_fail = FALSE; namereg_fail = false;
} }
pa_sink_new_data_init(&sink_new_data); pa_sink_new_data_init(&sink_new_data);
@ -1415,7 +1415,7 @@ int pa__init(pa_module*m) {
pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq); pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
pa_sink_set_rtpoll(u->sink, u->rtpoll); pa_sink_set_rtpoll(u->sink, u->rtpoll);
pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(u->out_hwbuf_size, &u->sink->sample_spec)); pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(u->out_hwbuf_size, &u->sink->sample_spec));
u->sink->refresh_volume = TRUE; u->sink->refresh_volume = true;
pa_sink_set_max_request(u->sink, u->out_hwbuf_size); pa_sink_set_max_request(u->sink, u->out_hwbuf_size);
@ -1424,7 +1424,7 @@ int pa__init(pa_module*m) {
} }
if ((u->mixer_fd = pa_oss_open_mixer_for_device(u->device_name)) >= 0) { if ((u->mixer_fd = pa_oss_open_mixer_for_device(u->device_name)) >= 0) {
pa_bool_t do_close = TRUE; bool do_close = true;
if (ioctl(fd, SOUND_MIXER_READ_DEVMASK, &u->mixer_devmask) < 0) if (ioctl(fd, SOUND_MIXER_READ_DEVMASK, &u->mixer_devmask) < 0)
pa_log_warn("SOUND_MIXER_READ_DEVMASK failed: %s", pa_cstrerror(errno)); pa_log_warn("SOUND_MIXER_READ_DEVMASK failed: %s", pa_cstrerror(errno));
@ -1434,7 +1434,7 @@ int pa__init(pa_module*m) {
pa_sink_set_get_volume_callback(u->sink, sink_get_volume); pa_sink_set_get_volume_callback(u->sink, sink_get_volume);
pa_sink_set_set_volume_callback(u->sink, sink_set_volume); pa_sink_set_set_volume_callback(u->sink, sink_set_volume);
u->sink->n_volume_steps = 101; u->sink->n_volume_steps = 101;
do_close = FALSE; do_close = false;
} }
if (u->source && (u->mixer_devmask & (SOUND_MASK_RECLEV|SOUND_MASK_IGAIN))) { if (u->source && (u->mixer_devmask & (SOUND_MASK_RECLEV|SOUND_MASK_IGAIN))) {
@ -1442,7 +1442,7 @@ int pa__init(pa_module*m) {
pa_source_set_get_volume_callback(u->source, source_get_volume); pa_source_set_get_volume_callback(u->source, source_get_volume);
pa_source_set_set_volume_callback(u->source, source_set_volume); pa_source_set_set_volume_callback(u->source, source_set_volume);
u->source->n_volume_steps = 101; u->source->n_volume_steps = 101;
do_close = FALSE; do_close = false;
} }
} }

View file

@ -50,7 +50,7 @@
PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_AUTHOR("Colin Guthrie");
PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Discovery of RAOP devices"); PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Discovery of RAOP devices");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(true);
#define SERVICE_TYPE_SINK "_raop._tcp" #define SERVICE_TYPE_SINK "_raop._tcp"
@ -256,7 +256,7 @@ static void browser_cb(
struct tunnel *t2; struct tunnel *t2;
if ((t2 = pa_hashmap_get(u->tunnels, t))) { if ((t2 = pa_hashmap_get(u->tunnels, t))) {
pa_module_unload_request_by_index(u->core, t2->module_index, TRUE); pa_module_unload_request_by_index(u->core, t2->module_index, true);
pa_hashmap_remove(u->tunnels, t2); pa_hashmap_remove(u->tunnels, t2);
tunnel_free(t2); tunnel_free(t2);
} }
@ -289,7 +289,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda
browser_cb, u))) { browser_cb, u))) {
pa_log("avahi_service_browser_new() failed: %s", avahi_strerror(avahi_client_errno(c))); pa_log("avahi_service_browser_new() failed: %s", avahi_strerror(avahi_client_errno(c)));
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
} }
@ -303,7 +303,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda
if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error))) { if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error))) {
pa_log("avahi_client_new() failed: %s", avahi_strerror(error)); pa_log("avahi_client_new() failed: %s", avahi_strerror(error));
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
} }
@ -377,7 +377,7 @@ void pa__done(pa_module*m) {
struct tunnel *t; struct tunnel *t;
while ((t = pa_hashmap_steal_first(u->tunnels))) { while ((t = pa_hashmap_steal_first(u->tunnels))) {
pa_module_unload_request_by_index(u->core, t->module_index, TRUE); pa_module_unload_request_by_index(u->core, t->module_index, true);
tunnel_free(t); tunnel_free(t);
} }

View file

@ -63,7 +63,7 @@
PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_AUTHOR("Colin Guthrie");
PA_MODULE_DESCRIPTION("RAOP Sink"); PA_MODULE_DESCRIPTION("RAOP Sink");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> " "sink_properties=<properties for the sink> "
@ -186,7 +186,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
case PA_SINK_RUNNING: case PA_SINK_RUNNING:
if (u->sink->thread_info.state == PA_SINK_SUSPENDED) { if (u->sink->thread_info.state == PA_SINK_SUSPENDED) {
pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE); pa_smoother_resume(u->smoother, pa_rtclock_now(), true);
/* The connection can be closed when idle, so check to /* The connection can be closed when idle, so check to
see if we need to reestablish it */ see if we need to reestablish it */
@ -253,7 +253,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
/* Question: is this valid here: or should we do some sort of: /* Question: is this valid here: or should we do some sort of:
return pa_sink_process_msg(PA_MSGOBJECT(u->core), PA_CORE_MESSAGE_UNLOAD_MODULE, u->module, 0, NULL); return pa_sink_process_msg(PA_MSGOBJECT(u->core), PA_CORE_MESSAGE_UNLOAD_MODULE, u->module, 0, NULL);
?? */ ?? */
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
} }
return 0; return 0;
} }
@ -465,7 +465,7 @@ static void thread_func(void *userdata) {
pollfd->events = POLLOUT; /*PA_SINK_IS_OPENED(u->sink->thread_info.state) ? POLLOUT : 0;*/ pollfd->events = POLLOUT; /*PA_SINK_IS_OPENED(u->sink->thread_info.state) ? POLLOUT : 0;*/
} }
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
goto fail; goto fail;
if (ret == 0) if (ret == 0)
@ -537,11 +537,11 @@ int pa__init(pa_module*m) {
u->smoother = pa_smoother_new( u->smoother = pa_smoother_new(
PA_USEC_PER_SEC, PA_USEC_PER_SEC,
PA_USEC_PER_SEC*2, PA_USEC_PER_SEC*2,
TRUE, true,
TRUE, true,
10, 10,
0, 0,
FALSE); false);
pa_memchunk_reset(&u->raw_memchunk); pa_memchunk_reset(&u->raw_memchunk);
pa_memchunk_reset(&u->encoded_memchunk); pa_memchunk_reset(&u->encoded_memchunk);
u->offset = 0; u->offset = 0;

View file

@ -221,7 +221,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata
c->fd = pa_iochannel_get_send_fd(io); c->fd = pa_iochannel_get_send_fd(io);
pa_iochannel_set_noclose(io, TRUE); pa_iochannel_set_noclose(io, true);
pa_iochannel_free(io); pa_iochannel_free(io);
pa_make_tcp_socket_low_delay(c->fd); pa_make_tcp_socket_low_delay(c->fd);
@ -323,7 +323,7 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* he
uint32_t port = pa_rtsp_serverport(c->rtsp); uint32_t port = pa_rtsp_serverport(c->rtsp);
pa_log_debug("RAOP: RECORDED"); pa_log_debug("RAOP: RECORDED");
if (!(c->sc = pa_socket_client_new_string(c->core->mainloop, TRUE, c->host, port))) { if (!(c->sc = pa_socket_client_new_string(c->core->mainloop, true, c->host, port))) {
pa_log("failed to connect to server '%s:%d'", c->host, port); pa_log("failed to connect to server '%s:%d'", c->host, port);
return; return;
} }

View file

@ -331,7 +331,7 @@ pa_hook* pa_reserve_monitor_wrapper_hook(pa_reserve_monitor_wrapper *w) {
return &w->hook; return &w->hook;
} }
pa_bool_t pa_reserve_monitor_wrapper_busy(pa_reserve_monitor_wrapper *w) { bool pa_reserve_monitor_wrapper_busy(pa_reserve_monitor_wrapper *w) {
pa_assert(w); pa_assert(w);
pa_assert(PA_REFCNT_VALUE(w) >= 1); pa_assert(PA_REFCNT_VALUE(w) >= 1);
@ -339,6 +339,6 @@ pa_bool_t pa_reserve_monitor_wrapper_busy(pa_reserve_monitor_wrapper *w) {
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
return rm_busy(w->monitor) > 0; return rm_busy(w->monitor) > 0;
#else #else
return FALSE; return false;
#endif #endif
} }

View file

@ -40,6 +40,6 @@ pa_reserve_monitor_wrapper* pa_reserve_monitor_wrapper_get(pa_core *c, const cha
void pa_reserve_monitor_wrapper_unref(pa_reserve_monitor_wrapper *m); void pa_reserve_monitor_wrapper_unref(pa_reserve_monitor_wrapper *m);
pa_hook* pa_reserve_monitor_wrapper_hook(pa_reserve_monitor_wrapper *m); pa_hook* pa_reserve_monitor_wrapper_hook(pa_reserve_monitor_wrapper *m);
pa_bool_t pa_reserve_monitor_wrapper_busy(pa_reserve_monitor_wrapper *m); bool pa_reserve_monitor_wrapper_busy(pa_reserve_monitor_wrapper *m);
#endif #endif

View file

@ -61,7 +61,7 @@ void pa_headerlist_free(pa_headerlist* p) {
int pa_headerlist_puts(pa_headerlist *p, const char *key, const char *value) { int pa_headerlist_puts(pa_headerlist *p, const char *key, const char *value) {
struct header *hdr; struct header *hdr;
pa_bool_t add = FALSE; bool add = false;
pa_assert(p); pa_assert(p);
pa_assert(key); pa_assert(key);
@ -69,7 +69,7 @@ int pa_headerlist_puts(pa_headerlist *p, const char *key, const char *value) {
if (!(hdr = pa_hashmap_get(MAKE_HASHMAP(p), key))) { if (!(hdr = pa_hashmap_get(MAKE_HASHMAP(p), key))) {
hdr = pa_xnew(struct header, 1); hdr = pa_xnew(struct header, 1);
hdr->key = pa_xstrdup(key); hdr->key = pa_xstrdup(key);
add = TRUE; add = true;
} else } else
pa_xfree(hdr->value); pa_xfree(hdr->value);
@ -84,7 +84,7 @@ int pa_headerlist_puts(pa_headerlist *p, const char *key, const char *value) {
int pa_headerlist_putsappend(pa_headerlist *p, const char *key, const char *value) { int pa_headerlist_putsappend(pa_headerlist *p, const char *key, const char *value) {
struct header *hdr; struct header *hdr;
pa_bool_t add = FALSE; bool add = false;
pa_assert(p); pa_assert(p);
pa_assert(key); pa_assert(key);
@ -93,7 +93,7 @@ int pa_headerlist_putsappend(pa_headerlist *p, const char *key, const char *valu
hdr = pa_xnew(struct header, 1); hdr = pa_xnew(struct header, 1);
hdr->key = pa_xstrdup(key); hdr->key = pa_xstrdup(key);
hdr->value = pa_xstrdup(value); hdr->value = pa_xstrdup(value);
add = TRUE; add = true;
} else { } else {
void *newval = pa_sprintf_malloc("%s%s", (char*)hdr->value, value); void *newval = pa_sprintf_malloc("%s%s", (char*)hdr->value, value);
pa_xfree(hdr->value); pa_xfree(hdr->value);

View file

@ -64,7 +64,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Receive data from a network via RTP/SAP/SDP"); PA_MODULE_DESCRIPTION("Receive data from a network via RTP/SAP/SDP");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink=<name of the sink> " "sink=<name of the sink> "
"sap_address=<multicast address to listen on> " "sap_address=<multicast address to listen on> "
@ -91,7 +91,7 @@ struct session {
pa_sink_input *sink_input; pa_sink_input *sink_input;
pa_memblockq *memblockq; pa_memblockq *memblockq;
pa_bool_t first_packet; bool first_packet;
uint32_t ssrc; uint32_t ssrc;
uint32_t offset; uint32_t offset;
@ -191,7 +191,7 @@ static void sink_input_kill(pa_sink_input* i) {
} }
/* Called from IO context */ /* Called from IO context */
static void sink_input_suspend_within_thread(pa_sink_input* i, pa_bool_t b) { static void sink_input_suspend_within_thread(pa_sink_input* i, bool b) {
struct session *s; struct session *s;
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
pa_assert_se(s = i->userdata); pa_assert_se(s = i->userdata);
@ -199,7 +199,7 @@ static void sink_input_suspend_within_thread(pa_sink_input* i, pa_bool_t b) {
if (b) if (b)
pa_memblockq_flush_read(s->memblockq); pa_memblockq_flush_read(s->memblockq);
else else
s->first_packet = FALSE; s->first_packet = false;
} }
/* Called from I/O thread context */ /* Called from I/O thread context */
@ -234,7 +234,7 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
} }
if (!s->first_packet) { if (!s->first_packet) {
s->first_packet = TRUE; s->first_packet = true;
s->ssrc = s->rtp_context.ssrc; s->ssrc = s->rtp_context.ssrc;
s->offset = s->rtp_context.timestamp; s->offset = s->rtp_context.timestamp;
@ -257,7 +257,7 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
else else
delta = j; delta = j;
pa_memblockq_seek(s->memblockq, delta * (int64_t) s->rtp_context.frame_size, PA_SEEK_RELATIVE, TRUE); pa_memblockq_seek(s->memblockq, delta * (int64_t) s->rtp_context.frame_size, PA_SEEK_RELATIVE, true);
if (now.tv_sec == 0) { if (now.tv_sec == 0) {
PA_ONCE_BEGIN { PA_ONCE_BEGIN {
@ -269,7 +269,7 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
if (pa_memblockq_push(s->memblockq, &chunk) < 0) { if (pa_memblockq_push(s->memblockq, &chunk) < 0) {
pa_log_warn("Queue overrun"); pa_log_warn("Queue overrun");
pa_memblockq_seek(s->memblockq, (int64_t) chunk.length, PA_SEEK_RELATIVE, TRUE); pa_memblockq_seek(s->memblockq, (int64_t) chunk.length, PA_SEEK_RELATIVE, true);
} }
/* pa_log("blocks in q: %u", pa_memblockq_get_nblocks(s->memblockq)); */ /* pa_log("blocks in q: %u", pa_memblockq_get_nblocks(s->memblockq)); */
@ -378,7 +378,7 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
pa_log_debug("Requesting rewind due to end of underrun"); pa_log_debug("Requesting rewind due to end of underrun");
pa_sink_input_request_rewind(s->sink_input, pa_sink_input_request_rewind(s->sink_input,
(size_t) (s->sink_input->thread_info.underrun_for == (uint64_t) -1 ? 0 : s->sink_input->thread_info.underrun_for), (size_t) (s->sink_input->thread_info.underrun_for == (uint64_t) -1 ? 0 : s->sink_input->thread_info.underrun_for),
FALSE, TRUE, FALSE); false, true, false);
} }
return 1; return 1;
@ -505,7 +505,7 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
s = pa_xnew0(struct session, 1); s = pa_xnew0(struct session, 1);
s->userdata = u; s->userdata = u;
s->first_packet = FALSE; s->first_packet = false;
s->sdp_info = *sdp_info; s->sdp_info = *sdp_info;
s->rtpoll_item = NULL; s->rtpoll_item = NULL;
s->intended_latency = LATENCY_USEC; s->intended_latency = LATENCY_USEC;
@ -519,7 +519,7 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
goto fail; goto fail;
pa_sink_input_new_data_init(&data); pa_sink_input_new_data_init(&data);
pa_sink_input_new_data_set_sink(&data, sink, FALSE); pa_sink_input_new_data_set_sink(&data, sink, false);
data.driver = __FILE__; data.driver = __FILE__;
pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "stream"); pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "stream");
pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME, pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME,
@ -617,7 +617,7 @@ static void session_free(struct session *s) {
static void sap_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event_flags_t flags, void *userdata) { static void sap_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event_flags_t flags, void *userdata) {
struct userdata *u = userdata; struct userdata *u = userdata;
pa_bool_t goodbye = FALSE; bool goodbye = false;
pa_sdp_info info; pa_sdp_info info;
struct session *s; struct session *s;

View file

@ -57,7 +57,7 @@
PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Read data from source and send it to the network via RTP/SAP/SDP"); PA_MODULE_DESCRIPTION("Read data from source and send it to the network via RTP/SAP/SDP");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"source=<name of the source> " "source=<name of the source> "
"format=<sample format> " "format=<sample format> "
@ -145,7 +145,7 @@ static void source_output_kill(pa_source_output* o) {
pa_source_output_assert_ref(o); pa_source_output_assert_ref(o);
pa_assert_se(u = o->userdata); pa_assert_se(u = o->userdata);
pa_module_unload_request(u->module, TRUE); pa_module_unload_request(u->module, true);
pa_source_output_unlink(u->source_output); pa_source_output_unlink(u->source_output);
pa_source_output_unref(u->source_output); pa_source_output_unref(u->source_output);
@ -187,7 +187,7 @@ int pa__init(pa_module*m) {
int r, j; int r, j;
socklen_t k; socklen_t k;
char hn[128], *n; char hn[128], *n;
pa_bool_t loop = FALSE; bool loop = false;
pa_source_output_new_data data; pa_source_output_new_data data;
pa_assert(m); pa_assert(m);
@ -368,7 +368,7 @@ int pa__init(pa_module*m) {
pa_proplist_setf(data.proplist, "rtp.ttl", "%lu", (unsigned long) ttl); pa_proplist_setf(data.proplist, "rtp.ttl", "%lu", (unsigned long) ttl);
data.driver = __FILE__; data.driver = __FILE__;
data.module = m; data.module = m;
pa_source_output_new_data_set_source(&data, s, FALSE); pa_source_output_new_data_set_source(&data, s, false);
pa_source_output_new_data_set_sample_spec(&data, &ss); pa_source_output_new_data_set_sample_spec(&data, &ss);
pa_source_output_new_data_set_channel_map(&data, &cm); pa_source_output_new_data_set_channel_map(&data, &cm);
data.flags = PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND; data.flags = PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND;

View file

@ -170,7 +170,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool, struct
unsigned cc; unsigned cc;
ssize_t r; ssize_t r;
uint8_t aux[1024]; uint8_t aux[1024];
pa_bool_t found_tstamp = FALSE; bool found_tstamp = false;
pa_assert(c); pa_assert(c);
pa_assert(chunk); pa_assert(chunk);
@ -280,7 +280,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool, struct
for (cm = CMSG_FIRSTHDR(&m); cm; cm = CMSG_NXTHDR(&m, cm)) for (cm = CMSG_FIRSTHDR(&m); cm; cm = CMSG_NXTHDR(&m, cm))
if (cm->cmsg_level == SOL_SOCKET && cm->cmsg_type == SCM_TIMESTAMP) { if (cm->cmsg_level == SOL_SOCKET && cm->cmsg_type == SCM_TIMESTAMP) {
memcpy(tstamp, CMSG_DATA(cm), sizeof(struct timeval)); memcpy(tstamp, CMSG_DATA(cm), sizeof(struct timeval));
found_tstamp = TRUE; found_tstamp = true;
break; break;
} }

View file

@ -329,7 +329,7 @@ int pa_rtsp_connect(pa_rtsp_client *c) {
c->session = NULL; c->session = NULL;
pa_log_debug("Attempting to connect to server '%s:%d'", c->hostname, c->port); pa_log_debug("Attempting to connect to server '%s:%d'", c->hostname, c->port);
if (!(c->sc = pa_socket_client_new_string(c->mainloop, TRUE, c->hostname, c->port))) { if (!(c->sc = pa_socket_client_new_string(c->mainloop, true, c->hostname, c->port))) {
pa_log("failed to connect to server '%s:%d'", c->hostname, c->port); pa_log("failed to connect to server '%s:%d'", c->hostname, c->port);
return -1; return -1;
} }

Some files were not shown because too many files have changed in this diff Show more