1 From: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
2 Date: Mon, 14 Apr 2014 15:24:31 +0300
3 Subject: sink-input, source-output: Remove redundant get_mute() functions
5 The functions just return the muted value. Callers can as well read
6 the struct field directly, it's simpler that way.
8 Change-Id: I368f7e09cdf522039a6573e5002f7544b4e840d3
9 Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
11 src/modules/dbus/iface-stream.c | 4 ++--
12 src/modules/module-role-cork.c | 9 ++++-----
13 src/modules/module-stream-restore.c | 4 ++--
14 src/pulsecore/cli-text.c | 4 ++--
15 src/pulsecore/protocol-native.c | 4 ++--
16 src/pulsecore/sink-input.c | 9 ---------
17 src/pulsecore/sink-input.h | 1 -
18 src/pulsecore/source-output.c | 9 ---------
19 src/pulsecore/source-output.h | 1 -
20 9 files changed, 12 insertions(+), 33 deletions(-)
22 diff --git a/src/modules/dbus/iface-stream.c b/src/modules/dbus/iface-stream.c
23 index 1cff95e..4cbcd74 100644
24 --- a/src/modules/dbus/iface-stream.c
25 +++ b/src/modules/dbus/iface-stream.c
26 @@ -765,7 +765,7 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
30 - new_mute = pa_sink_input_get_mute(s->sink_input);
31 + new_mute = s->sink_input->muted;
33 if (s->mute != new_mute) {
35 @@ -861,7 +861,7 @@ pa_dbusiface_stream *pa_dbusiface_stream_new_playback(pa_dbusiface_core *core, p
37 pa_cvolume_init(&s->volume);
39 - s->mute = pa_sink_input_get_mute(sink_input);
40 + s->mute = sink_input->muted;
41 s->proplist = pa_proplist_copy(sink_input->proplist);
42 s->dbus_protocol = pa_dbus_protocol_get(sink_input->core);
43 s->subscription = pa_subscription_new(sink_input->core, PA_SUBSCRIPTION_MASK_SINK_INPUT, subscription_cb, s);
44 diff --git a/src/modules/module-role-cork.c b/src/modules/module-role-cork.c
45 index 6573cd6..8ca2109 100644
46 --- a/src/modules/module-role-cork.c
47 +++ b/src/modules/module-role-cork.c
48 @@ -102,7 +102,7 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in
49 pa_sink_assert_ref(s);
51 for (j = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); j; j = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx))) {
52 - bool corked, muted, corked_here;
53 + bool corked, corked_here;
57 @@ -119,10 +119,9 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in
60 corked = (pa_sink_input_get_state(j) == PA_SINK_INPUT_CORKED);
61 - muted = pa_sink_input_get_mute(j);
62 corked_here = !!pa_hashmap_get(u->cork_state, j);
64 - if (cork && !corked && !muted) {
65 + if (cork && !corked && !j->muted) {
66 pa_log_debug("Found a '%s' stream that should be corked/muted.", cork_role);
68 pa_hashmap_put(u->cork_state, j, PA_INT_TO_PTR(1));
69 @@ -131,9 +130,9 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in
71 pa_hashmap_remove(u->cork_state, j);
73 - if (corked_here && (corked || muted)) {
74 + if (corked_here && (corked || j->muted)) {
75 pa_log_debug("Found a '%s' stream that should be uncorked/unmuted.", cork_role);
78 pa_sink_input_set_mute(j, false, false);
80 pa_sink_input_send_event(j, PA_STREAM_EVENT_REQUEST_UNCORK, NULL);
81 diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
82 index 68968c9..4fc5645 100644
83 --- a/src/modules/module-stream-restore.c
84 +++ b/src/modules/module-stream-restore.c
85 @@ -1303,7 +1303,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
88 if (sink_input->save_muted) {
89 - entry->muted = pa_sink_input_get_mute(sink_input);
90 + entry->muted = sink_input->muted;
91 entry->muted_valid = true;
93 mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted);
94 @@ -1353,7 +1353,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
97 if (source_output->save_muted) {
98 - entry->muted = pa_source_output_get_mute(source_output);
99 + entry->muted = source_output->muted;
100 entry->muted_valid = true;
102 mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted);
103 diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c
104 index c7db0a6..2992ae8 100644
105 --- a/src/pulsecore/cli-text.c
106 +++ b/src/pulsecore/cli-text.c
107 @@ -536,7 +536,7 @@ char *pa_source_output_list_to_string(pa_core *c) {
108 state_table[pa_source_output_get_state(o)],
109 o->source->index, o->source->name,
111 - pa_yes_no(pa_source_output_get_mute(o)),
112 + pa_yes_no(o->muted),
113 (double) pa_source_output_get_latency(o, NULL) / PA_USEC_PER_MSEC,
115 pa_sample_spec_snprint(ss, sizeof(ss), &o->sample_spec),
116 @@ -634,7 +634,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
117 state_table[pa_sink_input_get_state(i)],
118 i->sink->index, i->sink->name,
120 - pa_yes_no(pa_sink_input_get_mute(i)),
121 + pa_yes_no(i->muted),
122 (double) pa_sink_input_get_latency(i, NULL) / PA_USEC_PER_MSEC,
124 pa_sample_spec_snprint(ss, sizeof(ss), &i->sample_spec),
125 diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
126 index 4304cd4..21e02fe 100644
127 --- a/src/pulsecore/protocol-native.c
128 +++ b/src/pulsecore/protocol-native.c
129 @@ -3378,7 +3378,7 @@ static void sink_input_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t,
130 pa_tagstruct_puts(t, pa_resample_method_to_string(pa_sink_input_get_resample_method(s)));
131 pa_tagstruct_puts(t, s->driver);
132 if (c->version >= 11)
133 - pa_tagstruct_put_boolean(t, pa_sink_input_get_mute(s));
134 + pa_tagstruct_put_boolean(t, s->muted);
135 if (c->version >= 13)
136 pa_tagstruct_put_proplist(t, s->proplist);
137 if (c->version >= 19)
138 @@ -3425,7 +3425,7 @@ static void source_output_fill_tagstruct(pa_native_connection *c, pa_tagstruct *
139 pa_tagstruct_put_boolean(t, (pa_source_output_get_state(s) == PA_SOURCE_OUTPUT_CORKED));
140 if (c->version >= 22) {
141 pa_tagstruct_put_cvolume(t, &v);
142 - pa_tagstruct_put_boolean(t, pa_source_output_get_mute(s));
143 + pa_tagstruct_put_boolean(t, s->muted);
144 pa_tagstruct_put_boolean(t, has_volume);
145 pa_tagstruct_put_boolean(t, s->volume_writable);
146 pa_tagstruct_put_format_info(t, s->format);
147 diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
148 index f706acc..a274620 100644
149 --- a/src/pulsecore/sink-input.c
150 +++ b/src/pulsecore/sink-input.c
151 @@ -1485,15 +1485,6 @@ void pa_sink_input_set_mute(pa_sink_input *i, bool mute, bool save) {
152 pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
155 -/* Called from main context */
156 -bool pa_sink_input_get_mute(pa_sink_input *i) {
157 - pa_sink_input_assert_ref(i);
158 - pa_assert_ctl_context();
159 - pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
164 /* Called from main thread */
165 void pa_sink_input_update_proplist(pa_sink_input *i, pa_update_mode_t mode, pa_proplist *p) {
166 pa_sink_input_assert_ref(i);
167 diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
168 index 4e7b229..1bd3eee 100644
169 --- a/src/pulsecore/sink-input.h
170 +++ b/src/pulsecore/sink-input.h
171 @@ -387,7 +387,6 @@ int pa_sink_input_remove_volume_factor(pa_sink_input *i, const char *key);
172 pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, bool absolute);
174 void pa_sink_input_set_mute(pa_sink_input *i, bool mute, bool save);
175 -bool pa_sink_input_get_mute(pa_sink_input *i);
177 void pa_sink_input_set_volume_ramp(pa_sink_input *i, const pa_cvolume_ramp *ramp, bool send_msg, bool save);
179 diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
180 index bb89384..d3888df 100644
181 --- a/src/pulsecore/source-output.c
182 +++ b/src/pulsecore/source-output.c
183 @@ -1084,15 +1084,6 @@ void pa_source_output_set_mute(pa_source_output *o, bool mute, bool save) {
184 pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o->index);
187 -/* Called from main context */
188 -bool pa_source_output_get_mute(pa_source_output *o) {
189 - pa_source_output_assert_ref(o);
190 - pa_assert_ctl_context();
191 - pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state));
196 /* Called from main thread */
197 void pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t mode, pa_proplist *p) {
198 pa_source_output_assert_ref(o);
199 diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h
200 index 27d6fd4..73170d3 100644
201 --- a/src/pulsecore/source-output.h
202 +++ b/src/pulsecore/source-output.h
203 @@ -318,7 +318,6 @@ void pa_source_output_set_volume(pa_source_output *o, const pa_cvolume *volume,
204 pa_cvolume *pa_source_output_get_volume(pa_source_output *o, pa_cvolume *volume, bool absolute);
206 void pa_source_output_set_mute(pa_source_output *o, bool mute, bool save);
207 -bool pa_source_output_get_mute(pa_source_output *o);
209 void pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t mode, pa_proplist *p);