mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-10 13:29:58 -05:00
core: Internally deprecate pa_port_available_t to use pa_available_t
Generalize the availability flag in order to be used beyond the scope of ports. However, pa_port_availability_t is left unchanged to avoid modifying the protocol and the client API. This should be replaced by pa_available_t after a validation phase of this new generic enum type.
This commit is contained in:
parent
3aefdd995c
commit
8851644a3c
12 changed files with 68 additions and 58 deletions
|
|
@ -29,6 +29,14 @@ typedef struct pa_card pa_card;
|
|||
#include <pulsecore/module.h>
|
||||
#include <pulsecore/idxset.h>
|
||||
|
||||
/* This enum replaces pa_port_available_t (defined in pulse/def.h) for
|
||||
* internal use, so make sure both enum types stay in sync. */
|
||||
typedef enum pa_available {
|
||||
PA_AVAILABLE_UNKNOWN = 0,
|
||||
PA_AVAILABLE_NO = 1,
|
||||
PA_AVAILABLE_YES = 2,
|
||||
} pa_available_t;
|
||||
|
||||
typedef struct pa_card_profile {
|
||||
pa_card *card;
|
||||
char *name;
|
||||
|
|
|
|||
|
|
@ -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! */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue