summaryrefslogtreecommitdiffstats
path: root/src/pulsecore
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulsecore')
-rw-r--r--src/pulsecore/cli-command.c7
-rw-r--r--src/pulsecore/cli-text.c20
-rw-r--r--src/pulsecore/protocol-native.c14
-rw-r--r--src/pulsecore/sconv_sse.c4
-rw-r--r--src/pulsecore/sink-input.c30
-rw-r--r--src/pulsecore/sink-input.h7
-rw-r--r--src/pulsecore/sink.c1
-rw-r--r--src/pulsecore/sink.h2
-rw-r--r--src/pulsecore/sndfile-util.c13
-rw-r--r--src/pulsecore/source-output.c1
-rw-r--r--src/pulsecore/source-output.h4
-rw-r--r--src/pulsecore/source.c1
-rw-r--r--src/pulsecore/source.h1
-rw-r--r--src/pulsecore/svolume_arm.c1
14 files changed, 87 insertions, 19 deletions
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index a18ebd33..18dfb4c3 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -579,11 +579,16 @@ static int pa_cli_command_sink_input_volume(pa_core *c, pa_tokenizer *t, pa_strb
return -1;
}
- if (!(si = pa_idxset_get_by_index(c->sink_inputs, (uint32_t) idx))) {
+ if (!(si = pa_idxset_get_by_index(c->sink_inputs, idx))) {
pa_strbuf_puts(buf, "No sink input found with this index.\n");
return -1;
}
+ if (!pa_sink_input_is_volume_writable(si)) {
+ pa_strbuf_puts(buf, "This sink input's volume can't be changed.\n");
+ return -1;
+ }
+
pa_cvolume_set(&cvolume, 1, volume);
pa_sink_input_set_volume(si, &cvolume, TRUE, TRUE);
return 0;
diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c
index 23a57d37..e6018da2 100644
--- a/src/pulsecore/cli-text.c
+++ b/src/pulsecore/cli-text.c
@@ -553,8 +553,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
pa_usec_t cl;
const char *cmn;
pa_cvolume v;
-
- pa_sink_input_get_volume(i, &v, TRUE);
+ char *volume_str = NULL;
cmn = pa_channel_map_to_pretty_name(&i->channel_map);
@@ -565,6 +564,15 @@ char *pa_sink_input_list_to_string(pa_core *c) {
pa_assert(i->sink);
+ if (pa_sink_input_is_volume_readable(i)) {
+ pa_sink_input_get_volume(i, &v, TRUE);
+ volume_str = pa_sprintf_malloc("%s\n\t %s\n\t balance %0.2f",
+ pa_cvolume_snprint(cv, sizeof(cv), &v),
+ pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &v),
+ pa_cvolume_get_balance(&v, &i->channel_map));
+ } else
+ volume_str = pa_xstrdup("n/a");
+
pa_strbuf_printf(
s,
" index: %u\n"
@@ -573,8 +581,6 @@ char *pa_sink_input_list_to_string(pa_core *c) {
"\tstate: %s\n"
"\tsink: %u <%s>\n"
"\tvolume: %s\n"
- "\t %s\n"
- "\t balance %0.2f\n"
"\tmuted: %s\n"
"\tcurrent latency: %0.2f ms\n"
"\trequested latency: %s\n"
@@ -596,9 +602,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
i->flags & PA_SINK_INPUT_KILL_ON_SUSPEND ? "KILL_ON_SUSPEND " : "",
state_table[pa_sink_input_get_state(i)],
i->sink->index, i->sink->name,
- pa_cvolume_snprint(cv, sizeof(cv), &v),
- pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &v),
- pa_cvolume_get_balance(&v, &i->channel_map),
+ volume_str,
pa_yes_no(pa_sink_input_get_mute(i)),
(double) pa_sink_input_get_latency(i, NULL) / PA_USEC_PER_MSEC,
clt,
@@ -608,6 +612,8 @@ char *pa_sink_input_list_to_string(pa_core *c) {
cmn ? cmn : "",
pa_resample_method_to_string(pa_sink_input_get_resample_method(i)));
+ pa_xfree(volume_str);
+
if (i->module)
pa_strbuf_printf(s, "\tmodule: %u\n", i->module->index);
if (i->client)
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index cc6a6b1d..92575242 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -3056,12 +3056,19 @@ static void sink_input_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t,
pa_sample_spec fixed_ss;
pa_usec_t sink_latency;
pa_cvolume v;
+ pa_bool_t has_volume = FALSE;
pa_assert(t);
pa_sink_input_assert_ref(s);
fixup_sample_spec(c, &fixed_ss, &s->sample_spec);
+ has_volume = pa_sink_input_is_volume_readable(s);
+ if (has_volume)
+ pa_sink_input_get_volume(s, &v, TRUE);
+ else
+ pa_cvolume_reset(&v, fixed_ss.channels);
+
pa_tagstruct_putu32(t, s->index);
pa_tagstruct_puts(t, pa_strnull(pa_proplist_gets(s->proplist, PA_PROP_MEDIA_NAME)));
pa_tagstruct_putu32(t, s->module ? s->module->index : PA_INVALID_INDEX);
@@ -3069,7 +3076,7 @@ static void sink_input_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t,
pa_tagstruct_putu32(t, s->sink->index);
pa_tagstruct_put_sample_spec(t, &fixed_ss);
pa_tagstruct_put_channel_map(t, &s->channel_map);
- pa_tagstruct_put_cvolume(t, pa_sink_input_get_volume(s, &v, TRUE));
+ pa_tagstruct_put_cvolume(t, &v);
pa_tagstruct_put_usec(t, pa_sink_input_get_latency(s, &sink_latency));
pa_tagstruct_put_usec(t, sink_latency);
pa_tagstruct_puts(t, pa_resample_method_to_string(pa_sink_input_get_resample_method(s)));
@@ -3080,6 +3087,10 @@ static void sink_input_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t,
pa_tagstruct_put_proplist(t, s->proplist);
if (c->version >= 19)
pa_tagstruct_put_boolean(t, (pa_sink_input_get_state(s) == PA_SINK_INPUT_CORKED));
+ if (c->version >= 20) {
+ pa_tagstruct_put_boolean(t, has_volume);
+ pa_tagstruct_put_boolean(t, has_volume ? !pa_sink_input_is_volume_writable(s) : FALSE);
+ }
}
static void source_output_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_source_output *s) {
@@ -3461,6 +3472,7 @@ static void command_set_volume(
pa_log_debug("Client %s changes volume of source %s.", client_name, source->name);
pa_source_set_volume(source, &volume, TRUE);
} else if (si) {
+ CHECK_VALIDITY(c->pstream, pa_sink_input_is_volume_writable(si), tag, PA_ERR_INVALID);
CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &si->sample_spec), tag, PA_ERR_INVALID);
pa_log_debug("Client %s changes volume of sink input %s.",
diff --git a/src/pulsecore/sconv_sse.c b/src/pulsecore/sconv_sse.c
index 3737af2a..2e74d744 100644
--- a/src/pulsecore/sconv_sse.c
+++ b/src/pulsecore/sconv_sse.c
@@ -35,7 +35,7 @@
#include "cpu-x86.h"
#include "sconv.h"
-#if defined (__i386__) || defined (__amd64__)
+#if !defined(__APPLE__) && defined (__i386__) || defined (__amd64__)
static const PA_DECLARE_ALIGNED (16, float, one[4]) = { 1.0, 1.0, 1.0, 1.0 };
static const PA_DECLARE_ALIGNED (16, float, mone[4]) = { -1.0, -1.0, -1.0, -1.0 };
@@ -217,7 +217,7 @@ static void run_test (void) {
void pa_convert_func_init_sse (pa_cpu_x86_flag_t flags) {
-#if defined (__i386__) || defined (__amd64__)
+#if !defined(__APPLE__) && defined (__i386__) || defined (__amd64__)
#ifdef RUN_TEST
run_test ();
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 065fd2d3..283d0265 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -112,8 +112,15 @@ void pa_sink_input_new_data_set_channel_map(pa_sink_input_new_data *data, const
data->channel_map = *map;
}
+pa_bool_t pa_sink_input_new_data_is_volume_writable(pa_sink_input_new_data *data) {
+ pa_assert(data);
+
+ return !(data->flags & PA_SINK_INPUT_PASSTHROUGH);
+}
+
void pa_sink_input_new_data_set_volume(pa_sink_input_new_data *data, const pa_cvolume *volume) {
pa_assert(data);
+ pa_assert(pa_sink_input_new_data_is_volume_writable(data));
if ((data->volume_is_set = !!volume))
data->volume = *volume;
@@ -205,6 +212,7 @@ int pa_sink_input_new(
if ((r = pa_hook_fire(&core->hooks[PA_CORE_HOOK_SINK_INPUT_NEW], data)) < 0)
return r;
+ pa_assert(!data->volume_is_set || pa_sink_input_new_data_is_volume_writable(data));
pa_return_val_if_fail(!data->driver || pa_utf8_valid(data->driver), -PA_ERR_INVALID);
if (!data->sink) {
@@ -321,6 +329,7 @@ int pa_sink_input_new(
i->driver = pa_xstrdup(pa_path_get_filename(data->driver));
i->module = data->module;
i->sink = data->sink;
+ i->origin_sink = data->origin_sink;
i->client = data->client;
i->requested_resample_method = data->resample_method;
@@ -1058,12 +1067,23 @@ static void set_real_ratio(pa_sink_input *i, const pa_cvolume *v) {
}
/* Called from main context */
-void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, pa_bool_t save, pa_bool_t absolute) {
+pa_bool_t pa_sink_input_is_volume_readable(pa_sink_input *i) {
+ pa_sink_input_assert_ref(i);
+ pa_assert_ctl_context();
- /* Do not allow for volume changes for non-audio types */
- if (i->flags & PA_SINK_INPUT_PASSTHROUGH)
- return;
+ return !(i->flags & PA_SINK_INPUT_PASSTHROUGH);
+}
+/* Called from main context */
+pa_bool_t pa_sink_input_is_volume_writable(pa_sink_input *i) {
+ pa_sink_input_assert_ref(i);
+ pa_assert_ctl_context();
+
+ return !(i->flags & PA_SINK_INPUT_PASSTHROUGH);
+}
+
+/* Called from main context */
+void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, pa_bool_t save, pa_bool_t absolute) {
/* test ramping -> return pa_sink_input_set_volume_with_ramping(i, volume, save, absolute, 2000 * PA_USEC_PER_MSEC); */
return pa_sink_input_set_volume_with_ramping(i, volume, save, absolute, 0);
}
@@ -1073,6 +1093,7 @@ pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, pa_bo
pa_sink_input_assert_ref(i);
pa_assert_ctl_context();
pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
+ pa_assert(pa_sink_input_is_volume_readable(i));
if (absolute || !(i->sink->flags & PA_SINK_FLAT_VOLUME))
*volume = i->volume;
@@ -1853,6 +1874,7 @@ void pa_sink_input_set_volume_with_ramping(pa_sink_input *i, const pa_cvolume *v
pa_assert(volume);
pa_assert(pa_cvolume_valid(volume));
pa_assert(volume->channels == 1 || pa_cvolume_compatible(volume, &i->sample_spec));
+ pa_assert(pa_sink_input_is_volume_writable(i));
if ((i->sink->flags & PA_SINK_FLAT_VOLUME) && !absolute) {
v = i->sink->reference_volume;
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index f81e2d4b..9d8d169a 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.h
@@ -83,7 +83,8 @@ struct pa_sink_input {
pa_module *module; /* may be NULL */
pa_client *client; /* may be NULL */
- pa_sink *sink; /* NULL while we are being moved */
+ pa_sink *sink; /* NULL while we are being moved */
+ pa_sink *origin_sink; /* only set by filter sinks */
/* A sink input may be connected to multiple source outputs
* directly, so that they don't get mixed data of the entire
@@ -285,6 +286,7 @@ typedef struct pa_sink_input_new_data {
pa_client *client;
pa_sink *sink;
+ pa_sink *origin_sink;
pa_resample_method_t resample_method;
@@ -310,6 +312,7 @@ typedef struct pa_sink_input_new_data {
pa_sink_input_new_data* pa_sink_input_new_data_init(pa_sink_input_new_data *data);
void pa_sink_input_new_data_set_sample_spec(pa_sink_input_new_data *data, const pa_sample_spec *spec);
void pa_sink_input_new_data_set_channel_map(pa_sink_input_new_data *data, const pa_channel_map *map);
+pa_bool_t pa_sink_input_new_data_is_volume_writable(pa_sink_input_new_data *data);
void pa_sink_input_new_data_set_volume(pa_sink_input_new_data *data, const pa_cvolume *volume);
void pa_sink_input_new_data_apply_volume_factor(pa_sink_input_new_data *data, const pa_cvolume *volume_factor);
void pa_sink_input_new_data_apply_volume_factor_sink(pa_sink_input_new_data *data, const pa_cvolume *volume_factor);
@@ -354,6 +357,8 @@ void pa_sink_input_kill(pa_sink_input*i);
pa_usec_t pa_sink_input_get_latency(pa_sink_input *i, pa_usec_t *sink_latency);
+pa_bool_t pa_sink_input_is_volume_readable(pa_sink_input *i);
+pa_bool_t pa_sink_input_is_volume_writable(pa_sink_input *i);
void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, pa_bool_t save, pa_bool_t absolute);
pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, pa_bool_t absolute);
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 62000e0d..0de544c9 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -269,6 +269,7 @@ pa_sink* pa_sink_new(
s->inputs = pa_idxset_new(NULL, NULL);
s->n_corked = 0;
+ s->input_to_master = NULL;
s->reference_volume = s->real_volume = data->volume;
pa_cvolume_reset(&s->soft_volume, s->sample_spec.channels);
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index 4d569ddc..8a515870 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -44,6 +44,7 @@ typedef struct pa_sink_volume_change pa_sink_volume_change;
#include <pulsecore/card.h>
#include <pulsecore/queue.h>
#include <pulsecore/thread-mq.h>
+#include <pulsecore/sink-input.h>
#define PA_MAX_INPUTS_PER_SINK 32
@@ -86,6 +87,7 @@ struct pa_sink {
pa_idxset *inputs;
unsigned n_corked;
pa_source *monitor_source;
+ pa_sink_input *input_to_master; /* non-NULL only for filter sinks */
pa_volume_t base_volume; /* shall be constant */
unsigned n_volume_steps; /* shall be constant */
diff --git a/src/pulsecore/sndfile-util.c b/src/pulsecore/sndfile-util.c
index 9d15a868..cadda931 100644
--- a/src/pulsecore/sndfile-util.c
+++ b/src/pulsecore/sndfile-util.c
@@ -51,6 +51,9 @@ int pa_sndfile_read_sample_spec(SNDFILE *sf, pa_sample_spec *ss) {
break;
case SF_FORMAT_PCM_24:
+ ss->format = PA_SAMPLE_S24NE;
+ break;
+
case SF_FORMAT_PCM_32:
ss->format = PA_SAMPLE_S32NE;
break;
@@ -106,10 +109,14 @@ int pa_sndfile_write_sample_spec(SF_INFO *sfi, pa_sample_spec *ss) {
case PA_SAMPLE_S24LE:
case PA_SAMPLE_S24BE:
+ ss->format = PA_SAMPLE_S24NE;
+ sfi->format |= SF_FORMAT_PCM_24;
+ break;
+
case PA_SAMPLE_S24_32LE:
case PA_SAMPLE_S24_32BE:
- ss->format = PA_SAMPLE_S32NE;
- sfi->format |= SF_FORMAT_PCM_24;
+ ss->format = PA_SAMPLE_S24_32NE;
+ sfi->format |= SF_FORMAT_PCM_32;
break;
case PA_SAMPLE_S32LE:
@@ -362,6 +369,7 @@ pa_sndfile_readf_t pa_sndfile_readf_function(const pa_sample_spec *ss) {
return (pa_sndfile_readf_t) sf_readf_short;
case PA_SAMPLE_S32NE:
+ case PA_SAMPLE_S24_32NE:
return (pa_sndfile_readf_t) sf_readf_int;
case PA_SAMPLE_FLOAT32NE:
@@ -384,6 +392,7 @@ pa_sndfile_writef_t pa_sndfile_writef_function(const pa_sample_spec *ss) {
return (pa_sndfile_writef_t) sf_writef_short;
case PA_SAMPLE_S32NE:
+ case PA_SAMPLE_S24_32NE:
return (pa_sndfile_writef_t) sf_writef_int;
case PA_SAMPLE_FLOAT32NE:
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 88731e76..0bb8899c 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -208,6 +208,7 @@ int pa_source_output_new(
o->driver = pa_xstrdup(pa_path_get_filename(data->driver));
o->module = data->module;
o->source = data->source;
+ o->destination_source = data->destination_source;
o->client = data->client;
o->actual_resample_method = resampler ? pa_resampler_get_method(resampler) : PA_RESAMPLER_INVALID;
diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h
index 273b78fc..f16f9520 100644
--- a/src/pulsecore/source-output.h
+++ b/src/pulsecore/source-output.h
@@ -74,7 +74,8 @@ struct pa_source_output {
pa_module *module; /* may be NULL */
pa_client *client; /* may be NULL */
- pa_source *source; /* NULL while being moved */
+ pa_source *source; /* NULL while being moved */
+ pa_source *destination_source; /* only set by filter sources */
/* A source output can monitor just a single input of a sink, in which case we find it here */
pa_sink_input *direct_on_input; /* may be NULL */
@@ -211,6 +212,7 @@ typedef struct pa_source_output_new_data {
pa_client *client;
pa_source *source;
+ pa_source *destination_source;
pa_resample_method_t resample_method;
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 412a3db9..24d0ff6b 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -221,6 +221,7 @@ pa_source* pa_source_new(
s->outputs = pa_idxset_new(NULL, NULL);
s->n_corked = 0;
s->monitor_of = NULL;
+ s->output_from_master = NULL;
s->volume = data->volume;
pa_cvolume_reset(&s->soft_volume, s->sample_spec.channels);
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index e3e56bc4..f3af159e 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -75,6 +75,7 @@ struct pa_source {
pa_idxset *outputs;
unsigned n_corked;
pa_sink *monitor_of; /* may be NULL */
+ pa_source_output *output_from_master; /* non-NULL only for filter sources */
pa_volume_t base_volume; /* shall be constant */
unsigned n_volume_steps; /* shall be constant */
diff --git a/src/pulsecore/svolume_arm.c b/src/pulsecore/svolume_arm.c
index 3973e518..c2830cfd 100644
--- a/src/pulsecore/svolume_arm.c
+++ b/src/pulsecore/svolume_arm.c
@@ -39,6 +39,7 @@
#define MOD_INC() \
" subs r0, r6, %2 \n\t" \
+ " itt cs \n\t" \
" addcs r0, %1 \n\t" \
" movcs r6, r0 \n\t"