summaryrefslogtreecommitdiff
path: root/src/pulse
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2020-04-14 20:04:00 +0200
committerTanu Kaskinen <tanuk@iki.fi>2020-06-17 06:06:12 +0000
commitfeee531c2bcc3618b62a7fbb140b80043c680dc4 (patch)
tree4051f989b519d2473f99e64acfe14b079a9b51c9 /src/pulse
parent861836c5f72de32ec0debcf8fc3a76c4e2c014e6 (diff)
downloadpulseaudio-feee531c2bcc3618b62a7fbb140b80043c680dc4.tar.gz
device-port: add type member
The clients might wanna to know for which purpose is the port. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'src/pulse')
-rw-r--r--src/pulse/def.h27
-rw-r--r--src/pulse/introspect.c13
-rw-r--r--src/pulse/introspect.h3
3 files changed, 40 insertions, 3 deletions
diff --git a/src/pulse/def.h b/src/pulse/def.h
index 100df5b5d..2e5a5ec37 100644
--- a/src/pulse/def.h
+++ b/src/pulse/def.h
@@ -1070,6 +1070,33 @@ typedef enum pa_port_available {
/** \endcond */
#endif
+/** Port type. \since 14.0 */
+typedef enum pa_device_port_type {
+ PA_DEVICE_PORT_TYPE_UNKNOWN = 0,
+ PA_DEVICE_PORT_TYPE_AUX = 1,
+ PA_DEVICE_PORT_TYPE_SPEAKER = 2,
+ PA_DEVICE_PORT_TYPE_HEADPHONES = 3,
+ PA_DEVICE_PORT_TYPE_LINE = 4,
+ PA_DEVICE_PORT_TYPE_MIC = 5,
+ PA_DEVICE_PORT_TYPE_HEADSET = 6,
+ PA_DEVICE_PORT_TYPE_HANDSET = 7,
+ PA_DEVICE_PORT_TYPE_EARPIECE = 8,
+ PA_DEVICE_PORT_TYPE_SPDIF = 9,
+ PA_DEVICE_PORT_TYPE_HDMI = 10,
+ PA_DEVICE_PORT_TYPE_TV = 11,
+ PA_DEVICE_PORT_TYPE_RADIO = 12,
+ PA_DEVICE_PORT_TYPE_VIDEO = 13,
+ PA_DEVICE_PORT_TYPE_USB = 14,
+ PA_DEVICE_PORT_TYPE_BLUETOOTH = 15,
+ PA_DEVICE_PORT_TYPE_PORTABLE = 16,
+ PA_DEVICE_PORT_TYPE_HANDSFREE = 17,
+ PA_DEVICE_PORT_TYPE_CAR = 18,
+ PA_DEVICE_PORT_TYPE_HIFI = 19,
+ PA_DEVICE_PORT_TYPE_PHONE = 20,
+ PA_DEVICE_PORT_TYPE_NETWORK = 21,
+ PA_DEVICE_PORT_TYPE_ANALOG = 22,
+} pa_device_port_type_t;
+
PA_C_DECL_END
#endif
diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index 771d680ca..b19c3fd25 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -220,8 +220,10 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
i.ports[j]->available = av;
}
i.ports[j]->available_group = NULL;
+ i.ports[j]->type = PA_DEVICE_PORT_TYPE_UNKNOWN;
if (o->context->version >= 34) {
- if (pa_tagstruct_gets(t, &i.ports[j]->available_group) < 0)
+ if (pa_tagstruct_gets(t, &i.ports[j]->available_group) < 0 ||
+ pa_tagstruct_getu32(t, &i.ports[j]->type) < 0)
goto fail;
}
}
@@ -498,8 +500,10 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
i.ports[j]->available = av;
}
i.ports[j]->available_group = NULL;
+ i.ports[j]->type = PA_DEVICE_PORT_TYPE_UNKNOWN;
if (o->context->version >= 34) {
- if (pa_tagstruct_gets(t, &i.ports[j]->available_group) < 0)
+ if (pa_tagstruct_gets(t, &i.ports[j]->available_group) < 0 ||
+ pa_tagstruct_getu32(t, &i.ports[j]->type))
goto fail;
}
}
@@ -872,8 +876,11 @@ static int fill_card_port_info(pa_context *context, pa_tagstruct* t, pa_card_inf
return -PA_ERR_PROTOCOL;
} else
port->latency_offset = 0;
+
+ port->type = PA_DEVICE_PORT_TYPE_UNKNOWN;
if (context->version >= 34) {
- if (pa_tagstruct_gets(t, &port->available_group) < 0)
+ if (pa_tagstruct_gets(t, &port->available_group) < 0 ||
+ pa_tagstruct_getu32(t, &port->type) < 0)
return -PA_ERR_PROTOCOL;
} else
port->available_group = NULL;
diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
index 2a6e6b436..89685b501 100644
--- a/src/pulse/introspect.h
+++ b/src/pulse/introspect.h
@@ -230,6 +230,7 @@ typedef struct pa_sink_port_info {
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 */
const char *available_group; /**< A string indentifier which determine the group of devices handling the available state simultaneously. \since 14.0 */
+ uint32_t type; /**< Port device type (PA_PORT_DEVICE_TYPE). \since 14.0 */
} pa_sink_port_info;
/** Stores information about sinks. Please note that this structure
@@ -311,6 +312,7 @@ typedef struct pa_source_port_info {
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 */
const char *available_group; /**< A string indentifier which determine the group of devices handling the available state simultaneously. \since 14.0 */
+ uint32_t type; /**< Port device type (PA_PORT_DEVICE_TYPE). \since 14.0 */
} pa_source_port_info;
/** Stores information about sources. Please note that this structure
@@ -512,6 +514,7 @@ typedef struct pa_card_port_info {
int64_t latency_offset; /**< Latency offset of the port that gets added to the sink/source latency when the port is active. \since 3.0 */
pa_card_profile_info2** profiles2; /**< Array of pointers to available profiles, or NULL. Array is terminated by an entry set to NULL. \since 5.0 */
const char *available_group; /**< A string indentifier which determine the group of devices handling the available state simultaneously. \since 14.0 */
+ uint32_t type; /**< Port device type (PA_PORT_DEVICE_TYPE). \since 14.0 */
} pa_card_port_info;
/** Stores information about cards. Please note that this structure