core: Internally deprecate pa_port_available_t to use pa_available_t

Generalize the availability flag in order to be used beyond the scope of
ports.

However, pa_port_availability_t is left unchanged to avoid modifying the
protocol and the client API. This should be replaced by pa_available_t
after a validation phase of this new generic enum type.
This commit is contained in:
Mikel Astiz 2013-02-18 16:13:24 +01:00 committed by Tanu Kaskinen
parent 3aefdd995c
commit 8851644a3c
12 changed files with 68 additions and 58 deletions

View file

@ -1753,8 +1753,8 @@ static pa_alsa_jack* jack_get(pa_alsa_path *p, const char *section) {
goto finish;
j = pa_xnew0(pa_alsa_jack, 1);
j->state_unplugged = PA_PORT_AVAILABLE_NO;
j->state_plugged = PA_PORT_AVAILABLE_YES;
j->state_unplugged = PA_AVAILABLE_NO;
j->state_plugged = PA_AVAILABLE_YES;
j->path = p;
j->name = pa_xstrdup(section);
j->alsa_name = pa_sprintf_malloc("%s Jack", section);
@ -2167,7 +2167,7 @@ static int element_parse_override_map(pa_config_parser_state *state) {
static int jack_parse_state(pa_config_parser_state *state) {
pa_alsa_path *p;
pa_alsa_jack *j;
pa_port_available_t pa;
pa_available_t pa;
pa_assert(state);
@ -2179,11 +2179,11 @@ static int jack_parse_state(pa_config_parser_state *state) {
}
if (pa_streq(state->rvalue, "yes"))
pa = PA_PORT_AVAILABLE_YES;
pa = PA_AVAILABLE_YES;
else if (pa_streq(state->rvalue, "no"))
pa = PA_PORT_AVAILABLE_NO;
pa = PA_AVAILABLE_NO;
else if (pa_streq(state->rvalue, "unknown"))
pa = PA_PORT_AVAILABLE_UNKNOWN;
pa = PA_AVAILABLE_UNKNOWN;
else {
pa_log("[%s:%u] state must be 'yes', 'no' or 'unknown' in '%s'", state->filename, state->lineno, state->section);
return -1;

View file

@ -165,7 +165,7 @@ struct pa_alsa_jack {
pa_bool_t has_control; /* is the jack itself present? */
pa_bool_t plugged_in; /* is this jack currently plugged in? */
snd_hctl_elem_t *hctl_elem; /* Jack detection handle */
pa_port_available_t state_unplugged, state_plugged;
pa_available_t state_unplugged, state_plugged;
pa_alsa_required_t required;
pa_alsa_required_t required_any;

View file

@ -1216,8 +1216,8 @@ static pa_alsa_jack* ucm_get_jack(pa_alsa_ucm_config *ucm, const char *dev_name,
goto out;
j = pa_xnew0(pa_alsa_jack, 1);
j->state_unplugged = PA_PORT_AVAILABLE_NO;
j->state_plugged = PA_PORT_AVAILABLE_YES;
j->state_unplugged = PA_AVAILABLE_NO;
j->state_plugged = PA_AVAILABLE_YES;
j->name = pa_xstrdup(name);
j->alsa_name = pa_sprintf_malloc("%s Jack", dev_name);

View file

@ -313,11 +313,11 @@ static void report_port_state(pa_device_port *p, struct userdata *u)
{
void *state;
pa_alsa_jack *jack;
pa_port_available_t pa = PA_PORT_AVAILABLE_UNKNOWN;
pa_available_t pa = PA_AVAILABLE_UNKNOWN;
pa_device_port *port;
PA_HASHMAP_FOREACH(jack, u->jacks, state) {
pa_port_available_t cpa;
pa_available_t cpa;
if (u->use_ucm)
port = pa_hashmap_get(u->card->ports, jack->name);
@ -334,11 +334,11 @@ static void report_port_state(pa_device_port *p, struct userdata *u)
cpa = jack->plugged_in ? jack->state_plugged : jack->state_unplugged;
/* "Yes" and "no" trumphs "unknown" if we have more than one jack */
if (cpa == PA_PORT_AVAILABLE_UNKNOWN)
if (cpa == PA_AVAILABLE_UNKNOWN)
continue;
if ((cpa == PA_PORT_AVAILABLE_NO && pa == PA_PORT_AVAILABLE_YES) ||
(pa == PA_PORT_AVAILABLE_NO && cpa == PA_PORT_AVAILABLE_YES))
if ((cpa == PA_AVAILABLE_NO && pa == PA_AVAILABLE_YES) ||
(pa == PA_AVAILABLE_NO && cpa == PA_AVAILABLE_YES))
pa_log_warn("Availability of port '%s' is inconsistent!", p->name);
else
pa = cpa;