Introduce "available" concept for ports, and communicate that to clients. Bump protocol version to 24.

Note: There is still no notification when status availability changes.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2011-11-25 15:17:11 +01:00 committed by Tanu Kaskinen
parent fabb28f935
commit 961ec210a6
8 changed files with 88 additions and 53 deletions

View file

@ -977,6 +977,21 @@ 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
* \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

View file

@ -211,6 +211,14 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
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];
}
@ -476,6 +484,14 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
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];
}

View file

@ -202,6 +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 \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
@ -281,6 +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 \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