Note: There is still no notification when status availability changes.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
int64_t index
+## v24, implemented by >= 2.0
+
+New field in all commands that send/receive port introspection data
+(PA_COMMAND_GET_(SOURCE|SINK)_OUTPUT_INFO,
+PA_COMMAND_GET_(SOURCE|SINK)_OUTPUT_INFO_LIST):
+
+ uint32_t available
+
+The field is added once for every port.
+
#### If you just changed the protocol, read this
## module-tunnel depends on the sink/source/sink-input/source-input protocol
## internals, so if you changed these, you might have broken module-tunnel.
AC_SUBST(PA_MAJORMINOR, pa_major.pa_minor)
AC_SUBST(PA_API_VERSION, 12)
-AC_SUBST(PA_PROTOCOL_VERSION, 23)
+AC_SUBST(PA_PROTOCOL_VERSION, 24)
# The stable ABI for client applications, for the version info x:y:z
# always will hold y=z
pa_module_unload_request(u->module, TRUE);
}
+static int read_ports(struct userdata *u, pa_tagstruct *t)
+{
+ if (u->version >= 16) {
+ uint32_t n_ports;
+ const char *s;
+
+ if (pa_tagstruct_getu32(t, &n_ports)) {
+ pa_log("Parse failure");
+ return -PA_ERR_PROTOCOL;
+ }
+
+ for (uint32_t j = 0; j < n_ports; j++) {
+ uint32_t priority;
+
+ if (pa_tagstruct_gets(t, &s) < 0 || /* name */
+ pa_tagstruct_gets(t, &s) < 0 || /* description */
+ pa_tagstruct_getu32(t, &priority) < 0) {
+
+ pa_log("Parse failure");
+ return -PA_ERR_PROTOCOL;
+ }
+ if (u->version >= 24 && pa_tagstruct_getu32(t, &priority) < 0) { /* available */
+ pa_log("Parse failure");
+ return -PA_ERR_PROTOCOL;
+ }
+ }
+
+ if (pa_tagstruct_gets(t, &s) < 0) { /* active port */
+ pa_log("Parse failure");
+ return -PA_ERR_PROTOCOL;
+ }
+ }
+ return 0;
+}
+
#ifdef TUNNEL_SINK
/* Called from main context */
}
}
- if (u->version >= 16) {
- uint32_t n_ports;
- const char *s;
-
- if (pa_tagstruct_getu32(t, &n_ports)) {
- pa_log("Parse failure");
- goto fail;
- }
-
- for (uint32_t j = 0; j < n_ports; j++) {
- uint32_t priority;
-
- if (pa_tagstruct_gets(t, &s) < 0 || /* name */
- pa_tagstruct_gets(t, &s) < 0 || /* description */
- pa_tagstruct_getu32(t, &priority) < 0) {
-
- pa_log("Parse failure");
- goto fail;
- }
- }
-
- if (pa_tagstruct_gets(t, &s) < 0) { /* active port */
- pa_log("Parse failure");
- goto fail;
- }
- }
+ if (read_ports(u, t) < 0)
+ goto fail;
if (u->version >= 21) {
uint8_t n_formats;
}
}
- if (u->version >= 16) {
- uint32_t n_ports;
- const char *s;
-
- if (pa_tagstruct_getu32(t, &n_ports)) {
- pa_log("Parse failure");
- goto fail;
- }
-
- for (uint32_t j = 0; j < n_ports; j++) {
- uint32_t priority;
-
- if (pa_tagstruct_gets(t, &s) < 0 || /* name */
- pa_tagstruct_gets(t, &s) < 0 || /* description */
- pa_tagstruct_getu32(t, &priority) < 0) {
-
- pa_log("Parse failure");
- goto fail;
- }
- }
-
- if (pa_tagstruct_gets(t, &s) < 0) { /* active port */
- pa_log("Parse failure");
- goto fail;
- }
- }
+ if (read_ports(u, t) < 0)
+ goto fail;
if (!pa_tagstruct_eof(t)) {
pa_log("Packet too long");
* playback, \since 1.0 */
#define PA_STREAM_EVENT_FORMAT_LOST "format-lost"
+/** Port availability / 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;
+
+/** \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
+
+/** \endcond */
+
PA_C_DECL_END
#endif
goto fail;
}
+ i.ports[0][j].available = PA_PORT_AVAILABLE_UNKNOWN;
+ if (o->context->version >= 24) {
+ uint32_t av;
+ if (pa_tagstruct_getu32(t, &av) < 0 || av > PA_PORT_AVAILABLE_YES)
+ goto fail;
+ i.ports[0][j].available = av;
+ }
+
i.ports[j] = &i.ports[0][j];
}
goto fail;
}
+ i.ports[0][j].available = PA_PORT_AVAILABLE_UNKNOWN;
+ if (o->context->version >= 24) {
+ uint32_t av;
+ if (pa_tagstruct_getu32(t, &av) < 0 || av > PA_PORT_AVAILABLE_YES)
+ goto fail;
+ i.ports[0][j].available = av;
+ }
+
i.ports[j] = &i.ports[0][j];
}
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 \link pa_port_available_t, indicating availability status of this port. \since 2.0 */
} pa_sink_port_info;
/** Stores information about sinks. Please note that this structure
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 \link pa_port_available_t, indicating availability status of this port. \since 2.0 */
} pa_source_port_info;
/** Stores information about sources. Please note that this structure
pa_tagstruct_puts(t, p->name);
pa_tagstruct_puts(t, p->description);
pa_tagstruct_putu32(t, p->priority);
+ if (c->version >= 24)
+ pa_tagstruct_putu32(t, p->available);
}
}
pa_tagstruct_puts(t, p->name);
pa_tagstruct_puts(t, p->description);
pa_tagstruct_putu32(t, p->priority);
+ if (c->version >= 24)
+ pa_tagstruct_putu32(t, p->available);
}
}
char *description;
unsigned priority;
+ pa_port_available_t available; /* PA_PORT_AVAILABLE_UNKNOWN, PA_PORT_AVAILABLE_NO or PA_PORT_AVAILABLE_YES */
/* .. followed by some implementation specific data */
};