Lines Matching refs:sink
30 #include <pulsecore/sink-input.h>
48 * Map the 'real' muted sink to the null-sink currently being used to play
58 pa_sink *sink;
62 sink = pa_hashmap_get(u->null_sinks, s);
63 if (sink != NULL) {
64 /* We already have a null-sink for this sink */
65 return sink;
72 pa_module_load(&m, c, "module-null-sink", t);
78 PA_IDXSET_FOREACH(sink, c->sinks, idx) {
79 if (sink->module->index == m->index) {
80 pa_hashmap_put(u->null_sinks, s, sink);
81 return sink;
103 pa_log_info("Failed to move sink input %u \"%s\" to %s.", i->index,
106 pa_log_info("Successfully moved sink input %u \"%s\" to %s.", i->index,
111 /* Check if @sink has any passthrough stream, ignoring @ignore */
112 static bool sink_has_passthrough_stream(pa_sink *sink, pa_sink_input *ignore)
117 PA_IDXSET_FOREACH(stream, sink->inputs, idx) {
128 static pa_hook_result_t new_passthrough_stream(struct userdata *u, pa_core *c, pa_sink *sink, pa_sink_input *i) {
133 if (sink_has_passthrough_stream(sink, i)) {
141 null_sink = ensure_null_sink_for_sink(u, sink, c);
145 PA_IDXSET_FOREACH(stream, sink->inputs, idx) {
146 /* We don't want to move the stream which just moved to the sink and trigger this re-routing */
154 /* return a null sink for the new stream if it needs to be re-routed */
155 static pa_sink * new_normal_stream(struct userdata *u, pa_core *c, pa_sink *sink) {
156 if (!sink_has_passthrough_stream(sink, NULL))
159 /* A passthrough stream is already playing on this sink, re-route to a null sink */
160 return ensure_null_sink_for_sink(u, sink, c);
168 * a passthrough stream, the sink should have been selected and a format
173 * Unfortunately if no other module decides on sink/format before this hook
174 * runs, pulse core doing it is too late, so if a sink and/or stream format
176 * as pulsecore would use (default sink and higher priority negotiated
178 if (!new_data->sink) {
179 pa_sink *sink = pa_namereg_get(core, NULL, PA_NAMEREG_SINK);
180 pa_return_val_if_fail(sink, PA_HOOK_OK);
181 pa_sink_input_new_data_set_sink(new_data, sink, false, false);
189 pa_log_debug("Default sink does not match sink input requested formats");
194 return new_passthrough_stream(u, core, new_data->sink, NULL);
196 null_sink = new_normal_stream(u, core, new_data->sink);
199 pa_log_info("Already playing a passthrough stream; re-routing new stream to the null sink");
211 pa_assert(i->sink);
213 null_sink = pa_hashmap_get(u->null_sinks, i->sink);
220 move_stream(u, stream, i->sink);
223 unload_null_sink_module_for_sink(u, i->sink, c);
255 /* Passthrough stream has been moved to a new sink */
256 return new_passthrough_stream(u, core, i->sink, i);
258 null_sink = new_normal_stream(u, core, i->sink);
260 pa_log_info("Already playing a passthrough stream; re-routing moved stream to the null sink");