2 * module-murphy-ivi -- PulseAudio module for providing audio routing support
3 * Copyright (c) 2012, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU Lesser General Public License,
7 * version 2.1, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston,
25 #include <pulsecore/pulsecore-config.h>
26 #include <pulsecore/sink-input.h>
27 #include <pulsecore/source-output.h>
29 #include "stream-state.h"
33 static void sink_input_block(pa_sink_input *, pa_bool_t);
35 pa_bool_t pa_stream_state_start_corked(struct userdata *u,
36 pa_sink_input_new_data *data,
37 pa_nodeset_resdef *resdef)
40 data->flags |= PA_SINK_INPUT_START_CORKED;
47 void pa_stream_state_change(struct userdata *u, mir_node *node, int req)
52 pa_source_output *sout;
58 pa_assert_se((core = u->core));
62 pa_assert((!loop && node->implement == mir_stream) ||
63 ( loop && node->implement == mir_device) );
64 pa_assert(node->direction == mir_input || node->direction == mir_output);
67 if (node->direction == mir_input) {
68 sinp = pa_idxset_get_by_index(core->sink_inputs,
69 loop->sink_input_index);
75 pa_log("mute '%s'", node->amname);
76 pa_sink_input_set_mute(sinp, TRUE, FALSE);
80 pa_log("unmute '%s'", node->amname);
81 pa_sink_input_set_mute(sinp, FALSE, FALSE);
85 pa_assert_not_reached();
90 pa_log("no enforcement for loopback on '%s'", node->amname);
91 sout = pa_idxset_get_by_index(core->source_outputs,
92 loop->source_output_index);
97 if (node->direction == mir_input) {
98 sinp = pa_idxset_get_by_index(core->sink_inputs, node->paidx);
103 pa_log("killing '%s'", node->amname);
107 case PA_STREAM_BLOCK:
108 pa_log("blocking '%s'", node->amname);
109 sink_input_block(sinp, TRUE);
113 pa_log("unblock '%s'", node->amname);
114 sink_input_block(sinp, FALSE);
118 pa_assert_not_reached();
123 pa_log("no enforcement for stream '%s'", node->amname);
124 sout = pa_idxset_get_by_index(core->source_outputs, node->paidx);
131 static void sink_input_block(pa_sink_input *sinp, pa_bool_t block)
138 pa_sink_input_cork(sinp, block);
140 if (sinp->send_event) {
142 event = PA_STREAM_EVENT_REQUEST_CORK;
144 event = PA_STREAM_EVENT_REQUEST_UNCORK;
146 pl = pa_proplist_new();
148 sinp->send_event(sinp, event, pl);
150 pa_proplist_free(pl);
157 * indent-tabs-mode: nil