]> code.delx.au - pulseaudio/commitdiff
sink-input, source-output: Remove redundant get_mute() functions
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Tue, 15 Apr 2014 10:56:11 +0000 (13:56 +0300)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Fri, 2 May 2014 13:00:56 +0000 (16:00 +0300)
The functions just return the muted value. Callers can as well read
the struct field directly, it's simpler that way.

src/modules/dbus/iface-stream.c
src/modules/module-role-cork.c
src/modules/module-stream-restore.c
src/pulsecore/cli-text.c
src/pulsecore/protocol-native.c
src/pulsecore/sink-input.c
src/pulsecore/sink-input.h
src/pulsecore/source-output.c
src/pulsecore/source-output.h

index 1cff95e0c3fb7694dca78c72c45582cc6f72813c..4cbcd74f8599f2f7fef88aef4057a92f8ca132b9 100644 (file)
@@ -765,7 +765,7 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
             }
         }
 
-        new_mute = pa_sink_input_get_mute(s->sink_input);
+        new_mute = s->sink_input->muted;
 
         if (s->mute != new_mute) {
             s->mute = new_mute;
@@ -861,7 +861,7 @@ pa_dbusiface_stream *pa_dbusiface_stream_new_playback(pa_dbusiface_core *core, p
     else
         pa_cvolume_init(&s->volume);
 
-    s->mute = pa_sink_input_get_mute(sink_input);
+    s->mute = sink_input->muted;
     s->proplist = pa_proplist_copy(sink_input->proplist);
     s->dbus_protocol = pa_dbus_protocol_get(sink_input->core);
     s->subscription = pa_subscription_new(sink_input->core, PA_SUBSCRIPTION_MASK_SINK_INPUT, subscription_cb, s);
index 6573cd6a4ce65b05ce237c864481304281f69546..8ca2109808429e97329e6671b8b14392cde9ae89 100644 (file)
@@ -102,7 +102,7 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in
     pa_sink_assert_ref(s);
 
     for (j = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); j; j = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx))) {
-        bool corked, muted, corked_here;
+        bool corked, corked_here;
         const char *role;
 
         if (j == ignore)
@@ -119,10 +119,9 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in
             continue;
 
         corked = (pa_sink_input_get_state(j) == PA_SINK_INPUT_CORKED);
-        muted = pa_sink_input_get_mute(j);
         corked_here = !!pa_hashmap_get(u->cork_state, j);
 
-        if (cork && !corked && !muted) {
+        if (cork && !corked && !j->muted) {
             pa_log_debug("Found a '%s' stream that should be corked/muted.", cork_role);
             if (!corked_here)
                 pa_hashmap_put(u->cork_state, j, PA_INT_TO_PTR(1));
@@ -131,9 +130,9 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in
         } else if (!cork) {
             pa_hashmap_remove(u->cork_state, j);
 
-            if (corked_here && (corked || muted)) {
+            if (corked_here && (corked || j->muted)) {
                 pa_log_debug("Found a '%s' stream that should be uncorked/unmuted.", cork_role);
-                if (muted)
+                if (j->muted)
                     pa_sink_input_set_mute(j, false, false);
                 if (corked)
                     pa_sink_input_send_event(j, PA_STREAM_EVENT_REQUEST_UNCORK, NULL);
index 3774d497b30e037a55321f35e9aa90a2e70aaa6b..38d6aac624db31311662d27a4264d6e65b18b4a7 100644 (file)
@@ -1299,7 +1299,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
         }
 
         if (sink_input->save_muted) {
-            entry->muted = pa_sink_input_get_mute(sink_input);
+            entry->muted = sink_input->muted;
             entry->muted_valid = true;
 
             mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted);
@@ -1349,7 +1349,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
         }
 
         if (source_output->save_muted) {
-            entry->muted = pa_source_output_get_mute(source_output);
+            entry->muted = source_output->muted;
             entry->muted_valid = true;
 
             mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted);
index c7db0a6a0e8b104a4271da9e64bc72b17ce2cbe2..2992ae834f57e0b73222b7aecf00938dc5f8a3af 100644 (file)
@@ -536,7 +536,7 @@ char *pa_source_output_list_to_string(pa_core *c) {
             state_table[pa_source_output_get_state(o)],
             o->source->index, o->source->name,
             volume_str,
-            pa_yes_no(pa_source_output_get_mute(o)),
+            pa_yes_no(o->muted),
             (double) pa_source_output_get_latency(o, NULL) / PA_USEC_PER_MSEC,
             clt,
             pa_sample_spec_snprint(ss, sizeof(ss), &o->sample_spec),
@@ -634,7 +634,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
             state_table[pa_sink_input_get_state(i)],
             i->sink->index, i->sink->name,
             volume_str,
-            pa_yes_no(pa_sink_input_get_mute(i)),
+            pa_yes_no(i->muted),
             (double) pa_sink_input_get_latency(i, NULL) / PA_USEC_PER_MSEC,
             clt,
             pa_sample_spec_snprint(ss, sizeof(ss), &i->sample_spec),
index 41b4b505a2233245afb9f4b6442bfb8a4f0847d1..96df383da6b1c61d9b066dfb5e80b62e468966a5 100644 (file)
@@ -3366,7 +3366,7 @@ static void sink_input_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t,
     pa_tagstruct_puts(t, pa_resample_method_to_string(pa_sink_input_get_resample_method(s)));
     pa_tagstruct_puts(t, s->driver);
     if (c->version >= 11)
-        pa_tagstruct_put_boolean(t, pa_sink_input_get_mute(s));
+        pa_tagstruct_put_boolean(t, s->muted);
     if (c->version >= 13)
         pa_tagstruct_put_proplist(t, s->proplist);
     if (c->version >= 19)
@@ -3413,7 +3413,7 @@ static void source_output_fill_tagstruct(pa_native_connection *c, pa_tagstruct *
         pa_tagstruct_put_boolean(t, (pa_source_output_get_state(s) == PA_SOURCE_OUTPUT_CORKED));
     if (c->version >= 22) {
         pa_tagstruct_put_cvolume(t, &v);
-        pa_tagstruct_put_boolean(t, pa_source_output_get_mute(s));
+        pa_tagstruct_put_boolean(t, s->muted);
         pa_tagstruct_put_boolean(t, has_volume);
         pa_tagstruct_put_boolean(t, s->volume_writable);
         pa_tagstruct_put_format_info(t, s->format);
index e41afc9ba82d3eb5992191fe94fbe63210f8ab04..cfec051f0b61ab77426ffd2698783993f32b61cf 100644 (file)
@@ -1426,15 +1426,6 @@ void pa_sink_input_set_mute(pa_sink_input *i, bool mute, bool save) {
     pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
 }
 
-/* Called from main context */
-bool pa_sink_input_get_mute(pa_sink_input *i) {
-    pa_sink_input_assert_ref(i);
-    pa_assert_ctl_context();
-    pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
-
-    return i->muted;
-}
-
 /* Called from main thread */
 void pa_sink_input_update_proplist(pa_sink_input *i, pa_update_mode_t mode, pa_proplist *p) {
     pa_sink_input_assert_ref(i);
index 2be2c33e4b3090e9f709884745f142407e70f536..a48476cb01b2954b6dc079f911146c1eadb584fd 100644 (file)
@@ -375,7 +375,6 @@ int pa_sink_input_remove_volume_factor(pa_sink_input *i, const char *key);
 pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, bool absolute);
 
 void pa_sink_input_set_mute(pa_sink_input *i, bool mute, bool save);
-bool pa_sink_input_get_mute(pa_sink_input *i);
 
 void pa_sink_input_update_proplist(pa_sink_input *i, pa_update_mode_t mode, pa_proplist *p);
 
index bb893847deea53d9038b8f603730fcd1eef4b164..d3888df2e0e6179559e7c8e4efa3050caf68fdb1 100644 (file)
@@ -1084,15 +1084,6 @@ void pa_source_output_set_mute(pa_source_output *o, bool mute, bool save) {
     pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o->index);
 }
 
-/* Called from main context */
-bool pa_source_output_get_mute(pa_source_output *o) {
-    pa_source_output_assert_ref(o);
-    pa_assert_ctl_context();
-    pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state));
-
-    return o->muted;
-}
-
 /* Called from main thread */
 void pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t mode, pa_proplist *p) {
     pa_source_output_assert_ref(o);
index 27d6fd451d8fd7f814ad145a6d96e4fd92d9e0bb..73170d306f301187e09f72f71ce0c92d3cb8ec41 100644 (file)
@@ -318,7 +318,6 @@ void pa_source_output_set_volume(pa_source_output *o, const pa_cvolume *volume,
 pa_cvolume *pa_source_output_get_volume(pa_source_output *o, pa_cvolume *volume, bool absolute);
 
 void pa_source_output_set_mute(pa_source_output *o, bool mute, bool save);
-bool pa_source_output_get_mute(pa_source_output *o);
 
 void pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t mode, pa_proplist *p);