mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-11 13:30:02 -05:00
pulse: introspect sink state
This commit is contained in:
parent
f83111dd17
commit
9c4f8e627a
6 changed files with 103 additions and 28 deletions
|
|
@ -2679,8 +2679,12 @@ static void sink_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sin
|
|||
pa_tagstruct_put_usec(t, pa_sink_get_requested_latency(sink));
|
||||
}
|
||||
|
||||
if (c->version >= 15)
|
||||
if (c->version >= 15) {
|
||||
pa_tagstruct_put_volume(t, sink->base_volume);
|
||||
if (PA_UNLIKELY(pa_sink_get_state(sink) == PA_SINK_INVALID_STATE))
|
||||
pa_log_error("Internal sink state is invalid.");
|
||||
pa_tagstruct_putu32(t, pa_sink_get_state(sink));
|
||||
}
|
||||
}
|
||||
|
||||
static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_source *source) {
|
||||
|
|
@ -2713,8 +2717,12 @@ static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_s
|
|||
pa_tagstruct_put_usec(t, pa_source_get_requested_latency(source));
|
||||
}
|
||||
|
||||
if (c->version >= 15)
|
||||
if (c->version >= 15) {
|
||||
pa_tagstruct_put_volume(t, source->base_volume);
|
||||
if (PA_UNLIKELY(pa_source_get_state(source) == PA_SOURCE_INVALID_STATE))
|
||||
pa_log_error("Internal source state is invalid.");
|
||||
pa_tagstruct_putu32(t, pa_source_get_state(source));
|
||||
}
|
||||
}
|
||||
|
||||
static void client_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_client *client) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ typedef struct pa_sink pa_sink;
|
|||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <pulse/def.h>
|
||||
#include <pulse/sample.h>
|
||||
#include <pulse/channelmap.h>
|
||||
#include <pulse/volume.h>
|
||||
|
|
@ -42,18 +43,16 @@ typedef struct pa_sink pa_sink;
|
|||
|
||||
#define PA_MAX_INPUTS_PER_SINK 32
|
||||
|
||||
typedef enum pa_sink_state {
|
||||
PA_SINK_INIT,
|
||||
PA_SINK_RUNNING,
|
||||
PA_SINK_SUSPENDED,
|
||||
PA_SINK_IDLE,
|
||||
PA_SINK_UNLINKED
|
||||
} pa_sink_state_t;
|
||||
/* anonymous enum extending pa_sink_state_t */
|
||||
enum {
|
||||
PA_SINK_INIT = -2,
|
||||
/* Initialization state */
|
||||
|
||||
static inline pa_bool_t PA_SINK_IS_OPENED(pa_sink_state_t x) {
|
||||
return x == PA_SINK_RUNNING || x == PA_SINK_IDLE;
|
||||
}
|
||||
PA_SINK_UNLINKED = -3
|
||||
/* The state when the sink is getting unregistered and removed from client access */
|
||||
};
|
||||
|
||||
/* Returns true if sink is linked: registered and accessible from client side. */
|
||||
static inline pa_bool_t PA_SINK_IS_LINKED(pa_sink_state_t x) {
|
||||
return x == PA_SINK_RUNNING || x == PA_SINK_IDLE || x == PA_SINK_SUSPENDED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,18 +45,16 @@ typedef struct pa_source pa_source;
|
|||
|
||||
#define PA_MAX_OUTPUTS_PER_SOURCE 32
|
||||
|
||||
typedef enum pa_source_state {
|
||||
PA_SOURCE_INIT,
|
||||
PA_SOURCE_RUNNING,
|
||||
PA_SOURCE_SUSPENDED,
|
||||
PA_SOURCE_IDLE,
|
||||
PA_SOURCE_UNLINKED
|
||||
} pa_source_state_t;
|
||||
/* anonymous enum extending pa_source_state_t */
|
||||
enum {
|
||||
PA_SOURCE_INIT = -2,
|
||||
/* Initialization state */
|
||||
|
||||
static inline pa_bool_t PA_SOURCE_IS_OPENED(pa_source_state_t x) {
|
||||
return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE;
|
||||
}
|
||||
PA_SOURCE_UNLINKED = -3
|
||||
/* The state when the source is getting unregistered and removed from client access */
|
||||
};
|
||||
|
||||
/* Returns true if source is linked: registered and accessible from client side. */
|
||||
static inline pa_bool_t PA_SOURCE_IS_LINKED(pa_source_state_t x) {
|
||||
return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE || x == PA_SOURCE_SUSPENDED;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue