mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
core: Link virtual sinks and sources to their streams.
This change doesn't add any functionality in itself, but it will be useful in the future for operating on chains of sinks or sources that are piggy-backing on each other. For example, the PA_PROP_DEVICE_MASTER_DEVICE property could be handled in the core so that each virtual device doesn't have to maintain it separately. By using the origin_sink and destination_source pointers the core is able to see at stream creation time that the stream is created by a virtual device, and then update that device's property list using the name of the master device that the stream is being connected to. The same thing can be done also when the stream is being moved from a device to another, in which case the _MASTER_DEVICE property needs updating.
This commit is contained in:
parent
1f848f82c4
commit
969c7c80fe
14 changed files with 34 additions and 3 deletions
|
|
@ -1502,6 +1502,7 @@ int pa__init(pa_module*m) {
|
|||
source_output_data.driver = __FILE__;
|
||||
source_output_data.module = m;
|
||||
source_output_data.source = source_master;
|
||||
source_output_data.destination_source = u->source;
|
||||
/* FIXME
|
||||
source_output_data.flags = PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND; */
|
||||
|
||||
|
|
@ -1531,11 +1532,14 @@ int pa__init(pa_module*m) {
|
|||
u->source_output->moving = source_output_moving_cb;
|
||||
u->source_output->userdata = u;
|
||||
|
||||
u->source->output_from_master = u->source_output;
|
||||
|
||||
/* Create sink input */
|
||||
pa_sink_input_new_data_init(&sink_input_data);
|
||||
sink_input_data.driver = __FILE__;
|
||||
sink_input_data.module = m;
|
||||
sink_input_data.sink = sink_master;
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Echo-Cancel Sink Stream");
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
pa_sink_input_new_data_set_sample_spec(&sink_input_data, &sink_ss);
|
||||
|
|
@ -1566,6 +1570,8 @@ int pa__init(pa_module*m) {
|
|||
u->sink_input->mute_changed = sink_input_mute_changed_cb;
|
||||
u->sink_input->userdata = u;
|
||||
|
||||
u->sink->input_to_master = u->sink_input;
|
||||
|
||||
pa_sink_input_get_silence(u->sink_input, &silence);
|
||||
|
||||
u->source_memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0,
|
||||
|
|
|
|||
|
|
@ -1200,6 +1200,7 @@ int pa__init(pa_module*m) {
|
|||
sink_input_data.driver = __FILE__;
|
||||
sink_input_data.module = m;
|
||||
sink_input_data.sink = master;
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Equalized Stream");
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
|
||||
|
|
@ -1225,9 +1226,10 @@ int pa__init(pa_module*m) {
|
|||
u->sink_input->moving = sink_input_moving_cb;
|
||||
u->sink_input->volume_changed = sink_input_volume_changed_cb;
|
||||
u->sink_input->mute_changed = sink_input_mute_changed_cb;
|
||||
|
||||
u->sink_input->userdata = u;
|
||||
|
||||
u->sink->input_to_master = u->sink_input;
|
||||
|
||||
dbus_init(u);
|
||||
|
||||
/* default filter to these */
|
||||
|
|
|
|||
|
|
@ -832,6 +832,7 @@ int pa__init(pa_module*m) {
|
|||
sink_input_data.driver = __FILE__;
|
||||
sink_input_data.module = m;
|
||||
sink_input_data.sink = master;
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "LADSPA Stream");
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
|
||||
|
|
@ -859,6 +860,8 @@ int pa__init(pa_module*m) {
|
|||
u->sink_input->mute_changed = sink_input_mute_changed_cb;
|
||||
u->sink_input->userdata = u;
|
||||
|
||||
u->sink->input_to_master = u->sink_input;
|
||||
|
||||
pa_sink_put(u->sink);
|
||||
pa_sink_input_put(u->sink_input);
|
||||
|
||||
|
|
|
|||
|
|
@ -420,6 +420,7 @@ int pa__init(pa_module*m) {
|
|||
sink_input_data.driver = __FILE__;
|
||||
sink_input_data.module = m;
|
||||
sink_input_data.sink = master;
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Remapped Stream");
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
|
||||
|
|
@ -446,6 +447,8 @@ int pa__init(pa_module*m) {
|
|||
u->sink_input->moving = sink_input_moving_cb;
|
||||
u->sink_input->userdata = u;
|
||||
|
||||
u->sink->input_to_master = u->sink_input;
|
||||
|
||||
pa_sink_put(u->sink);
|
||||
pa_sink_input_put(u->sink_input);
|
||||
|
||||
|
|
|
|||
|
|
@ -556,6 +556,7 @@ int pa__init(pa_module*m) {
|
|||
sink_input_data.driver = __FILE__;
|
||||
sink_input_data.module = m;
|
||||
sink_input_data.sink = master;
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Sink Stream");
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
|
||||
|
|
@ -583,6 +584,8 @@ int pa__init(pa_module*m) {
|
|||
u->sink_input->mute_changed = sink_input_mute_changed_cb;
|
||||
u->sink_input->userdata = u;
|
||||
|
||||
u->sink->input_to_master = u->sink_input;
|
||||
|
||||
/* (9) IF YOU REQUIRE A FIXED BLOCK SIZE MAKE SURE TO PASS A
|
||||
* SILENCE MEMBLOCK AS LAST PARAMETER
|
||||
* HERE. pa_sink_input_get_silence() IS USEFUL HERE. */
|
||||
|
|
|
|||
|
|
@ -629,6 +629,7 @@ int pa__init(pa_module*m) {
|
|||
source_output_data.driver = __FILE__;
|
||||
source_output_data.module = m;
|
||||
source_output_data.source = master;
|
||||
source_output_data.destination_source = u->source;
|
||||
/* FIXME
|
||||
source_output_data.flags = PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND; */
|
||||
|
||||
|
|
@ -654,6 +655,8 @@ int pa__init(pa_module*m) {
|
|||
u->source_output->moving = source_output_moving_cb;
|
||||
u->source_output->userdata = u;
|
||||
|
||||
u->source->output_from_master = u->source_output;
|
||||
|
||||
pa_source_put(u->source);
|
||||
pa_source_output_put(u->source_output);
|
||||
|
||||
|
|
|
|||
|
|
@ -321,6 +321,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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue