diff options
author | poljar (Damir Jelić) <poljarinho@gmail.com> | 2013-06-27 19:28:09 +0200 |
---|---|---|
committer | Tanu Kaskinen <tanu.kaskinen@linux.intel.com> | 2013-07-04 12:25:30 +0300 |
commit | d806b197144733607b0ecb8678c6ee5d99ccc9ea (patch) | |
tree | 67b37aaa47303713295c43e535892822a9e11322 /src/modules/alsa | |
parent | e9822bfcb071a1b0e8f4eb67c6d471c466aeaf98 (diff) | |
download | pulseaudio-d806b197144733607b0ecb8678c6ee5d99ccc9ea.tar.gz |
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
Diffstat (limited to 'src/modules/alsa')
-rw-r--r-- | src/modules/alsa/alsa-mixer.c | 200 | ||||
-rw-r--r-- | src/modules/alsa/alsa-mixer.h | 40 | ||||
-rw-r--r-- | src/modules/alsa/alsa-sink.c | 160 | ||||
-rw-r--r-- | src/modules/alsa/alsa-source.c | 144 | ||||
-rw-r--r-- | src/modules/alsa/alsa-ucm.c | 26 | ||||
-rw-r--r-- | src/modules/alsa/alsa-util.c | 80 | ||||
-rw-r--r-- | src/modules/alsa/alsa-util.h | 38 | ||||
-rw-r--r-- | src/modules/alsa/module-alsa-card.c | 30 | ||||
-rw-r--r-- | src/modules/alsa/module-alsa-sink.c | 2 | ||||
-rw-r--r-- | src/modules/alsa/module-alsa-source.c | 2 |
10 files changed, 361 insertions, 361 deletions
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index f4410d74c..545ae9f9d 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -83,7 +83,7 @@ struct pa_alsa_fdlist { pa_defer_event *defer; pa_io_event **ios; - pa_bool_t polled; + bool polled; void (*cb)(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) return; - fdl->polled = TRUE; + fdl->polled = true; 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; } - fdl->polled = FALSE; + fdl->polled = false; if (memcmp(fdl->fds, fdl->work_fds, sizeof(struct pollfd) * num_fds) == 0) 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_set_name((sid), (name)); \ 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) { 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; } -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_elem_t *me; 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; if (!value) { - *b = FALSE; + *b = false; return 0; } } - *b = TRUE; + *b = true; 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_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; PA_LLIST_FOREACH(e, p->elements) { - pa_bool_t b; + bool b; if (e->switch_use != PA_ALSA_SWITCH_MUTE) 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; if (!b) { - *muted = TRUE; + *muted = true; return 0; } } - *muted = FALSE; + *muted = false; return 0; } @@ -887,7 +887,7 @@ static int element_get_nearest_alsa_dB(snd_mixer_elem_t *me, snd_mixer_selem_cha 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; 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++) { int r; pa_volume_t f = PA_VOLUME_MUTED; - pa_bool_t found = FALSE; + bool found = false; for (k = 0; k < cm->channels; 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) 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; } -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_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; } -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_selem_id_t *sid; 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; } -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_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; int r = 0; long volume = -1; - pa_bool_t volume_set = FALSE; + bool volume_set = false; pa_assert(m); 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) { case PA_ALSA_VOLUME_OFF: volume = e->min_volume; - volume_set = TRUE; + volume_set = true; break; 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; volume = decibel_fix_get_step(e->db_fix, &dB, (e->direction == PA_ALSA_DIRECTION_OUTPUT ? +1 : -1)); - volume_set = TRUE; + volume_set = true; } break; case PA_ALSA_VOLUME_CONSTANT: volume = e->constant_volume; - volume_set = TRUE; + volume_set = true; break; 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. * element_set_switch() will print a warning anyway, so this * 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) { case PA_ALSA_SWITCH_OFF: - r = element_set_switch(e, m, FALSE); + r = element_set_switch(e, m, false); break; case PA_ALSA_SWITCH_ON: - r = element_set_switch(e, m, TRUE); + r = element_set_switch(e, m, true); break; 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) { - pa_bool_t has_switch; - pa_bool_t has_enumeration; - pa_bool_t has_volume; + bool has_switch; + bool has_enumeration; + bool has_volume; pa_assert(e); 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) - e->direction_try_other = FALSE; + e->direction_try_other = false; } 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; int r; - e->direction_try_other = FALSE; + e->direction_try_other = false; if (e->direction == PA_ALSA_DIRECTION_OUTPUT) 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; } else { - pa_bool_t is_mono; + bool is_mono; pa_channel_position_t p; if (e->db_fix && @@ -1468,7 +1468,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) { } if (e->db_fix) { - e->has_dB = TRUE; + e->has_dB = true; e->min_volume = e->db_fix->min_step; e->max_volume = e->db_fix->max_step; 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) { 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); - 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) { 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 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) { 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) 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) return -1; if (j->required_any != PA_ALSA_REQUIRED_IGNORE) - j->path->req_any_present = TRUE; + j->path->req_any_present = true; } else { if (j->required != PA_ALSA_REQUIRED_IGNORE) return -1; @@ -1701,7 +1701,7 @@ static int jack_probe(pa_alsa_jack *j, snd_hctl_t *h) { 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_assert(p); @@ -1790,7 +1790,7 @@ static pa_alsa_option* option_get(pa_alsa_path *p, const char *section) { 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_LLIST_FOREACH(o, e->options) @@ -1820,7 +1820,7 @@ static int element_parse_switch(pa_config_parser_state *state) { 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); return -1; } @@ -1851,7 +1851,7 @@ static int element_parse_volume(pa_config_parser_state *state) { 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); return -1; } @@ -1887,7 +1887,7 @@ static int element_parse_enumeration(pa_config_parser_state *state) { 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); return -1; } @@ -1957,7 +1957,7 @@ static int element_parse_required(pa_config_parser_state *state) { p = state->userdata; - e = element_get(p, state->section, TRUE); + e = element_get(p, state->section, true); o = option_get(p, state->section); j = jack_get(p, state->section); if (!e && !o && !j) { @@ -2023,7 +2023,7 @@ static int element_parse_direction(pa_config_parser_state *state) { 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); return -1; } @@ -2049,7 +2049,7 @@ static int element_parse_direction_try_other(pa_config_parser_state *state) { 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); return -1; } @@ -2072,7 +2072,7 @@ static int element_parse_volume_limit(pa_config_parser_state *state) { 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); return -1; } @@ -2130,7 +2130,7 @@ static int element_parse_override_map(pa_config_parser_state *state) { 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); return -1; } @@ -2158,7 +2158,7 @@ static int element_parse_override_map(pa_config_parser_state *state) { pa_xfree(n); } - e->override_map = TRUE; + e->override_map = true; return 0; } @@ -2482,7 +2482,7 @@ pa_alsa_path *pa_alsa_path_synthesize(const char *element, pa_alsa_direction_t d 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_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; 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; if (!e) - return FALSE; + return false; for (o = e->options; o; o = o->next) { 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) { @@ -2614,7 +2614,7 @@ static void path_create_settings(pa_alsa_path *p) { 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_jack *j; 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) return p->supported ? 0 : -1; - p->probed = TRUE; + p->probed = true; pa_zero(min_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) { if (jack_probe(j, hctl) < 0) { - p->supported = FALSE; + p->supported = false; pa_log_debug("Probe of jack '%s' failed.", j->alsa_name); 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) { if (element_probe(e, m) < 0) { - p->supported = FALSE; + p->supported = false; pa_log_debug("Probe of element '%s' failed.", e->alsa_name); 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); if (ignore_dB) - e->has_dB = FALSE; + e->has_dB = false; 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); } - p->has_dB = TRUE; + p->has_dB = true; } else { 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; 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) - p->has_mute = TRUE; + p->has_mute = true; } 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); 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_create_settings(p); - p->supported = TRUE; + p->supported = true; p->min_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++) { pa_alsa_path *p = NULL; - pa_bool_t duplicate = FALSE; + bool duplicate = false; char **kn; for (kn = pn; kn < in; kn++) if (pa_streq(*kn, *in)) { - duplicate = TRUE; + duplicate = true; break; } @@ -3018,7 +3018,7 @@ void pa_alsa_path_set_dump(pa_alsa_path_set *ps) { 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_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) { 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; - if (!a_options) return TRUE; - if (!b_options) return FALSE; + if (!a_options) return true; + if (!b_options) return false; /* 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_bool_t found = FALSE; + bool found = false; PA_LLIST_FOREACH(ob, b_options) { if (pa_streq(oa->alsa_name, ob->alsa_name)) { - found = TRUE; + found = true; break; } } if (!found) - return FALSE; + return false; } - return TRUE; + return true; } /** * 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(b); 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 */ 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 */ 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. * "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); if (!(me = snd_mixer_find_selem(m, sid))) { pa_log_warn("Element %s seems to have disappeared.", a->alsa_name); - return FALSE; + return false; } if (a->direction == PA_ALSA_DIRECTION_OUTPUT) { if (snd_mixer_selem_ask_playback_dB_vol(me, dB, +1, &a_limit) < 0) - return FALSE; + return false; } else { 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) @@ -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; else /* This should never be reached */ - pa_assert(FALSE); + pa_assert(false); if (a_limit > b->volume_limit) - return FALSE; + return false; } if (a->volume_use == PA_ALSA_VOLUME_MERGE) { int s; /* If override-maps are different, they're not subsets */ if (a->n_channels != b->n_channels) - return FALSE; + return false; for (s = 0; s <= SND_MIXER_SCHN_LAST; s++) 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", 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 || 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 (a->switch_use == PA_ALSA_SWITCH_ON) { if (!options_have_option(b->options, "on")) - return FALSE; + return false; } else if (a->switch_use == PA_ALSA_SWITCH_OFF) { if (!options_have_option(b->options, "off")) - return FALSE; + return false; } } } else if (a->switch_use == PA_ALSA_SWITCH_SELECT) { if (!enumeration_is_subset(a->options, b->options)) - return FALSE; + return false; } } if (a->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)) - return FALSE; + return false; } - return TRUE; + return true; } 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++) { pa_alsa_mapping *m; char **in; - pa_bool_t duplicate = FALSE; + bool duplicate = false; for (in = name + 1; *in; in++) if (pa_streq(*name, *in)) { - duplicate = TRUE; + duplicate = true; break; } @@ -4002,11 +4002,11 @@ static int profile_verify(pa_alsa_profile *p) { for (name = p->input_mapping_names; *name; name++) { pa_alsa_mapping *m; char **in; - pa_bool_t duplicate = FALSE; + bool duplicate = false; for (in = name + 1; *in; in++) if (pa_streq(*name, *in)) { - duplicate = TRUE; + duplicate = true; break; } @@ -4277,7 +4277,7 @@ static snd_pcm_t* mapping_open_pcm(pa_alsa_mapping *m, return pa_alsa_open_by_template( m->device_strings, dev_id, NULL, &try_ss, &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) { @@ -4326,13 +4326,13 @@ void pa_alsa_profile_set_probe( if (!p->supported) { profile_finalize_probing(last, p); - p->supported = TRUE; + p->supported = true; if (p->output_mappings) { PA_IDXSET_FOREACH(m, p->output_mappings, idx) { 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); - p->supported = FALSE; + p->supported = false; break; } } @@ -4342,7 +4342,7 @@ void pa_alsa_profile_set_probe( PA_IDXSET_FOREACH(m, p->input_mappings, idx) { 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); - p->supported = FALSE; + p->supported = false; break; } } @@ -4363,7 +4363,7 @@ void pa_alsa_profile_set_probe( SND_PCM_STREAM_PLAYBACK, default_n_fragments, default_fragment_size_msec))) { - p->supported = FALSE; + p->supported = false; if (pa_idxset_size(p->output_mappings) == 1 && ((!p->input_mappings) || pa_idxset_size(p->input_mappings) == 0)) { 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, default_n_fragments, default_fragment_size_msec))) { - p->supported = FALSE; + p->supported = false; if (pa_idxset_size(p->input_mappings) == 1 && ((!p->output_mappings) || pa_idxset_size(p->output_mappings) == 0)) { 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_outputs, NULL); - ps->probed = TRUE; + ps->probed = true; } void pa_alsa_profile_set_dump(pa_alsa_profile_set *ps) { diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h index 3d50ebb61..432e4de78 100644 --- a/src/modules/alsa/alsa-mixer.h +++ b/src/modules/alsa/alsa-mixer.h @@ -138,10 +138,10 @@ struct pa_alsa_element { long constant_volume; - pa_bool_t override_map:1; - pa_bool_t direction_try_other:1; + bool override_map:1; + bool direction_try_other:1; - pa_bool_t has_dB:1; + bool has_dB:1; long min_volume, max_volume; long volume_limit; /* -1 for no configured limit */ double min_dB, max_dB; @@ -162,8 +162,8 @@ struct pa_alsa_jack { char *name; /* E g "Headphone" */ char *alsa_name; /* E g "Headphone Jack" */ - pa_bool_t has_control; /* is the jack itself present? */ - pa_bool_t plugged_in; /* is this jack currently plugged in? */ + bool has_control; /* is the jack itself present? */ + bool plugged_in; /* is this jack currently plugged in? */ snd_hctl_elem_t *hctl_elem; /* Jack detection handle */ pa_available_t state_unplugged, state_plugged; @@ -186,15 +186,15 @@ struct pa_alsa_path { int eld_device; pa_proplist *proplist; - pa_bool_t probed:1; - pa_bool_t supported:1; - pa_bool_t has_mute:1; - pa_bool_t has_volume:1; - pa_bool_t has_dB:1; + bool probed:1; + bool supported:1; + bool has_mute:1; + bool has_volume:1; + bool has_dB:1; bool mute_during_activation:1; /* These two are used during probing only */ - pa_bool_t has_req_any:1; - pa_bool_t req_any_present:1; + bool has_req_any:1; + bool req_any_present:1; long min_volume, max_volume; 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_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); 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_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_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, bool deferred_volume, bool write_to_hw); +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); 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); @@ -282,7 +282,7 @@ struct pa_alsa_profile { char *description; unsigned priority; - pa_bool_t supported:1; + bool supported:1; char **input_mapping_names; char **output_mapping_names; @@ -314,9 +314,9 @@ struct pa_alsa_profile_set { pa_hashmap *input_paths; pa_hashmap *output_paths; - pa_bool_t auto_profiles; - pa_bool_t ignore_dB:1; - pa_bool_t probed:1; + bool auto_profiles; + bool ignore_dB:1; + bool probed:1; }; void pa_alsa_mapping_dump(pa_alsa_mapping *m); diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index aa6cf74d4..535f7ec59 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -136,9 +136,9 @@ struct userdata { char *device_name; /* name of the PCM 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; @@ -162,11 +162,11 @@ struct userdata { static void userdata_free(struct userdata *u); /* 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); } -static pa_bool_t is_hdmi(struct userdata *u) { +static bool is_hdmi(struct userdata *u) { 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); - 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_OK; @@ -445,14 +445,14 @@ static int try_recover(struct userdata *u, const char *call, int err) { return -1; } - u->first = TRUE; + u->first = true; u->since_start = 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; - pa_bool_t underrun = FALSE; + bool underrun = false; /* We use <= instead of < for this check here because an underrun * 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! */ left_to_play = 0; - underrun = TRUE; + underrun = true; #if 0 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 if (u->use_tsched) { - pa_bool_t reset_not_before = TRUE; + bool reset_not_before = true; if (!u->first && !u->after_rewind) { if (underrun || left_to_play < u->watermark_inc_threshold) increase_watermark(u); 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 * 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; } -static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled, pa_bool_t on_timeout) { - pa_bool_t work_done = FALSE; +static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bool on_timeout) { + bool work_done = false; pa_usec_t max_sleep_usec = 0, process_usec = 0; size_t left_to_play, input_underrun; 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; size_t n_bytes; int r; - pa_bool_t after_avail = TRUE; + bool after_avail = true; /* First we determine how many samples are missing to fill the * 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 left_to_play = check_left_to_play(u, n_bytes, on_timeout); - on_timeout = FALSE; + on_timeout = false; 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; - polled = FALSE; + polled = false; #ifdef DEBUG_TIMING 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; pa_assert(frames > 0); - after_avail = FALSE; + after_avail = false; /* Check these are multiples of 8 bit */ 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); 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.index = 0; @@ -657,7 +657,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle return r; } - work_done = TRUE; + work_done = true; u->write_count += 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; } -static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled, pa_bool_t on_timeout) { - pa_bool_t work_done = FALSE; +static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bool on_timeout) { + bool work_done = false; pa_usec_t max_sleep_usec = 0, process_usec = 0; size_t left_to_play, input_underrun; 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; size_t n_bytes; 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)) { @@ -726,7 +726,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle #endif left_to_play = check_left_to_play(u, n_bytes, on_timeout); - on_timeout = FALSE; + on_timeout = false; 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; - polled = FALSE; + polled = false; for (;;) { 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; pa_assert(frames > 0); - after_avail = FALSE; + after_avail = false; written = frames * u->frame_size; 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); } - work_done = TRUE; + work_done = true; u->write_count += written; u->since_start += written; @@ -862,7 +862,7 @@ static void update_smoother(struct userdata *u) { /* 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)); 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 */ 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->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) { pa_sample_spec ss; int err; - pa_bool_t b, d; + bool b, d; snd_pcm_uframes_t period_size, buffer_size; char *device_name = NULL; @@ -1088,7 +1088,7 @@ static int unsuspend(struct userdata *u) { b = u->use_mmap; 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)); goto fail; } @@ -1118,16 +1118,16 @@ static int unsuspend(struct userdata *u) { goto fail; 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->last_smoother_update = 0; - u->first = TRUE; + u->first = true; u->since_start = 0; /* reset the watermark to the value defined when sink was created */ 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..."); @@ -1238,13 +1238,13 @@ static int ctl_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) { return 0; 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; } if (mask & SND_CTL_EVENT_MASK_VALUE) { - pa_sink_get_volume(u->sink, TRUE); - pa_sink_get_mute(u->sink, TRUE); + pa_sink_get_volume(u->sink, true); + pa_sink_get_mute(u->sink, true); } return 0; @@ -1260,7 +1260,7 @@ static int io_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) { return 0; 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; } @@ -1307,7 +1307,7 @@ static void sink_set_volume_cb(pa_sink *s) { struct userdata *u = s->userdata; pa_cvolume r; 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->mixer_path); @@ -1326,7 +1326,7 @@ static void sink_set_volume_cb(pa_sink *s) { if (u->mixer_path->has_dB) { pa_cvolume new_soft_volume; - pa_bool_t accurate_enough; + bool accurate_enough; char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX]; /* 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 */ 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"); else { pa_cvolume tmp_vol; - pa_bool_t accurate_enough; + bool accurate_enough; /* Shift down by the base volume, so that 0dB becomes maximum 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) { struct userdata *u = s->userdata; - pa_bool_t b; + bool b; pa_assert(u); 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); 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); 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)); } 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); 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(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) { @@ -1555,7 +1555,7 @@ static pa_idxset* sink_get_formats(pa_sink *s) { 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; pa_format_info *f, *g; 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) { if (is_iec958(u) && f->encoding == PA_ENCODING_EAC3_IEC61937) /* 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); @@ -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; int i; - pa_bool_t supported = FALSE; + bool supported = false; pa_assert(u); for (i = 0; u->rates[i]; i++) { if (u->rates[i] == rate) { - supported = TRUE; + supported = true; break; } } if (!supported) { pa_log_info("Sink does not support sample rate of %d Hz", rate); - return FALSE; + return false; } if (!PA_SINK_IS_OPENED(s->state)) { pa_log_info("Updating rate for device %s, new rate is %d",u->device_name, rate); u->sink->sample_spec.rate = rate; - return TRUE; + return true; } - return FALSE; + return false; } 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_sink_process_rewind(u->sink, rewind_nbytes); - u->after_rewind = TRUE; + u->after_rewind = true; return 0; } } else @@ -1727,7 +1727,7 @@ static void thread_func(void *userdata) { if (PA_SINK_IS_OPENED(u->sink->thread_info.state)) { int work_done; 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) 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."); 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); @@ -1789,7 +1789,7 @@ static void thread_func(void *userdata) { 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); /* 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; 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) goto fail; - u->first = TRUE; + u->first = true; u->since_start = 0; revents = 0; } 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))) { pa_sink_new_data_set_name(data, n); - data->namereg_fail = TRUE; + data->namereg_fail = true; return; } if ((n = pa_modargs_get_value(ma, "name", NULL))) - data->namereg_fail = TRUE; + data->namereg_fail = true; else { n = device_id ? device_id : device_name; - data->namereg_fail = FALSE; + data->namereg_fail = false; } 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); } -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; if (!mapping && !element) @@ -1940,8 +1940,8 @@ fail: } } -static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { - pa_bool_t need_mixer_callback = FALSE; +static int setup_mixer(struct userdata *u, bool ignore_dB) { + bool need_mixer_callback = false; 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) { if (p->has_volume || p->has_mute) - need_mixer_callback = TRUE; + need_mixer_callback = true; } } 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; snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames; 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_alsa_profile_set *profile_set = 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->deferred_volume = deferred_volume; u->fixed_latency_range = fixed_latency_range; - u->first = TRUE; + u->first = true; u->rewind_safeguard = rewind_safeguard; u->rtpoll = pa_rtpoll_new(); 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( SMOOTHER_ADJUST_USEC, SMOOTHER_WINDOW_USEC, - TRUE, - TRUE, + true, + true, 5, pa_rtclock_now(), - TRUE); + true); u->smoother_interval = SMOOTHER_MIN_INTERVAL; /* 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, SND_PCM_STREAM_PLAYBACK, &period_frames, &buffer_frames, tsched_frames, - &b, &d, FALSE))) + &b, &d, false))) 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) { 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)) { 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) @@ -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)) - set_formats = TRUE; + set_formats = true; u->rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate); 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) - 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) 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) { 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 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; 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; } else if (setup_mixer(u, ignore_dB) < 0) goto fail; diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index 6a53c4b53..3d5601374 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -123,9 +123,9 @@ struct userdata { char *device_name; /* name of the PCM 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; @@ -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); - 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_OK; @@ -420,14 +420,14 @@ static int try_recover(struct userdata *u, const char *call, int err) { return -1; } - u->first = TRUE; + u->first = true; 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 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 * 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! */ left_to_record = 0; - overrun = TRUE; + overrun = true; #ifdef DEBUG_TIMING 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 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) increase_watermark(u); 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 * 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; } -static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled, pa_bool_t on_timeout) { - pa_bool_t work_done = FALSE; +static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bool on_timeout) { + bool work_done = false; pa_usec_t max_sleep_usec = 0, process_usec = 0; size_t left_to_record; 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; size_t n_bytes; 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)) { @@ -510,7 +510,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled #endif left_to_record = check_left_to_record(u, n_bytes, on_timeout); - on_timeout = FALSE; + on_timeout = false; if (u->use_tsched) if (!polled && @@ -547,7 +547,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled break; } - polled = FALSE; + polled = false; #ifdef DEBUG_TIMING 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; pa_assert(frames > 0); - after_avail = FALSE; + after_avail = false; /* Check these are multiples of 8 bit */ 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); - 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.index = 0; @@ -610,7 +610,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled return r; } - work_done = TRUE; + work_done = true; 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; } -static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled, pa_bool_t on_timeout) { - int work_done = FALSE; +static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bool on_timeout) { + int work_done = false; pa_usec_t max_sleep_usec = 0, process_usec = 0; size_t left_to_record; 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; size_t n_bytes; 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)) { @@ -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; left_to_record = check_left_to_record(u, n_bytes, on_timeout); - on_timeout = FALSE; + on_timeout = false; if (u->use_tsched) if (!polled && @@ -696,7 +696,7 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled break; } - polled = FALSE; + polled = false; for (;;) { 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); - after_avail = FALSE; + after_avail = false; chunk.index = 0; 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_memblock_unref(chunk.memblock); - work_done = TRUE; + work_done = true; u->read_count += frames * u->frame_size; @@ -783,7 +783,7 @@ static void update_smoother(struct userdata *u) { /* 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)); 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 */ 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->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) { pa_sample_spec ss; int err; - pa_bool_t b, d; + bool b, d; snd_pcm_uframes_t period_size, buffer_size; pa_assert(u); @@ -972,7 +972,7 @@ static int unsuspend(struct userdata *u) { b = u->use_mmap; 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)); goto fail; } @@ -1004,15 +1004,15 @@ static int unsuspend(struct userdata *u) { /* FIXME: We need to reload the volume somehow */ 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->last_smoother_update = 0; - u->first = TRUE; + u->first = true; /* reset the watermark to the value defined when source was created */ 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..."); @@ -1120,13 +1120,13 @@ static int ctl_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) { return 0; 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; } if (mask & SND_CTL_EVENT_MASK_VALUE) { - pa_source_get_volume(u->source, TRUE); - pa_source_get_mute(u->source, TRUE); + pa_source_get_volume(u->source, true); + pa_source_get_mute(u->source, true); } return 0; @@ -1142,7 +1142,7 @@ static int io_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) { return 0; 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; } @@ -1189,7 +1189,7 @@ static void source_set_volume_cb(pa_source *s) { struct userdata *u = s->userdata; pa_cvolume r; 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->mixer_path); @@ -1208,7 +1208,7 @@ static void source_set_volume_cb(pa_source *s) { if (u->mixer_path->has_dB) { pa_cvolume new_soft_volume; - pa_bool_t accurate_enough; + bool accurate_enough; char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX]; /* 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 */ 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"); else { pa_cvolume tmp_vol; - pa_bool_t accurate_enough; + bool accurate_enough; /* Shift down by the base volume, so that 0dB becomes maximum 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) { struct userdata *u = s->userdata; - pa_bool_t b; + bool b; pa_assert(u); 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); 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); 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)); } 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); 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(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) { @@ -1409,32 +1409,32 @@ static void source_update_requested_latency_cb(pa_source *s) { 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; int i; - pa_bool_t supported = FALSE; + bool supported = false; pa_assert(u); for (i = 0; u->rates[i]; i++) { if (u->rates[i] == rate) { - supported = TRUE; + supported = true; break; } } if (!supported) { pa_log_info("Source does not support sample rate of %d Hz", rate); - return FALSE; + return false; } if (!PA_SOURCE_IS_OPENED(s->state)) { pa_log_info("Updating rate for device %s, new rate is %d", u->device_name, rate); u->source->sample_spec.rate = rate; - return TRUE; + return true; } - return FALSE; + return false; } 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)) { int work_done; 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) { pa_log_info("Starting capture."); 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) @@ -1524,7 +1524,7 @@ static void thread_func(void *userdata) { pa_rtpoll_set_timer_disabled(u->rtpoll); /* 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; 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) goto fail; - u->first = TRUE; + u->first = true; revents = 0; } else if (revents && u->use_tsched && pa_log_ratelimit(PA_LOG_DEBUG)) 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))) { pa_source_new_data_set_name(data, n); - data->namereg_fail = TRUE; + data->namereg_fail = true; return; } if ((n = pa_modargs_get_value(ma, "name", NULL))) - data->namereg_fail = TRUE; + data->namereg_fail = true; else { n = device_id ? device_id : device_name; - data->namereg_fail = FALSE; + data->namereg_fail = false; } if (mapping) @@ -1612,7 +1612,7 @@ static void set_source_name(pa_source_new_data *data, pa_modargs *ma, const char 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; if (!mapping && !element) @@ -1651,8 +1651,8 @@ fail: } } -static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { - pa_bool_t need_mixer_callback = FALSE; +static int setup_mixer(struct userdata *u, bool ignore_dB) { + bool need_mixer_callback = false; 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) { if (p->has_volume || p->has_mute) - need_mixer_callback = TRUE; + need_mixer_callback = true; } } 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; snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames; 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_alsa_profile_set *profile_set = 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->deferred_volume = deferred_volume; u->fixed_latency_range = fixed_latency_range; - u->first = TRUE; + u->first = true; u->rtpoll = pa_rtpoll_new(); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); u->smoother = pa_smoother_new( SMOOTHER_ADJUST_USEC, SMOOTHER_WINDOW_USEC, - TRUE, - TRUE, + true, + true, 5, pa_rtclock_now(), - TRUE); + true); u->smoother_interval = SMOOTHER_MIN_INTERVAL; /* use ucm */ @@ -1895,7 +1895,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p &ss, &map, SND_PCM_STREAM_CAPTURE, &period_frames, &buffer_frames, tsched_frames, - &b, &d, FALSE))) + &b, &d, false))) 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) { 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)) { 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) @@ -1989,7 +1989,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p } 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) 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) { 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 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; 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; } else if (setup_mixer(u, ignore_dB) < 0) goto fail; diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c index bc2ea9b77..677db9947 100644 --- a/src/modules/alsa/alsa-ucm.c +++ b/src/modules/alsa/alsa-ucm.c @@ -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) { char *sub = NULL, *tmp; - *is_sink = FALSE; + *is_sink = false; if (pa_startswith(mod_name, "Play")) { - *is_sink = TRUE; + *is_sink = true; sub = pa_xstrdup(mod_name + 4); } else if (pa_startswith(mod_name, "Capture")) 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) { int i; - bool is_sink = FALSE; + bool is_sink = false; char *sub = NULL; 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; 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); @@ -1203,9 +1203,9 @@ static int ucm_create_mapping( } 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) - 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; } @@ -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->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); /* 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); 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) - 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); @@ -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) { pa_log("Failed to set verb %s", p->name); - p->supported = FALSE; + p->supported = false; 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); if (!m->output_pcm) { - p->supported = FALSE; + p->supported = false; 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); if (!m->input_pcm) { - p->supported = FALSE; + p->supported = false; 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); - ps->probed = TRUE; + ps->probed = true; return ps; } diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c index 168a67884..75f58580a 100644 --- a/src/modules/alsa/alsa-util.c +++ b/src/modules/alsa/alsa-util.c @@ -191,17 +191,17 @@ int pa_alsa_set_hw_params( snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, - pa_bool_t *use_tsched, - pa_bool_t require_exact_channel_number) { + bool *use_mmap, + bool *use_tsched, + bool require_exact_channel_number) { int ret = -1; snd_pcm_hw_params_t *hwparams, *hwparams_copy; int dir; snd_pcm_uframes_t _period_size = period_size ? *period_size : 0; snd_pcm_uframes_t _buffer_size = buffer_size ? *buffer_size : 0; - pa_bool_t _use_mmap = use_mmap && *use_mmap; - pa_bool_t _use_tsched = use_tsched && *use_tsched; + bool _use_mmap = use_mmap && *use_mmap; + bool _use_tsched = use_tsched && *use_tsched; pa_sample_spec _ss = *ss; pa_assert(pcm_handle); @@ -231,7 +231,7 @@ int pa_alsa_set_hw_params( 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) { @@ -240,10 +240,10 @@ int pa_alsa_set_hw_params( } if (!_use_mmap) - _use_tsched = FALSE; + _use_tsched = false; 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 (_use_tsched) { @@ -251,7 +251,7 @@ int pa_alsa_set_hw_params( /* try to disable period wakeups if hardware can do so */ 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 */ pa_log_debug("snd_pcm_hw_params_set_period_wakeup() failed: %s", pa_alsa_strerror(ret)); else @@ -426,7 +426,7 @@ finish: 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_uframes_t boundary; 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 *buffer_size, snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, - pa_bool_t *use_tsched, + bool *use_mmap, + bool *use_tsched, pa_alsa_profile_set *ps, pa_alsa_mapping **mapping) { @@ -578,7 +578,7 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto( tsched_size, use_mmap, use_tsched, - FALSE); + false); pa_xfree(d); 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 *buffer_size, snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, - pa_bool_t *use_tsched, + bool *use_mmap, + bool *use_tsched, pa_alsa_mapping *m) { 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 *buffer_size, snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, - pa_bool_t *use_tsched, - pa_bool_t require_exact_channel_number) { + bool *use_mmap, + bool *use_tsched, + bool require_exact_channel_number) { int err; char *d; snd_pcm_t *pcm_handle; - pa_bool_t reformat = FALSE; + bool reformat = false; pa_assert(device); pa_assert(ss); @@ -688,7 +688,7 @@ snd_pcm_t *pa_alsa_open_by_device_string( require_exact_channel_number)) < 0) { if (!reformat) { - reformat = TRUE; + reformat = true; snd_pcm_close(pcm_handle); continue; @@ -702,7 +702,7 @@ snd_pcm_t *pa_alsa_open_by_device_string( pa_xfree(d); d = t; - reformat = FALSE; + reformat = false; snd_pcm_close(pcm_handle); continue; @@ -741,9 +741,9 @@ snd_pcm_t *pa_alsa_open_by_template( snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, - pa_bool_t *use_tsched, - pa_bool_t require_exact_channel_number) { + bool *use_mmap, + bool *use_tsched, + bool require_exact_channel_number) { snd_pcm_t *pcm_handle; 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; pa_assert(p); if (pa_device_init_description(p)) - return TRUE; + return true; if (!(d = pa_proplist_gets(p, "alsa.card_name"))) d = pa_proplist_gets(p, "alsa.name"); if (!d) - return FALSE; + return false; 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) 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) { @@ -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, - pa_bool_t capture) { + bool capture) { ssize_t k; size_t abs_k; int err; @@ -1333,7 +1333,7 @@ unsigned int *pa_alsa_get_supported_rates(snd_pcm_t *pcm, unsigned int fallback_ 64000, 88200, 96000, 128000, 176400, 192000, 384000 }; - pa_bool_t supported[PA_ELEMENTSOF(all_rates)] = { FALSE, }; + bool supported[PA_ELEMENTSOF(all_rates)] = { false, }; snd_pcm_hw_params_t *hwparams; unsigned int i, j, n, *rates = NULL; 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++) { if (snd_pcm_hw_params_test_rate(pcm, hwparams, all_rates[i], 0) == 0) { - supported[i] = TRUE; + supported[i] = true; n++; } } @@ -1377,26 +1377,26 @@ unsigned int *pa_alsa_get_supported_rates(snd_pcm_t *pcm, unsigned int fallback_ 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_alloca(&info); pa_assert(pcm); if (snd_pcm_info(pcm, info) < 0) - return FALSE; + return false; 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_alloca(&info); pa_assert(pcm); if (snd_pcm_info(pcm, info) < 0) - return FALSE; + return false; return snd_pcm_info_get_class(info) == SND_PCM_CLASS_MODEM; } @@ -1428,26 +1428,26 @@ const char* pa_alsa_strerror(int errnum) { return translated; } -pa_bool_t pa_alsa_may_tsched(pa_bool_t want) { +bool pa_alsa_may_tsched(bool want) { if (!want) - return FALSE; + return false; if (!pa_rtclock_hrtimer()) { /* We cannot depend on being woken up in time when the timers are inaccurate, so let's fallback to classic IO based playback then. */ 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()) { /* We cannot depend on being woken up when we ask for in a VM, * so let's fallback to classic IO based playback then. */ 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) { diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h index 5b0a0bdc3..0520b6b79 100644 --- a/src/modules/alsa/alsa-util.h +++ b/src/modules/alsa/alsa-util.h @@ -41,14 +41,14 @@ int pa_alsa_set_hw_params( snd_pcm_uframes_t *period_size, /* modified at return */ snd_pcm_uframes_t *buffer_size, /* modified at return */ snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, /* modified at return */ - pa_bool_t *use_tsched, /* modified at return */ - pa_bool_t require_exact_channel_number); + bool *use_mmap, /* modified at return */ + bool *use_tsched, /* modified at return */ + bool require_exact_channel_number); int pa_alsa_set_sw_params( snd_pcm_t *pcm, 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 */ 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 *buffer_size, /* modified at return */ snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, /* modified at return */ - pa_bool_t *use_tsched, /* modified at return */ + bool *use_mmap, /* modified at return */ + bool *use_tsched, /* modified at return */ pa_alsa_profile_set *ps, 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 *buffer_size, /* modified at return */ snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, /* modified at return */ - pa_bool_t *use_tsched, /* modified at return */ + bool *use_mmap, /* modified at return */ + bool *use_tsched, /* modified at return */ pa_alsa_mapping *mapping); /* 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 *buffer_size, /* modified at return */ snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, /* modified at return */ - pa_bool_t *use_tsched, /* modified at return */ - pa_bool_t require_exact_channel_number); + bool *use_mmap, /* modified at return */ + bool *use_tsched, /* modified at return */ + bool require_exact_channel_number); /* Opens the explicit ALSA device with a fallback list */ 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 *buffer_size, /* modified at return */ snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, /* modified at return */ - pa_bool_t *use_tsched, /* modified at return */ - pa_bool_t require_exact_channel_number); + bool *use_mmap, /* modified at return */ + bool *use_tsched, /* modified at return */ + bool require_exact_channel_number); void pa_alsa_dump(pa_log_level_t level, 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_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm); 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); 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); -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); 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); -pa_bool_t 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_hw(snd_pcm_t *pcm); +bool pa_alsa_pcm_is_modem(snd_pcm_t *pcm); 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_eld_ctl(snd_hctl_t *hctl, int device); diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c index e5da45491..f4fb77f8d 100644 --- a/src/modules/alsa/module-alsa-card.c +++ b/src/modules/alsa/module-alsa-card.c @@ -45,7 +45,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("ALSA Card"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "name=<name for the card/sink/source, to be prefixed> " "card_name=<name for the card> " @@ -122,7 +122,7 @@ struct userdata { pa_alsa_profile_set *profile_set; /* ucm stuffs */ - pa_bool_t use_ucm; + bool use_ucm; pa_alsa_ucm_config ucm; /* 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) { 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 pa_alsa_path_set_add_ports(m->output_path_set, cp, ports, NULL, u->core); 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) { 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 pa_alsa_path_set_add_ports(m->input_path_set, cp, ports, NULL, u->core); 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); 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; } } @@ -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); 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; } } @@ -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) { struct userdata *u = snd_hctl_elem_get_callback_private(elem); snd_ctl_elem_value_t *elem_value; - pa_bool_t plugged_in; + bool plugged_in; void *state; pa_alsa_jack *jack; 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); if (!jack->hctl_elem) { pa_log_warn("Jack '%s' seems to have disappeared.", jack->alsa_name); - jack->has_control = FALSE; + jack->has_control = false; continue; } 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))) { pa_card_new_data_set_name(data, n); - data->namereg_fail = TRUE; + data->namereg_fail = true; return; } if ((n = pa_modargs_get_value(ma, "name", NULL))) - data->namereg_fail = TRUE; + data->namereg_fail = true; else { n = device_id; - data->namereg_fail = FALSE; + data->namereg_fail = false; } 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) { pa_card_new_data data; pa_modargs *ma; - pa_bool_t ignore_dB = FALSE; + bool ignore_dB = false; struct userdata *u; pa_reserve_wrapper *reserve = NULL; const char *description; const char *profile = NULL; char *fn = NULL; - pa_bool_t namereg_fail = FALSE; + bool namereg_fail = false; 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->modargs = ma; - u->use_ucm = TRUE; + u->use_ucm = true; u->ucm.core = m->core; 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); } else { - u->use_ucm = FALSE; + u->use_ucm = false; #ifdef HAVE_UDEV fn = pa_udev_get_property(u->alsa_card_index, "PULSE_PROFILE_SET"); #endif diff --git a/src/modules/alsa/module-alsa-sink.c b/src/modules/alsa/module-alsa-sink.c index 927f075ac..fdcb5cfd6 100644 --- a/src/modules/alsa/module-alsa-sink.c +++ b/src/modules/alsa/module-alsa-sink.c @@ -35,7 +35,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("ALSA Sink"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "name=<name of the sink, to be prefixed> " "sink_name=<name for the sink> " diff --git a/src/modules/alsa/module-alsa-source.c b/src/modules/alsa/module-alsa-source.c index efb2d0c53..7c8ace4e8 100644 --- a/src/modules/alsa/module-alsa-source.c +++ b/src/modules/alsa/module-alsa-source.c @@ -44,7 +44,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("ALSA Source"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "name=<name for the source, to be prefixed> " "source_name=<name for the source> " |