mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
Merge commit 'coling/master'
This commit is contained in:
commit
9a93157f5d
2 changed files with 36 additions and 45 deletions
|
|
@ -862,6 +862,13 @@ libavahi_wrap_la_LIBADD = $(AM_LIBADD) $(AVAHI_CFLAGS) libpulsecore-@PA_MAJORMIN
|
||||||
# Plug-in libraries #
|
# Plug-in libraries #
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
|
if HAVE_DBUS
|
||||||
|
# Serveral module (e.g. libalsa-util.la)
|
||||||
|
modlibexec_LTLIBRARIES += \
|
||||||
|
libdbus-util.la \
|
||||||
|
module-console-kit.la
|
||||||
|
endif
|
||||||
|
|
||||||
modlibexec_LTLIBRARIES += \
|
modlibexec_LTLIBRARIES += \
|
||||||
module-cli.la \
|
module-cli.la \
|
||||||
module-cli-protocol-tcp.la \
|
module-cli-protocol-tcp.la \
|
||||||
|
|
@ -989,21 +996,14 @@ endif
|
||||||
|
|
||||||
if HAVE_HAL
|
if HAVE_HAL
|
||||||
modlibexec_LTLIBRARIES += \
|
modlibexec_LTLIBRARIES += \
|
||||||
libdbus-util.la \
|
|
||||||
module-hal-detect.la
|
module-hal-detect.la
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if HAVE_DBUS
|
|
||||||
modlibexec_LTLIBRARIES += \
|
|
||||||
libdbus-util.la \
|
|
||||||
module-console-kit.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
if HAVE_BLUEZ
|
if HAVE_BLUEZ
|
||||||
modlibexec_LTLIBRARIES += \
|
modlibexec_LTLIBRARIES += \
|
||||||
|
libbluetooth-util.la \
|
||||||
module-bluetooth-proximity.la \
|
module-bluetooth-proximity.la \
|
||||||
module-bluetooth-discover.la \
|
module-bluetooth-discover.la \
|
||||||
libbluetooth-util.la \
|
|
||||||
libbluetooth-ipc.la \
|
libbluetooth-ipc.la \
|
||||||
libbluetooth-sbc.la \
|
libbluetooth-sbc.la \
|
||||||
module-bluetooth-device.la
|
module-bluetooth-device.la
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,6 @@ struct userdata {
|
||||||
|
|
||||||
pa_usec_t latency;
|
pa_usec_t latency;
|
||||||
|
|
||||||
pa_volume_t volume;
|
|
||||||
pa_bool_t muted;
|
|
||||||
|
|
||||||
/*esd_format_t format;*/
|
/*esd_format_t format;*/
|
||||||
int32_t rate;
|
int32_t rate;
|
||||||
|
|
||||||
|
|
@ -133,6 +130,9 @@ enum {
|
||||||
SINK_MESSAGE_RIP_SOCKET
|
SINK_MESSAGE_RIP_SOCKET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Forward declaration */
|
||||||
|
static void sink_set_volume_cb(pa_sink *);
|
||||||
|
|
||||||
static void on_connection(PA_GCC_UNUSED int fd, void*userdata) {
|
static void on_connection(PA_GCC_UNUSED int fd, void*userdata) {
|
||||||
struct userdata *u = userdata;
|
struct userdata *u = userdata;
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
|
|
@ -141,7 +141,7 @@ static void on_connection(PA_GCC_UNUSED int fd, void*userdata) {
|
||||||
u->fd = fd;
|
u->fd = fd;
|
||||||
|
|
||||||
/* Set the initial volume */
|
/* Set the initial volume */
|
||||||
pa_raop_client_set_volume(u->raop, u->volume);
|
sink_set_volume_cb(u->sink);
|
||||||
|
|
||||||
pa_log_debug("Connection authenticated, handing fd to IO thread...");
|
pa_log_debug("Connection authenticated, handing fd to IO thread...");
|
||||||
|
|
||||||
|
|
@ -255,43 +255,36 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
|
||||||
return pa_sink_process_msg(o, code, data, offset, chunk);
|
return pa_sink_process_msg(o, code, data, offset, chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sink_get_volume_cb(pa_sink *s) {
|
|
||||||
struct userdata *u = s->userdata;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
pa_assert(u);
|
|
||||||
|
|
||||||
for (i = 0; i < s->sample_spec.channels; i++)
|
|
||||||
s->virtual_volume.values[i] = u->volume;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sink_set_volume_cb(pa_sink *s) {
|
static void sink_set_volume_cb(pa_sink *s) {
|
||||||
struct userdata *u = s->userdata;
|
struct userdata *u = s->userdata;
|
||||||
int rv;
|
pa_cvolume hw;
|
||||||
|
pa_volume_t v;
|
||||||
|
char t[PA_CVOLUME_SNPRINT_MAX];
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
|
|
||||||
/* If we're muted, we fake it */
|
/* If we're muted we don't need to do anything */
|
||||||
if (u->muted)
|
if (s->muted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pa_assert(s->sample_spec.channels > 0);
|
/* Calculate the max volume of all channels.
|
||||||
|
We'll use this as our (single) volume on the APEX device and emulate
|
||||||
|
any variation in channel volumes in software */
|
||||||
|
v = pa_cvolume_max(&s->virtual_volume);
|
||||||
|
|
||||||
/* Avoid pointless volume sets */
|
/* Create a pa_cvolume version of our single value */
|
||||||
if (u->volume == s->virtual_volume.values[0])
|
pa_cvolume_set(&hw, s->sample_spec.channels, v);
|
||||||
return;
|
|
||||||
|
|
||||||
rv = pa_raop_client_set_volume(u->raop, s->virtual_volume.values[0]);
|
/* Perform any software manipulation of the volume needed */
|
||||||
if (0 == rv)
|
pa_sw_cvolume_divide(&s->soft_volume, &s->virtual_volume, &hw);
|
||||||
u->volume = s->virtual_volume.values[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sink_get_mute_cb(pa_sink *s) {
|
pa_log_debug("Requested volume: %s", pa_cvolume_snprint(t, sizeof(t), &s->virtual_volume));
|
||||||
struct userdata *u = s->userdata;
|
pa_log_debug("Got hardware volume: %s", pa_cvolume_snprint(t, sizeof(t), &hw));
|
||||||
|
pa_log_debug("Calculated software volume: %s", pa_cvolume_snprint(t, sizeof(t), &s->soft_volume));
|
||||||
|
|
||||||
pa_assert(u);
|
/* Any necessary software volume manipulateion is done so set
|
||||||
|
our hw volume (or v as a single value) on the device */
|
||||||
s->muted = u->muted;
|
pa_raop_client_set_volume(u->raop, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sink_set_mute_cb(pa_sink *s) {
|
static void sink_set_mute_cb(pa_sink *s) {
|
||||||
|
|
@ -299,8 +292,11 @@ static void sink_set_mute_cb(pa_sink *s) {
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
|
|
||||||
pa_raop_client_set_volume(u->raop, (s->muted ? PA_VOLUME_MUTED : u->volume));
|
if (s->muted) {
|
||||||
u->muted = s->muted;
|
pa_raop_client_set_volume(u->raop, PA_VOLUME_MUTED);
|
||||||
|
} else {
|
||||||
|
sink_set_volume_cb(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void thread_func(void *userdata) {
|
static void thread_func(void *userdata) {
|
||||||
|
|
@ -541,9 +537,6 @@ int pa__init(pa_module*m) {
|
||||||
u->next_encoding_overhead = 0;
|
u->next_encoding_overhead = 0;
|
||||||
u->encoding_ratio = 1.0;
|
u->encoding_ratio = 1.0;
|
||||||
|
|
||||||
u->volume = roundf(0.7 * PA_VOLUME_NORM);
|
|
||||||
u->muted = FALSE;
|
|
||||||
|
|
||||||
u->rtpoll = pa_rtpoll_new();
|
u->rtpoll = pa_rtpoll_new();
|
||||||
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
|
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
|
||||||
u->rtpoll_item = NULL;
|
u->rtpoll_item = NULL;
|
||||||
|
|
@ -583,9 +576,7 @@ int pa__init(pa_module*m) {
|
||||||
|
|
||||||
u->sink->parent.process_msg = sink_process_msg;
|
u->sink->parent.process_msg = sink_process_msg;
|
||||||
u->sink->userdata = u;
|
u->sink->userdata = u;
|
||||||
u->sink->get_volume = sink_get_volume_cb;
|
|
||||||
u->sink->set_volume = sink_set_volume_cb;
|
u->sink->set_volume = sink_set_volume_cb;
|
||||||
u->sink->get_mute = sink_get_mute_cb;
|
|
||||||
u->sink->set_mute = sink_set_mute_cb;
|
u->sink->set_mute = sink_set_mute_cb;
|
||||||
u->sink->flags = PA_SINK_LATENCY|PA_SINK_NETWORK|PA_SINK_HW_VOLUME_CTRL;
|
u->sink->flags = PA_SINK_LATENCY|PA_SINK_NETWORK|PA_SINK_HW_VOLUME_CTRL;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue