From f6d95b7291f09f63f50d3b258f6a82580faf7bca Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 7 Apr 2006 23:02:48 +0000 Subject: add new introspection data field for sinks/sources: a flags field which specifies whether the sink/source supports hw volume control and latency querying git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@661 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/polyp/def.h | 12 ++++++++++++ src/polyp/introspect.c | 12 ++++++++++-- src/polyp/introspect.h | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src/polyp') diff --git a/src/polyp/def.h b/src/polyp/def.h index 659b943b..1a7a20c3 100644 --- a/src/polyp/def.h +++ b/src/polyp/def.h @@ -273,6 +273,18 @@ typedef enum pa_seek_mode { PA_SEEK_RELATIVE_END = 3, /**< Seek relatively to the current end of the buffer queue. */ } pa_seek_mode_t; +/** Special sink flags. \since 0.8 */ +typedef enum pa_sink_flags { + PA_SINK_HW_VOLUME_CTRL = 1, /**< Supports hardware volume control */ + PA_SINK_LATENCY = 2 /**< Supports latency querying */ +} pa_sink_flags_t; + +/** Special source flags. \since 0.8 */ +typedef enum pa_source_flags { + PA_SOURCE_HW_VOLUME_CTRL = 1, /**< Supports hardware volume control */ + PA_SOURCE_LATENCY = 2 /**< Supports latency querying */ +} pa_source_flags_t; + PA_C_DECL_END #endif diff --git a/src/polyp/introspect.c b/src/polyp/introspect.c index 6a28998c..ea6133e1 100644 --- a/src/polyp/introspect.c +++ b/src/polyp/introspect.c @@ -135,6 +135,7 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, P eol = -1; } else { + uint32_t flags; while (!pa_tagstruct_eof(t)) { pa_sink_info i; @@ -150,12 +151,15 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, P pa_tagstruct_getu32(t, &i.monitor_source) < 0 || pa_tagstruct_gets(t, &i.monitor_source_name) < 0 || pa_tagstruct_get_usec(t, &i.latency) < 0 || - pa_tagstruct_gets(t, &i.driver) < 0) { + pa_tagstruct_gets(t, &i.driver) < 0 || + pa_tagstruct_getu32(t, &flags) < 0) { pa_context_fail(o->context, PA_ERR_PROTOCOL); goto finish; } + i.flags = (pa_sink_flags_t) flags; + if (o->callback) { pa_sink_info_cb_t cb = (pa_sink_info_cb_t) o->callback; cb(o->context, &i, 0, o->userdata); @@ -242,6 +246,7 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command, while (!pa_tagstruct_eof(t)) { pa_source_info i; + uint32_t flags; if (pa_tagstruct_getu32(t, &i.index) < 0 || pa_tagstruct_gets(t, &i.name) < 0 || @@ -254,12 +259,15 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command, pa_tagstruct_getu32(t, &i.monitor_of_sink) < 0 || pa_tagstruct_gets(t, &i.monitor_of_sink_name) < 0 || pa_tagstruct_get_usec(t, &i.latency) < 0 || - pa_tagstruct_gets(t, &i.driver) < 0) { + pa_tagstruct_gets(t, &i.driver) < 0 || + pa_tagstruct_getu32(t, &flags) < 0) { pa_context_fail(o->context, PA_ERR_PROTOCOL); goto finish; } + i.flags = (pa_source_flags_t) flags; + if (o->callback) { pa_source_info_cb_t cb = (pa_source_info_cb_t) o->callback; cb(o->context, &i, 0, o->userdata); diff --git a/src/polyp/introspect.h b/src/polyp/introspect.h index f1f0989c..fb05cfb9 100644 --- a/src/polyp/introspect.h +++ b/src/polyp/introspect.h @@ -63,6 +63,7 @@ typedef struct pa_sink_info { const char *monitor_source_name; /**< The name of the monitor source */ pa_usec_t latency; /**< Length of filled playback buffer of this sink */ const char *driver; /**< Driver name. \since 0.8 */ + pa_sink_flags_t flags; /**< Flags \since 0.8 */ } pa_sink_info; /** Callback prototype for pa_context_get_sink_info_by_name() and friends */ @@ -91,6 +92,7 @@ typedef struct pa_source_info { const char *monitor_of_sink_name; /**< Name of the owning sink, or PA_INVALID_INDEX */ pa_usec_t latency; /**< Length of filled record buffer of this source. \since 0.5 */ const char *driver; /**< Driver name \since 0.8 */ + pa_source_flags_t flags; /**< Flags \since 0.8 */ } pa_source_info; /** Callback prototype for pa_context_get_source_info_by_name() and friends */ -- cgit