card: Create pa_available_to_string
authorJoão Paulo Rechi Vita <jprvita@endlessm.com>
Mon, 13 Aug 2018 19:19:41 +0000 (12:19 -0700)
committerArun Raghavan <arun@arunraghavan.net>
Thu, 11 Oct 2018 13:08:41 +0000 (13:08 +0000)
Add a new function to the card API that returns the string
representation of a pa_available_t variable.

src/pulsecore/card.c
src/pulsecore/card.h

index bc5b75b..4305eb4 100644 (file)
 
 #include "card.h"
 
+const char *pa_available_to_string(pa_available_t available) {
+    switch (available) {
+        case PA_AVAILABLE_UNKNOWN:
+            return "unknown";
+        case PA_AVAILABLE_NO:
+            return "no";
+        case PA_AVAILABLE_YES:
+            return "yes";
+        default:
+            pa_assert_not_reached();
+    }
+}
+
 pa_card_profile *pa_card_profile_new(const char *name, const char *description, size_t extra) {
     pa_card_profile *c;
 
index 09284f6..a11e33d 100644 (file)
@@ -113,6 +113,8 @@ typedef struct {
     pa_direction_t direction;
 } pa_card_preferred_port_changed_hook_data;
 
+const char *pa_available_to_string(pa_available_t available);
+
 pa_card_profile *pa_card_profile_new(const char *name, const char *description, size_t extra);
 void pa_card_profile_free(pa_card_profile *c);