[pulseaudio-discuss] [RFC v1 1/6] core: Rename pa_available_t to pa_available_t

Mikel Astiz mikel.astiz.oss at gmail.com
Mon Feb 18 00:10:30 PST 2013


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

Generalize the availability flag in order to be used beyond the scope of
ports.
---
 src/modules/alsa/alsa-mixer.c                   | 12 ++++----
 src/modules/alsa/alsa-mixer.h                   |  2 +-
 src/modules/alsa/alsa-ucm.c                     |  4 +--
 src/modules/alsa/module-alsa-card.c             | 10 +++----
 src/modules/bluetooth/module-bluetooth-device.c | 40 ++++++++++++-------------
 src/modules/bluetooth/module-bluetooth-policy.c |  6 ++--
 src/modules/module-switch-on-port-available.c   | 20 ++++++-------
 src/pulse/def.h                                 | 18 +++++------
 src/pulse/introspect.c                          | 10 +++----
 src/pulse/introspect.h                          |  6 ++--
 src/pulsecore/cli-text.c                        |  8 ++---
 src/pulsecore/device-port.c                     | 10 +++----
 src/pulsecore/device-port.h                     |  4 +--
 src/utils/pactl.c                               |  4 +--
 14 files changed, 77 insertions(+), 77 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 97f25af..f2e68d3 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -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;
diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h
index 2e3c115..5b710a3 100644
--- a/src/modules/alsa/alsa-mixer.h
+++ b/src/modules/alsa/alsa-mixer.h
@@ -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;
diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index e01721f..f69ee89 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -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);
 
diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index 3f5af34..f5e1c9e 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -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;
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 776bcba..9fa768a 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1191,23 +1191,23 @@ finish:
     pa_log_debug("IO thread shutting down");
 }
 
-static pa_port_available_t transport_state_to_availability(pa_bluetooth_transport_state_t state) {
+static pa_available_t transport_state_to_availability(pa_bluetooth_transport_state_t state) {
     if (state == PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)
-        return PA_PORT_AVAILABLE_NO;
+        return PA_AVAILABLE_NO;
     else if (state >= PA_BLUETOOTH_TRANSPORT_STATE_PLAYING)
-        return PA_PORT_AVAILABLE_YES;
+        return PA_AVAILABLE_YES;
     else
-        return PA_PORT_AVAILABLE_UNKNOWN;
+        return PA_AVAILABLE_UNKNOWN;
 }
 
-static pa_port_available_t transport_state_to_availability_merged(pa_bluetooth_transport_state_t state1,
+static pa_available_t transport_state_to_availability_merged(pa_bluetooth_transport_state_t state1,
                                                                   pa_bluetooth_transport_state_t state2) {
     if (state1 == PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED && state2 == PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)
-        return PA_PORT_AVAILABLE_NO;
+        return PA_AVAILABLE_NO;
     else if (state1 >= PA_BLUETOOTH_TRANSPORT_STATE_PLAYING || state2 >= PA_BLUETOOTH_TRANSPORT_STATE_PLAYING)
-        return PA_PORT_AVAILABLE_YES;
+        return PA_AVAILABLE_YES;
     else
-        return PA_PORT_AVAILABLE_UNKNOWN;
+        return PA_AVAILABLE_UNKNOWN;
 }
 
 /* Run from main thread */
@@ -1229,7 +1229,7 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot
     switch (profile) {
         case PROFILE_HFGW: {
             pa_device_port *port;
-            pa_port_available_t available = transport_state_to_availability(state);
+            pa_available_t available = transport_state_to_availability(state);
 
             pa_assert_se(port = pa_hashmap_get(u->card->ports, "hfgw-output"));
             pa_device_port_set_available(port, available);
@@ -1237,15 +1237,15 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot
             pa_assert_se(port = pa_hashmap_get(u->card->ports, "hfgw-input"));
             pa_device_port_set_available(port, available);
 
-            acquire = (available == PA_PORT_AVAILABLE_YES && u->profile == PROFILE_HFGW);
-            release = (available != PA_PORT_AVAILABLE_YES && u->profile == PROFILE_HFGW);
+            acquire = (available == PA_AVAILABLE_YES && u->profile == PROFILE_HFGW);
+            release = (available != PA_AVAILABLE_YES && u->profile == PROFILE_HFGW);
 
             break;
         }
 
         case PROFILE_HSP: {
             pa_device_port *port;
-            pa_port_available_t available;
+            pa_available_t available;
             pa_bluetooth_transport *other = u->device->transports[PROFILE_A2DP];
 
             if (!other)
@@ -1259,28 +1259,28 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot
             pa_assert_se(port = pa_hashmap_get(u->card->ports, "hsp-input"));
             pa_device_port_set_available(port, available);
 
-            acquire = (available == PA_PORT_AVAILABLE_YES && u->profile == PROFILE_HSP);
-            release = (available != PA_PORT_AVAILABLE_YES && u->profile == PROFILE_HSP);
+            acquire = (available == PA_AVAILABLE_YES && u->profile == PROFILE_HSP);
+            release = (available != PA_AVAILABLE_YES && u->profile == PROFILE_HSP);
 
             break;
         }
 
         case PROFILE_A2DP_SOURCE: {
             pa_device_port *port;
-            pa_port_available_t available = transport_state_to_availability(state);
+            pa_available_t available = transport_state_to_availability(state);
 
             pa_assert_se(port = pa_hashmap_get(u->card->ports, "a2dp-input"));
             pa_device_port_set_available(port, available);
 
-            acquire = (available == PA_PORT_AVAILABLE_YES && u->profile == PROFILE_A2DP_SOURCE);
-            release = (available != PA_PORT_AVAILABLE_YES && u->profile == PROFILE_A2DP_SOURCE);
+            acquire = (available == PA_AVAILABLE_YES && u->profile == PROFILE_A2DP_SOURCE);
+            release = (available != PA_AVAILABLE_YES && u->profile == PROFILE_A2DP_SOURCE);
 
             break;
         }
 
         case PROFILE_A2DP: {
             pa_device_port *port;
-            pa_port_available_t available;
+            pa_available_t available;
             pa_bluetooth_transport *other = u->device->transports[PROFILE_HSP];
 
             if (!other)
@@ -1291,8 +1291,8 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot
             pa_assert_se(port = pa_hashmap_get(u->card->ports, "bluetooth-output"));
             pa_device_port_set_available(port, available);
 
-            acquire = (available == PA_PORT_AVAILABLE_YES && u->profile == PROFILE_A2DP);
-            release = (available != PA_PORT_AVAILABLE_YES && u->profile == PROFILE_A2DP);
+            acquire = (available == PA_AVAILABLE_YES && u->profile == PROFILE_A2DP);
+            release = (available != PA_AVAILABLE_YES && u->profile == PROFILE_A2DP);
 
             break;
         }
diff --git a/src/modules/bluetooth/module-bluetooth-policy.c b/src/modules/bluetooth/module-bluetooth-policy.c
index fc605b3..f53a422 100644
--- a/src/modules/bluetooth/module-bluetooth-policy.c
+++ b/src/modules/bluetooth/module-bluetooth-policy.c
@@ -139,7 +139,7 @@ static pa_device_port* find_best_port(pa_hashmap *ports) {
     pa_device_port *result = NULL;
 
     PA_HASHMAP_FOREACH(port, ports, state) {
-        if (port->available != PA_PORT_AVAILABLE_YES)
+        if (port->available != PA_AVAILABLE_YES)
             continue;
 
         if (result == NULL || port->priority > result->priority)
@@ -193,10 +193,10 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
 
     is_active_profile = card->active_profile == pa_hashmap_get(port->profiles, card->active_profile->name);
 
-    if (is_active_profile && port->available == PA_PORT_AVAILABLE_YES)
+    if (is_active_profile && port->available == PA_AVAILABLE_YES)
         return PA_HOOK_OK;
 
-    if (!is_active_profile && port->available != PA_PORT_AVAILABLE_YES)
+    if (!is_active_profile && port->available != PA_AVAILABLE_YES)
         return PA_HOOK_OK;
 
     if ((port2 = find_best_port(card->ports)) == NULL)
diff --git a/src/modules/module-switch-on-port-available.c b/src/modules/module-switch-on-port-available.c
index 1da612d..9b2029b 100644
--- a/src/modules/module-switch-on-port-available.c
+++ b/src/modules/module-switch-on-port-available.c
@@ -40,8 +40,8 @@ static pa_device_port* find_best_port(pa_hashmap *ports) {
 
     PA_HASHMAP_FOREACH(port, ports, state) {
         if (result == NULL ||
-            result->available == PA_PORT_AVAILABLE_NO ||
-            (port->available != PA_PORT_AVAILABLE_NO && port->priority > result->priority)) {
+            result->available == PA_AVAILABLE_NO ||
+            (port->available != PA_AVAILABLE_NO && port->priority > result->priority)) {
             result = port;
         }
     }
@@ -85,7 +85,7 @@ static pa_bool_t try_to_switch_profile(pa_card *card, pa_device_port *port) {
             PA_IDXSET_FOREACH(sink, card->sinks, state2) {
                 if (!sink->active_port)
                     continue;
-                if (sink->active_port->available != PA_PORT_AVAILABLE_NO)
+                if (sink->active_port->available != PA_AVAILABLE_NO)
                     found_active_port = TRUE;
             }
 
@@ -136,7 +136,7 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
     pa_source *source;
     pa_bool_t is_active_profile, is_active_port;
 
-    if (port->available == PA_PORT_AVAILABLE_UNKNOWN)
+    if (port->available == PA_AVAILABLE_UNKNOWN)
         return PA_HOOK_OK;
 
     pa_log_debug("finding port %s", port->name);
@@ -155,10 +155,10 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
     is_active_profile = card->active_profile == pa_hashmap_get(port->profiles, card->active_profile->name);
     is_active_port = (sink && sink->active_port == port) || (source && source->active_port == port);
 
-    if (port->available == PA_PORT_AVAILABLE_NO && !is_active_port)
+    if (port->available == PA_AVAILABLE_NO && !is_active_port)
         return PA_HOOK_OK;
 
-    if (port->available == PA_PORT_AVAILABLE_YES) {
+    if (port->available == PA_AVAILABLE_YES) {
         if (is_active_port)
             return PA_HOOK_OK;
 
@@ -178,11 +178,11 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
             pa_sink_set_port(sink, port->name, FALSE);
     }
 
-    if (port->available == PA_PORT_AVAILABLE_NO) {
+    if (port->available == PA_AVAILABLE_NO) {
         if (sink) {
             pa_device_port *p2 = find_best_port(sink->ports);
 
-            if (p2 && p2->available != PA_PORT_AVAILABLE_NO)
+            if (p2 && p2->available != PA_AVAILABLE_NO)
                 pa_sink_set_port(sink, p2->name, FALSE);
             else {
                 /* Maybe try to switch to another profile? */
@@ -192,7 +192,7 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
         if (source) {
             pa_device_port *p2 = find_best_port(source->ports);
 
-            if (p2 && p2->available != PA_PORT_AVAILABLE_NO)
+            if (p2 && p2->available != PA_AVAILABLE_NO)
                 pa_source_set_port(source, p2->name, FALSE);
             else {
                 /* Maybe try to switch to another profile? */
@@ -212,7 +212,7 @@ static void handle_all_unavailable(pa_core *core) {
         void *state2;
 
         PA_HASHMAP_FOREACH(port, card->ports, state2) {
-            if (port->available == PA_PORT_AVAILABLE_NO)
+            if (port->available == PA_AVAILABLE_NO)
                 port_available_hook_callback(core, port, NULL);
         }
     }
diff --git a/src/pulse/def.h b/src/pulse/def.h
index b939319..9067277 100644
--- a/src/pulse/def.h
+++ b/src/pulse/def.h
@@ -991,18 +991,18 @@ typedef void (*pa_free_cb_t)(void *p);
  * playback, \since 1.0 */
 #define PA_STREAM_EVENT_FORMAT_LOST "format-lost"
 
-/** Port availability / jack detection status
+/** Availability flag (i.e. jack detection status)
  * \since 2.0 */
-typedef enum pa_port_available {
-    PA_PORT_AVAILABLE_UNKNOWN = 0, /**< This port does not support jack detection \since 2.0 */
-    PA_PORT_AVAILABLE_NO = 1,      /**< This port is not available, likely because the jack is not plugged in. \since 2.0 */
-    PA_PORT_AVAILABLE_YES = 2,     /**< This port is available, likely because the jack is plugged in. \since 2.0 */
-} pa_port_available_t;
+typedef enum pa_available {
+    PA_AVAILABLE_UNKNOWN = 0, /**< Not supported or information not available \since 2.0 */
+    PA_AVAILABLE_NO = 1,      /**< Not available (i.e. with ports, likely because the jack is not plugged in) \since 2.0 */
+    PA_AVAILABLE_YES = 2,     /**< Available (i.e. with ports, likely because the jack is plugged in) \since 2.0 */
+} pa_available_t;
 
 /** \cond fulldocs */
-#define PA_PORT_AVAILABLE_UNKNOWN PA_PORT_AVAILABLE_UNKNOWN
-#define PA_PORT_AVAILABLE_NO PA_PORT_AVAILABLE_NO
-#define PA_PORT_AVAILABLE_YES PA_PORT_AVAILABLE_YES
+#define PA_AVAILABLE_UNKNOWN PA_AVAILABLE_UNKNOWN
+#define PA_AVAILABLE_NO PA_AVAILABLE_NO
+#define PA_AVAILABLE_YES PA_AVAILABLE_YES
 
 /** \endcond */
 
diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index 9ca3fd3..71d4166 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -213,10 +213,10 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
                             goto fail;
                         }
 
-                        i.ports[j]->available = PA_PORT_AVAILABLE_UNKNOWN;
+                        i.ports[j]->available = PA_AVAILABLE_UNKNOWN;
                         if (o->context->version >= 24) {
                             uint32_t av;
-                            if (pa_tagstruct_getu32(t, &av) < 0 || av > PA_PORT_AVAILABLE_YES)
+                            if (pa_tagstruct_getu32(t, &av) < 0 || av > PA_AVAILABLE_YES)
                                 goto fail;
                             i.ports[j]->available = av;
                         }
@@ -486,10 +486,10 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
                             goto fail;
                         }
 
-                        i.ports[j]->available = PA_PORT_AVAILABLE_UNKNOWN;
+                        i.ports[j]->available = PA_AVAILABLE_UNKNOWN;
                         if (o->context->version >= 24) {
                             uint32_t av;
-                            if (pa_tagstruct_getu32(t, &av) < 0 || av > PA_PORT_AVAILABLE_YES)
+                            if (pa_tagstruct_getu32(t, &av) < 0 || av > PA_AVAILABLE_YES)
                                 goto fail;
                             i.ports[j]->available = av;
                         }
@@ -818,7 +818,7 @@ static int fill_card_port_info(pa_context *context, pa_tagstruct* t, pa_card_inf
             return -PA_ERR_PROTOCOL;
         }
 
-        if (available > PA_PORT_AVAILABLE_YES ||
+        if (available > PA_AVAILABLE_YES ||
             direction > PA_DIRECTION_OUTPUT + PA_DIRECTION_INPUT) {
 
             return -PA_ERR_PROTOCOL;
diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
index a833471..2663520 100644
--- a/src/pulse/introspect.h
+++ b/src/pulse/introspect.h
@@ -202,7 +202,7 @@ typedef struct pa_sink_port_info {
     const char *name;                   /**< Name of this port */
     const char *description;            /**< Description of this port */
     uint32_t priority;                  /**< The higher this value is, the more useful this port is as a default. */
-    int available;                      /**< A flags (see #pa_port_available), indicating availability status of this port. \since 2.0 */
+    int available;                      /**< A flags (see #pa_available), indicating availability status of this port. \since 2.0 */
 } pa_sink_port_info;
 
 /** Stores information about sinks. Please note that this structure
@@ -282,7 +282,7 @@ typedef struct pa_source_port_info {
     const char *name;                   /**< Name of this port */
     const char *description;            /**< Description of this port */
     uint32_t priority;                  /**< The higher this value is, the more useful this port is as a default. */
-    int available;                      /**< A flags (see #pa_port_available), indicating availability status of this port. \since 2.0 */
+    int available;                      /**< A flags (see #pa_available), indicating availability status of this port. \since 2.0 */
 } pa_source_port_info;
 
 /** Stores information about sources. Please note that this structure
@@ -461,7 +461,7 @@ typedef struct pa_card_port_info {
     const char *name;                   /**< Name of this port */
     const char *description;            /**< Description of this port */
     uint32_t priority;                  /**< The higher this value is, the more useful this port is as a default. */
-    int available;                      /**< A #pa_port_available enum, indicating availability status of this port. */
+    int available;                      /**< A #pa_available enum, indicating availability status of this port. */
     int direction;                      /**< A #pa_direction enum, indicating the direction of this port. */
     uint32_t n_profiles;                /**< Number of entries in profile array */
     pa_card_profile_info** profiles;    /**< Array of pointers to available profiles, or NULL. Array is terminated by an entry set to NULL. */
diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c
index 238fbd8..c4e0b37 100644
--- a/src/pulsecore/cli-text.c
+++ b/src/pulsecore/cli-text.c
@@ -103,13 +103,13 @@ char *pa_client_list_to_string(pa_core *c) {
     return pa_strbuf_tostring_free(s);
 }
 
-static const char *port_available_to_string(pa_port_available_t a) {
+static const char *port_available_to_string(pa_available_t a) {
     switch (a) {
-        case PA_PORT_AVAILABLE_UNKNOWN:
+        case PA_AVAILABLE_UNKNOWN:
             return "unknown";
-        case PA_PORT_AVAILABLE_NO:
+        case PA_AVAILABLE_NO:
             return "no";
-        case PA_PORT_AVAILABLE_YES:
+        case PA_AVAILABLE_YES:
             return "yes";
         default:
             return "invalid"; /* Should never happen! */
diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index e0f9560..f16de3a 100644
--- a/src/pulsecore/device-port.c
+++ b/src/pulsecore/device-port.c
@@ -26,7 +26,7 @@
 
 PA_DEFINE_PUBLIC_CLASS(pa_device_port, pa_object);
 
-void pa_device_port_set_available(pa_device_port *p, pa_port_available_t status)
+void pa_device_port_set_available(pa_device_port *p, pa_available_t status)
 {
     pa_core *core;
 
@@ -35,11 +35,11 @@ void pa_device_port_set_available(pa_device_port *p, pa_port_available_t status)
     if (p->available == status)
         return;
 
-/*    pa_assert(status != PA_PORT_AVAILABLE_UNKNOWN); */
+/*    pa_assert(status != PA_AVAILABLE_UNKNOWN); */
 
     p->available = status;
-    pa_log_debug("Setting port %s to status %s", p->name, status == PA_PORT_AVAILABLE_YES ? "yes" :
-       status == PA_PORT_AVAILABLE_NO ? "no" : "unknown");
+    pa_log_debug("Setting port %s to status %s", p->name, status == PA_AVAILABLE_YES ? "yes" :
+       status == PA_AVAILABLE_NO ? "no" : "unknown");
 
     /* Post subscriptions to the card which owns us */
     pa_assert_se(core = p->core);
@@ -79,7 +79,7 @@ pa_device_port *pa_device_port_new(pa_core *c, const char *name, const char *des
     p->core = c;
     p->card = NULL;
     p->priority = 0;
-    p->available = PA_PORT_AVAILABLE_UNKNOWN;
+    p->available = PA_AVAILABLE_UNKNOWN;
     p->profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
     p->is_input = FALSE;
     p->is_output = FALSE;
diff --git a/src/pulsecore/device-port.h b/src/pulsecore/device-port.h
index 40306f5..c0c00cf 100644
--- a/src/pulsecore/device-port.h
+++ b/src/pulsecore/device-port.h
@@ -47,7 +47,7 @@ struct pa_device_port {
     char *description;
 
     unsigned priority;
-    pa_port_available_t available;         /* PA_PORT_AVAILABLE_UNKNOWN, PA_PORT_AVAILABLE_NO or PA_PORT_AVAILABLE_YES */
+    pa_available_t available;         /* PA_AVAILABLE_UNKNOWN, PA_AVAILABLE_NO or PA_AVAILABLE_YES */
 
     pa_proplist *proplist;
     pa_hashmap *profiles; /* Does not own the profiles */
@@ -66,7 +66,7 @@ PA_DECLARE_PUBLIC_CLASS(pa_device_port);
 pa_device_port *pa_device_port_new(pa_core *c, const char *name, const char *description, size_t extra);
 
 /* The port's available status has changed */
-void pa_device_port_set_available(pa_device_port *p, pa_port_available_t available);
+void pa_device_port_set_available(pa_device_port *p, pa_available_t available);
 
 void pa_device_port_set_latency_offset(pa_device_port *p, int64_t offset);
 
diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index 0fb62cb..9bacbb4 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -226,8 +226,8 @@ static void get_server_info_callback(pa_context *c, const pa_server_info *i, voi
 static const char* get_available_str_ynonly(int available)
 {
     switch (available) {
-        case PA_PORT_AVAILABLE_YES: return ", available";
-        case PA_PORT_AVAILABLE_NO: return ", not available";
+        case PA_AVAILABLE_YES: return ", available";
+        case PA_AVAILABLE_NO: return ", not available";
     }
     return "";
 }
-- 
1.8.1



More information about the pulseaudio-discuss mailing list