diff options
Diffstat (limited to 'src/pulse')
-rw-r--r-- | src/pulse/browser.c | 2 | ||||
-rw-r--r-- | src/pulse/context.c | 13 | ||||
-rw-r--r-- | src/pulse/def.h | 11 | ||||
-rw-r--r-- | src/pulse/ext-device-manager.c | 5 | ||||
-rw-r--r-- | src/pulse/ext-stream-restore.c | 5 | ||||
-rw-r--r-- | src/pulse/glib-mainloop.c | 4 | ||||
-rw-r--r-- | src/pulse/introspect.c | 11 | ||||
-rw-r--r-- | src/pulse/introspect.h | 2 | ||||
-rw-r--r-- | src/pulse/mainloop-api.h | 2 | ||||
-rw-r--r-- | src/pulse/scache.c | 4 | ||||
-rw-r--r-- | src/pulse/stream.c | 8 | ||||
-rw-r--r-- | src/pulse/subscribe.c | 1 | ||||
-rw-r--r-- | src/pulse/volume.c | 15 | ||||
-rw-r--r-- | src/pulse/volume.h | 7 |
14 files changed, 53 insertions, 37 deletions
diff --git a/src/pulse/browser.c b/src/pulse/browser.c index 4cf5d0c3..d0592284 100644 --- a/src/pulse/browser.c +++ b/src/pulse/browser.c @@ -20,7 +20,7 @@ ***/ #ifdef HAVE_CONFIG_H -#include "config.h" +#include <config.h> #endif #include <string.h> diff --git a/src/pulse/context.c b/src/pulse/context.c index 8f632b5d..1480af53 100644 --- a/src/pulse/context.c +++ b/src/pulse/context.c @@ -53,6 +53,11 @@ #include <pulse/i18n.h> #include <pulse/mainloop.h> #include <pulse/timeval.h> +#include <pulse/fork-detect.h> +#include <pulse/client-conf.h> +#ifdef HAVE_X11 +#include <pulse/client-conf-x11.h> +#endif #include <pulsecore/core-error.h> #include <pulsecore/native-common.h> @@ -71,14 +76,6 @@ #include <pulsecore/proplist-util.h> #include "internal.h" - -#include "client-conf.h" -#include "fork-detect.h" - -#ifdef HAVE_X11 -#include "client-conf-x11.h" -#endif - #include "context.h" void pa_command_extension(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); diff --git a/src/pulse/def.h b/src/pulse/def.h index ac4ae538..a3b86223 100644 --- a/src/pulse/def.h +++ b/src/pulse/def.h @@ -748,6 +748,16 @@ typedef enum pa_sink_flags { /**< The HW volume changes are syncronized with SW volume. * \since 1.0 */ +/** \cond fulldocs */ + /* PRIVATE: Server-side values -- do not try to use these at client-side. + * The server will filter out these flags anyway, so you should never see + * these flags in sinks. */ + + PA_SINK_SHARE_VOLUME_WITH_MASTER = 0x0400U, + /**< This sink shares the volume with the master sink (used by some filter + * sinks). */ +/** \endcond */ + } pa_sink_flags_t; /** \cond fulldocs */ @@ -761,6 +771,7 @@ typedef enum pa_sink_flags { #define PA_SINK_DYNAMIC_LATENCY PA_SINK_DYNAMIC_LATENCY #define PA_SINK_PASSTHROUGH PA_SINK_PASSTHROUGH #define PA_SINK_SYNC_VOLUME PA_SINK_SYNC_VOLUME +#define PA_SINK_SHARE_VOLUME_WITH_MASTER PA_SINK_SHARE_VOLUME_WITH_MASTER /** \endcond */ diff --git a/src/pulse/ext-device-manager.c b/src/pulse/ext-device-manager.c index 57cb57c8..7b78c24e 100644 --- a/src/pulse/ext-device-manager.c +++ b/src/pulse/ext-device-manager.c @@ -27,14 +27,13 @@ #include <pulse/context.h> #include <pulse/gccmacro.h> #include <pulse/xmalloc.h> +#include <pulse/fork-detect.h> +#include <pulse/operation.h> #include <pulsecore/macro.h> #include <pulsecore/pstream-util.h> #include "internal.h" -#include "operation.h" -#include "fork-detect.h" - #include "ext-device-manager.h" enum { diff --git a/src/pulse/ext-stream-restore.c b/src/pulse/ext-stream-restore.c index 10e9fd5d..7bc1a612 100644 --- a/src/pulse/ext-stream-restore.c +++ b/src/pulse/ext-stream-restore.c @@ -25,14 +25,13 @@ #include <pulse/context.h> #include <pulse/gccmacro.h> +#include <pulse/fork-detect.h> +#include <pulse/operation.h> #include <pulsecore/macro.h> #include <pulsecore/pstream-util.h> #include "internal.h" -#include "operation.h" -#include "fork-detect.h" - #include "ext-stream-restore.h" enum { diff --git a/src/pulse/glib-mainloop.c b/src/pulse/glib-mainloop.c index 6afb7a2d..2e5f2f92 100644 --- a/src/pulse/glib-mainloop.c +++ b/src/pulse/glib-mainloop.c @@ -34,7 +34,7 @@ #include <glib.h> #include "glib-mainloop.h" -struct pa_io_event { +struct pa_io_event { pa_glib_mainloop *mainloop; int dead; @@ -336,7 +336,7 @@ static void glib_time_restart(pa_time_event*e, const struct timeval *tv) { e->mainloop->cached_next_time_event = e; } else if (e->mainloop->cached_next_time_event == e) e->mainloop->cached_next_time_event = NULL; - } +} static void glib_time_free(pa_time_event *e) { g_assert(e); diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c index 2a817881..ec27b928 100644 --- a/src/pulse/introspect.c +++ b/src/pulse/introspect.c @@ -29,14 +29,13 @@ #include <pulse/context.h> #include <pulse/gccmacro.h> #include <pulse/xmalloc.h> +#include <pulse/fork-detect.h> #include <pulsecore/macro.h> #include <pulsecore/core-util.h> #include <pulsecore/pstream-util.h> #include "internal.h" -#include "fork-detect.h" - #include "introspect.h" /*** Statistics ***/ @@ -996,7 +995,7 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm while (!pa_tagstruct_eof(t)) { pa_sink_input_info i; - pa_bool_t mute = FALSE, corked = FALSE; + pa_bool_t mute = FALSE, corked = FALSE, has_volume = FALSE, read_only_volume = FALSE; pa_zero(i); i.proplist = pa_proplist_new(); @@ -1015,7 +1014,9 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm pa_tagstruct_gets(t, &i.driver) < 0 || (o->context->version >= 11 && pa_tagstruct_get_boolean(t, &mute) < 0) || (o->context->version >= 13 && pa_tagstruct_get_proplist(t, i.proplist) < 0) || - (o->context->version >= 19 && pa_tagstruct_get_boolean(t, &corked) < 0)) { + (o->context->version >= 19 && pa_tagstruct_get_boolean(t, &corked) < 0) || + (o->context->version >= 20 && (pa_tagstruct_get_boolean(t, &has_volume) < 0 || + pa_tagstruct_get_boolean(t, &read_only_volume) < 0))) { pa_context_fail(o->context, PA_ERR_PROTOCOL); pa_proplist_free(i.proplist); @@ -1024,6 +1025,8 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm i.mute = (int) mute; i.corked = (int) corked; + i.has_volume = (int) has_volume; + i.read_only_volume = (int) read_only_volume; if (o->callback) { pa_sink_input_info_cb_t cb = (pa_sink_input_info_cb_t) o->callback; diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h index bc50611e..1cadee52 100644 --- a/src/pulse/introspect.h +++ b/src/pulse/introspect.h @@ -503,6 +503,8 @@ typedef struct pa_sink_input_info { int mute; /**< Stream muted \since 0.9.7 */ pa_proplist *proplist; /**< Property list \since 0.9.11 */ int corked; /**< Stream corked \since 1.0 */ + int has_volume; /**< Stream has volume. If not set, then the meaning of this struct's volume member is unspecified. \since 1.0 */ + int read_only_volume; /**< Stream volume can only be read. Although volume control is disabled, the stream volume is still not necessarily constant. \since 1.0 */ } pa_sink_input_info; /** Callback prototype for pa_context_get_sink_input_info() and friends*/ diff --git a/src/pulse/mainloop-api.h b/src/pulse/mainloop-api.h index 0ce2219b..212ff3cc 100644 --- a/src/pulse/mainloop-api.h +++ b/src/pulse/mainloop-api.h @@ -80,7 +80,7 @@ typedef void (*pa_defer_event_cb_t)(pa_mainloop_api*a, pa_defer_event* e, void * typedef void (*pa_defer_event_destroy_cb_t)(pa_mainloop_api*a, pa_defer_event *e, void *userdata); /** An abstract mainloop API vtable */ -struct pa_mainloop_api { +struct pa_mainloop_api { /** A pointer to some private, arbitrary data of the main loop implementation */ void *userdata; diff --git a/src/pulse/scache.c b/src/pulse/scache.c index cb8d7c59..6ed80a68 100644 --- a/src/pulse/scache.c +++ b/src/pulse/scache.c @@ -28,14 +28,14 @@ #include <string.h> #include <pulse/utf8.h> -#include <pulse/scache.h> +#include <pulse/fork-detect.h> #include <pulsecore/pstream-util.h> #include <pulsecore/macro.h> #include <pulsecore/proplist-util.h> -#include "fork-detect.h" #include "internal.h" +#include "scache.h" int pa_stream_connect_upload(pa_stream *s, size_t length) { pa_tagstruct *t; diff --git a/src/pulse/stream.c b/src/pulse/stream.c index addc36ae..aac18a31 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -29,10 +29,10 @@ #include <string.h> #include <pulse/def.h> -#include <pulse/stream.h> #include <pulse/timeval.h> #include <pulse/rtclock.h> #include <pulse/xmalloc.h> +#include <pulse/fork-detect.h> #include <pulsecore/pstream-util.h> #include <pulsecore/log.h> @@ -41,8 +41,8 @@ #include <pulsecore/core-rtclock.h> #include <pulsecore/core-util.h> -#include "fork-detect.h" #include "internal.h" +#include "stream.h" #define AUTO_TIMING_INTERVAL_START_USEC (10*PA_USEC_PER_MSEC) #define AUTO_TIMING_INTERVAL_END_USEC (1500*PA_USEC_PER_MSEC) @@ -790,7 +790,7 @@ void pa_command_overflow_or_underflow(pa_pdispatch *pd, uint32_t command, uint32 s->underflow_callback(s, s->underflow_userdata); } - finish: +finish: pa_context_unref(c); } @@ -925,7 +925,7 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, if (pa_tagstruct_getu32(t, &s->channel) < 0 || s->channel == PA_INVALID_INDEX || - ((s->direction != PA_STREAM_UPLOAD) && (pa_tagstruct_getu32(t, &s->stream_index) < 0 || s->stream_index == PA_INVALID_INDEX)) || + ((s->direction != PA_STREAM_UPLOAD) && (pa_tagstruct_getu32(t, &s->stream_index) < 0 || s->stream_index == PA_INVALID_INDEX)) || ((s->direction != PA_STREAM_RECORD) && pa_tagstruct_getu32(t, &requested_bytes) < 0)) { pa_context_fail(s->context, PA_ERR_PROTOCOL); goto finish; diff --git a/src/pulse/subscribe.c b/src/pulse/subscribe.c index 203bc928..52d0af35 100644 --- a/src/pulse/subscribe.c +++ b/src/pulse/subscribe.c @@ -31,7 +31,6 @@ #include <pulsecore/pstream-util.h> #include "internal.h" - #include "subscribe.h" void pa_command_subscribe_event(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { diff --git a/src/pulse/volume.c b/src/pulse/volume.c index f74d7202..134c007d 100644 --- a/src/pulse/volume.c +++ b/src/pulse/volume.c @@ -263,7 +263,7 @@ pa_volume_t pa_sw_volume_from_linear(double v) { * same volume value! That's why we need the lround() below! */ - return (pa_volume_t) PA_CLAMP_VOLUME(lround(cbrt(v) * PA_VOLUME_NORM)); + return (pa_volume_t) PA_CLAMP_VOLUME((uint64_t) lround(cbrt(v) * PA_VOLUME_NORM)); } double pa_sw_volume_to_linear(pa_volume_t v) { @@ -375,8 +375,7 @@ char *pa_sw_volume_snprint_dB(char *s, size_t l, pa_volume_t v) { } f = pa_sw_volume_to_dB(v); - pa_snprintf(s, l, "%0.2f dB", - isinf(f) < 0 || f <= PA_DECIBEL_MININFTY ? -INFINITY : f); + pa_snprintf(s, l, "%0.2f dB", isinf(f) < 0 || f <= PA_DECIBEL_MININFTY ? -INFINITY : f); return s; } @@ -657,9 +656,9 @@ pa_cvolume* pa_cvolume_set_balance(pa_cvolume *v, const pa_channel_map *map, flo m = PA_MAX(left, right); if (new_balance <= 0) { - nright = (new_balance + 1.0f) * m; + nright = (new_balance + 1.0f) * m; nleft = m; - } else { + } else { nleft = (1.0f - new_balance) * m; nright = m; } @@ -720,7 +719,7 @@ pa_cvolume* pa_cvolume_scale_mask(pa_cvolume *v, pa_volume_t max, pa_channel_map return pa_cvolume_set(v, v->channels, max); for (c = 0; c < v->channels; c++) - v->values[c] = (pa_volume_t) PA_CLAMP_VOLUME(((uint64_t) v->values[c] * (uint64_t) max) / (uint64_t) t); + v->values[c] = (pa_volume_t) PA_CLAMP_VOLUME(((uint64_t) v->values[c] * (uint64_t) max) / (uint64_t) t); return v; } @@ -798,9 +797,9 @@ pa_cvolume* pa_cvolume_set_fade(pa_cvolume *v, const pa_channel_map *map, float m = PA_MAX(front, rear); if (new_fade <= 0) { - nfront = (new_fade + 1.0f) * m; + nfront = (new_fade + 1.0f) * m; nrear = m; - } else { + } else { nrear = (1.0f - new_fade) * m; nfront = m; } diff --git a/src/pulse/volume.h b/src/pulse/volume.h index 91eef749..abf930ea 100644 --- a/src/pulse/volume.h +++ b/src/pulse/volume.h @@ -115,6 +115,13 @@ typedef uint32_t pa_volume_t; /** Maximum valid volume we can store. \since 0.9.15 */ #define PA_VOLUME_MAX ((pa_volume_t) UINT32_MAX/2) +/** Recommended maximum volume to show in user facing UIs. + * Note: UIs should deal gracefully with volumes greater than this value + * and not cause feedback loops etc. - i.e. if the volume is more than + * this, the UI should not limit it and push the limited value back to + * the server. \since 0.9.23 */ +#define PA_VOLUME_UI_MAX (pa_sw_volume_from_dB(+11.0)) + /** Special 'invalid' volume. \since 0.9.16 */ #define PA_VOLUME_INVALID ((pa_volume_t) UINT32_MAX) |