[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-test6-44-gdee2aa3

Lennart Poettering gitmailer-noreply at 0pointer.de
Mon Aug 31 12:45:35 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  8bf2e3fe94e0dcd0a39a67c461b787d79adcd0dd (commit)

- Log -----------------------------------------------------------------
dee2aa3 pactl: drop unnecessary newlines from pa_log() invocations
5b61a19 pactl: implement pactl commands for changing volumes/mute stati
e20d906 cli: make sure 'dump' uses pa_cvolume_max() to deduce a single-channel volume from a multi-channel volume
7c6a0ec cli: apply single-channel volume changes equally to all channels
2970c11 core: always allow volume setting with single-channel pa_cvolume
e1ce365 native: make sure clients cannot trigger an assert by sending us invalid volume info
-----------------------------------------------------------------------

Summary of changes:
 src/pulsecore/cli-command.c     |   10 +-
 src/pulsecore/protocol-native.c |    7 +-
 src/pulsecore/sink-input.c      |   14 ++-
 src/pulsecore/sink.c            |   10 ++-
 src/pulsecore/source.c          |   13 ++-
 src/utils/pactl.c               |  264 +++++++++++++++++++++++++++++++--------
 6 files changed, 254 insertions(+), 64 deletions(-)

-----------------------------------------------------------------------

commit e1ce365cd9cdcdfd1535aa58882de249c6274ed4
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Aug 29 06:11:02 2009 +0200

    native: make sure clients cannot trigger an assert by sending us invalid volume info

diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index a5e952a..179e62e 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -3390,12 +3390,18 @@ static void command_set_volume(
     client_name = pa_strnull(pa_proplist_gets(c->client->proplist, PA_PROP_APPLICATION_PROCESS_BINARY));
 
     if (sink) {
+        CHECK_VALIDITY(c->pstream, pa_cvolume_compatible(&volume, &sink->sample_spec), tag, PA_ERR_INVALID);
+
         pa_log_debug("Client %s changes volume of sink %s.", client_name, sink->name);
         pa_sink_set_volume(sink, &volume, TRUE, TRUE);
     } else if (source) {
+        CHECK_VALIDITY(c->pstream, pa_cvolume_compatible(&volume, &source->sample_spec), tag, PA_ERR_INVALID);
+
         pa_log_debug("Client %s changes volume of source %s.", client_name, source->name);
         pa_source_set_volume(source, &volume, TRUE);
     } else if (si) {
+        CHECK_VALIDITY(c->pstream, pa_cvolume_compatible(&volume, &si->sample_spec), tag, PA_ERR_INVALID);
+
         pa_log_debug("Client %s changes volume of sink input %s.",
                      client_name,
                      pa_strnull(pa_proplist_gets(si->proplist, PA_PROP_MEDIA_NAME)));
@@ -3441,7 +3447,6 @@ static void command_set_mute(
     switch (command) {
 
         case PA_COMMAND_SET_SINK_MUTE:
-
             if (idx != PA_INVALID_INDEX)
                 sink = pa_idxset_get_by_index(c->protocol->core->sinks, idx);
             else

commit 2970c11902b46414d9ff28db1e850d94b137157c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Aug 31 21:40:59 2009 +0200

    core: always allow volume setting with single-channel pa_cvolume

diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 179e62e..d961dba 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -3390,17 +3390,17 @@ static void command_set_volume(
     client_name = pa_strnull(pa_proplist_gets(c->client->proplist, PA_PROP_APPLICATION_PROCESS_BINARY));
 
     if (sink) {
-        CHECK_VALIDITY(c->pstream, pa_cvolume_compatible(&volume, &sink->sample_spec), tag, PA_ERR_INVALID);
+        CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &sink->sample_spec), tag, PA_ERR_INVALID);
 
         pa_log_debug("Client %s changes volume of sink %s.", client_name, sink->name);
         pa_sink_set_volume(sink, &volume, TRUE, TRUE);
     } else if (source) {
-        CHECK_VALIDITY(c->pstream, pa_cvolume_compatible(&volume, &source->sample_spec), tag, PA_ERR_INVALID);
+        CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &source->sample_spec), tag, PA_ERR_INVALID);
 
         pa_log_debug("Client %s changes volume of source %s.", client_name, source->name);
         pa_source_set_volume(source, &volume, TRUE);
     } else if (si) {
-        CHECK_VALIDITY(c->pstream, pa_cvolume_compatible(&volume, &si->sample_spec), tag, PA_ERR_INVALID);
+        CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &si->sample_spec), tag, PA_ERR_INVALID);
 
         pa_log_debug("Client %s changes volume of sink input %s.",
                      client_name,
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index d3e7a45..adda2af 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -941,12 +941,22 @@ void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, pa_boo
     pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
     pa_assert(volume);
     pa_assert(pa_cvolume_valid(volume));
-    pa_assert(pa_cvolume_compatible(volume, &i->sample_spec));
+    pa_assert(volume->channels == 1 || pa_cvolume_compatible(volume, &i->sample_spec));
 
     if ((i->sink->flags & PA_SINK_FLAT_VOLUME) && !absolute) {
         v = i->sink->reference_volume;
         pa_cvolume_remap(&v, &i->sink->channel_map, &i->channel_map);
-        volume = pa_sw_cvolume_multiply(&v, &v, volume);
+
+        if (pa_cvolume_compatible(volume, &i->sample_spec))
+            volume = pa_sw_cvolume_multiply(&v, &v, volume);
+        else
+            volume = pa_sw_cvolume_multiply_scalar(&v, &v, pa_cvolume_max(volume));
+    } else {
+
+        if (!pa_cvolume_compatible(volume, &i->sample_spec)) {
+            v = i->volume;
+            volume = pa_cvolume_scale(&v, pa_cvolume_max(volume));
+        }
     }
 
     if (pa_cvolume_equal(volume, &i->volume)) {
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 48c50b0..f5a6fc5 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1408,8 +1408,11 @@ void pa_sink_set_volume(
     pa_assert_ctl_context();
     pa_assert(PA_SINK_IS_LINKED(s->state));
     pa_assert(!volume || pa_cvolume_valid(volume));
-    pa_assert(!volume || pa_cvolume_compatible(volume, &s->sample_spec));
     pa_assert(volume || (s->flags & PA_SINK_FLAT_VOLUME));
+    pa_assert(!volume || volume->channels == 1 || pa_cvolume_compatible(volume, &s->sample_spec));
+
+    /* As a special exception we accept mono volumes on all sinks --
+     * even on those with more complex channel maps */
 
     /* If volume is NULL we synchronize the sink's real and reference
      * volumes with the stream volumes. If it is not NULL we update
@@ -1419,7 +1422,10 @@ void pa_sink_set_volume(
 
     if (volume) {
 
-        s->reference_volume = *volume;
+        if (pa_cvolume_compatible(volume, &s->sample_spec))
+            s->reference_volume = *volume;
+        else
+            pa_cvolume_scale(&s->reference_volume, pa_cvolume_max(volume));
 
         if (s->flags & PA_SINK_FLAT_VOLUME) {
             /* OK, propagate this volume change back to the inputs */
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 1c77e0b..415c54b 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -760,15 +760,22 @@ void pa_source_set_volume(
         pa_bool_t save) {
 
     pa_bool_t real_changed;
+    pa_cvolume old_volume;
 
     pa_source_assert_ref(s);
     pa_assert_ctl_context();
     pa_assert(PA_SOURCE_IS_LINKED(s->state));
     pa_assert(pa_cvolume_valid(volume));
-    pa_assert(pa_cvolume_compatible(volume, &s->sample_spec));
+    pa_assert(volume->channels == 1 || pa_cvolume_compatible(volume, &s->sample_spec));
 
-    real_changed = !pa_cvolume_equal(volume, &s->volume);
-    s->volume = *volume;
+    old_volume = s->volume;
+
+    if (pa_cvolume_compatible(volume, &s->sample_spec))
+        s->volume = *volume;
+    else
+        pa_cvolume_scale(&s->volume, pa_cvolume_max(volume));
+
+    real_changed = !pa_cvolume_equal(&old_volume, &s->volume);
     s->save_volume = (!real_changed && s->save_volume) || save;
 
     if (s->set_volume) {

commit 7c6a0ec66cd168b423bb66ef1ed266c4fbbcf3f3
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Aug 31 21:41:36 2009 +0200

    cli: apply single-channel volume changes equally to all channels

diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index 6ec7464..06a83b5 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -529,7 +529,7 @@ static int pa_cli_command_sink_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *bu
         return -1;
     }
 
-    pa_cvolume_set(&cvolume, sink->sample_spec.channels, volume);
+    pa_cvolume_set(&cvolume, 1, volume);
     pa_sink_set_volume(sink, &cvolume, TRUE, TRUE);
     return 0;
 }
@@ -571,7 +571,7 @@ static int pa_cli_command_sink_input_volume(pa_core *c, pa_tokenizer *t, pa_strb
         return -1;
     }
 
-    pa_cvolume_set(&cvolume, si->sample_spec.channels, volume);
+    pa_cvolume_set(&cvolume, 1, volume);
     pa_sink_input_set_volume(si, &cvolume, TRUE, TRUE);
     return 0;
 }
@@ -607,7 +607,7 @@ static int pa_cli_command_source_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *
         return -1;
     }
 
-    pa_cvolume_set(&cvolume, source->sample_spec.channels, volume);
+    pa_cvolume_set(&cvolume, 1, volume);
     pa_source_set_volume(source, &cvolume, TRUE);
     return 0;
 }

commit e20d9068a31c7456e292aedec735dc776c44d0b6
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Aug 31 21:42:09 2009 +0200

    cli: make sure 'dump' uses pa_cvolume_max() to deduce a single-channel volume from a multi-channel volume

diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index 06a83b5..3c94960 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -1586,7 +1586,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
             nl = 1;
         }
 
-        pa_strbuf_printf(buf, "set-sink-volume %s 0x%03x\n", sink->name, pa_cvolume_avg(pa_sink_get_volume(sink, FALSE)));
+        pa_strbuf_printf(buf, "set-sink-volume %s 0x%03x\n", sink->name, pa_cvolume_max(pa_sink_get_volume(sink, FALSE)));
         pa_strbuf_printf(buf, "set-sink-mute %s %s\n", sink->name, pa_yes_no(pa_sink_get_mute(sink, FALSE)));
         pa_strbuf_printf(buf, "suspend-sink %s %s\n", sink->name, pa_yes_no(pa_sink_get_state(sink) == PA_SINK_SUSPENDED));
     }
@@ -1598,7 +1598,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
             nl = 1;
         }
 
-        pa_strbuf_printf(buf, "set-source-volume %s 0x%03x\n", source->name, pa_cvolume_avg(pa_source_get_volume(source, FALSE)));
+        pa_strbuf_printf(buf, "set-source-volume %s 0x%03x\n", source->name, pa_cvolume_max(pa_source_get_volume(source, FALSE)));
         pa_strbuf_printf(buf, "set-source-mute %s %s\n", source->name, pa_yes_no(pa_source_get_mute(source, FALSE)));
         pa_strbuf_printf(buf, "suspend-source %s %s\n", source->name, pa_yes_no(pa_source_get_state(source) == PA_SOURCE_SUSPENDED));
     }

commit 5b61a1991c4e2aaa6c31c5f468cca279b8142e16
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Aug 31 21:42:54 2009 +0200

    pactl: implement pactl commands for changing volumes/mute stati

diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index c8c3a43..2009594 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -50,7 +50,6 @@ static pa_context *context = NULL;
 static pa_mainloop_api *mainloop_api = NULL;
 
 static char
-    *device = NULL,
     *sample_name = NULL,
     *sink_name = NULL,
     *source_name = NULL,
@@ -66,6 +65,8 @@ static uint32_t
 
 static uint32_t module_index;
 static pa_bool_t suspend;
+static pa_bool_t mute;
+static pa_volume_t volume;
 
 static pa_proplist *proplist = NULL;
 
@@ -74,7 +75,6 @@ static pa_stream *sample_stream = NULL;
 static pa_sample_spec sample_spec;
 static pa_channel_map channel_map;
 static size_t sample_length = 0;
-
 static int actions = 1;
 
 static pa_bool_t nl = FALSE;
@@ -95,7 +95,13 @@ static enum {
     SUSPEND_SOURCE,
     SET_CARD_PROFILE,
     SET_SINK_PORT,
-    SET_SOURCE_PORT
+    SET_SOURCE_PORT,
+    SET_SINK_VOLUME,
+    SET_SOURCE_VOLUME,
+    SET_SINK_INPUT_VOLUME,
+    SET_SINK_MUTE,
+    SET_SOURCE_MUTE,
+    SET_SINK_INPUT_MUTE
 } action = NONE;
 
 static void quit(int ret) {
@@ -109,6 +115,7 @@ static void context_drain_complete(pa_context *c, void *userdata) {
 
 static void drain(void) {
     pa_operation *o;
+
     if (!(o = pa_context_drain(context, context_drain_complete, NULL)))
         pa_context_disconnect(context);
     else
@@ -726,7 +733,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
                     break;
 
                 case PLAY_SAMPLE:
-                    pa_operation_unref(pa_context_play_sample(c, sample_name, device, PA_VOLUME_NORM, simple_callback, NULL));
+                    pa_operation_unref(pa_context_play_sample(c, sample_name, sink_name, PA_VOLUME_NORM, simple_callback, NULL));
                     break;
 
                 case REMOVE_SAMPLE:
@@ -800,6 +807,42 @@ static void context_state_callback(pa_context *c, void *userdata) {
                     pa_operation_unref(pa_context_set_source_port_by_name(c, source_name, port_name, simple_callback, NULL));
                     break;
 
+                case SET_SINK_MUTE:
+                    pa_operation_unref(pa_context_set_sink_mute_by_name(c, sink_name, mute, simple_callback, NULL));
+                    break;
+
+                case SET_SOURCE_MUTE:
+                    pa_operation_unref(pa_context_set_source_mute_by_name(c, source_name, mute, simple_callback, NULL));
+                    break;
+
+                case SET_SINK_INPUT_MUTE:
+                    pa_operation_unref(pa_context_set_sink_input_mute(c, sink_input_idx, mute, simple_callback, NULL));
+                    break;
+
+                case SET_SINK_VOLUME: {
+                    pa_cvolume v;
+
+                    pa_cvolume_set(&v, 1, volume);
+                    pa_operation_unref(pa_context_set_sink_volume_by_name(c, sink_name, &v, simple_callback, NULL));
+                    break;
+                }
+
+                case SET_SOURCE_VOLUME: {
+                    pa_cvolume v;
+
+                    pa_cvolume_set(&v, 1, volume);
+                    pa_operation_unref(pa_context_set_source_volume_by_name(c, source_name, &v, simple_callback, NULL));
+                    break;
+                }
+
+                case SET_SINK_INPUT_VOLUME: {
+                    pa_cvolume v;
+
+                    pa_cvolume_set(&v, 1, volume);
+                    pa_operation_unref(pa_context_set_sink_input_volume(c, sink_input_idx, &v, simple_callback, NULL));
+                    break;
+                }
+
                 default:
                     pa_assert_not_reached();
             }
@@ -829,20 +872,30 @@ static void help(const char *argv0) {
              "%s [options] upload-sample FILENAME [NAME]\n"
              "%s [options] play-sample NAME [SINK]\n"
              "%s [options] remove-sample NAME\n"
-             "%s [options] move-sink-input ID SINK\n"
-             "%s [options] move-source-output ID SOURCE\n"
+             "%s [options] move-sink-input SINKINPUT SINK\n"
+             "%s [options] move-source-output SOURCEOUTPUT SOURCE\n"
              "%s [options] load-module NAME [ARGS ...]\n"
-             "%s [options] unload-module ID\n"
-             "%s [options] suspend-sink [SINK] 1|0\n"
-             "%s [options] suspend-source [SOURCE] 1|0\n"
-             "%s [options] set-card-profile [CARD] [PROFILE] \n"
-             "%s [options] set-sink-port [SINK] [PORT] \n"
-             "%s [options] set-source-port [SOURCE] [PORT] \n\n"
+             "%s [options] unload-module MODULE\n"
+             "%s [options] suspend-sink SINK 1|0\n"
+             "%s [options] suspend-source SOURCE 1|0\n"
+             "%s [options] set-card-profile CARD PROFILE\n"
+             "%s [options] set-sink-port SINK PORT\n"
+             "%s [options] set-source-port SOURCE PORT\n"
+             "%s [options] set-sink-volume SINK VOLUME\n"
+             "%s [options] set-source-volume SOURCE VOLUME\n"
+             "%s [options] set-sink-input-volume SINKINPUT VOLUME\n"
+             "%s [options] set-sink-mute SINK 1|0\n"
+             "%s [options] set-source-mute SOURCE 1|0\n"
+             "%s [options] set-sink-input-mute SINKINPUT 1|0\n\n"
              "  -h, --help                            Show this help\n"
              "      --version                         Show version\n\n"
              "  -s, --server=SERVER                   The name of the server to connect to\n"
              "  -n, --client-name=NAME                How to call this client on the server\n"),
-           argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0);
+           argv0, argv0, argv0, argv0, argv0,
+           argv0, argv0, argv0, argv0, argv0,
+           argv0, argv0, argv0, argv0, argv0,
+           argv0, argv0, argv0, argv0, argv0,
+           argv0);
 }
 
 enum {
@@ -965,7 +1018,7 @@ int main(int argc, char *argv[]) {
             sample_name = pa_xstrdup(argv[optind+1]);
 
             if (optind+2 < argc)
-                device = pa_xstrdup(argv[optind+2]);
+                sink_name = pa_xstrdup(argv[optind+2]);
 
         } else if (pa_streq(argv[optind], "remove-sample")) {
             action = REMOVE_SAMPLE;
@@ -1088,6 +1141,116 @@ int main(int argc, char *argv[]) {
             source_name = pa_xstrdup(argv[optind+1]);
             port_name = pa_xstrdup(argv[optind+2]);
 
+        } else if (pa_streq(argv[optind], "set-sink-volume")) {
+            uint32_t v;
+            action = SET_SINK_VOLUME;
+
+            if (argc != optind+3) {
+                pa_log(_("You have to specify a sink name/index and a volume\n"));
+                goto quit;
+            }
+
+            if (pa_atou(argv[optind+2], &v) < 0) {
+                pa_log(_("Invalid volume specification\n"));
+                goto quit;
+            }
+
+            sink_name = pa_xstrdup(argv[optind+1]);
+            volume = (pa_volume_t) v;
+
+        } else if (pa_streq(argv[optind], "set-source-volume")) {
+            uint32_t v;
+            action = SET_SOURCE_VOLUME;
+
+            if (argc != optind+3) {
+                pa_log(_("You have to specify a source name/index and a volume\n"));
+                goto quit;
+            }
+
+            if (pa_atou(argv[optind+2], &v) < 0) {
+                pa_log(_("Invalid volume specification\n"));
+                goto quit;
+            }
+
+            source_name = pa_xstrdup(argv[optind+1]);
+            volume = (pa_volume_t) v;
+
+        } else if (pa_streq(argv[optind], "set-sink-input-volume")) {
+            uint32_t v;
+            action = SET_SINK_INPUT_VOLUME;
+
+            if (argc != optind+3) {
+                pa_log(_("You have to specify a sink input index and a volume\n"));
+                goto quit;
+            }
+
+            if (pa_atou(argv[optind+1], &sink_input_idx) < 0) {
+                pa_log(_("Invalid sink input index\n"));
+                goto quit;
+            }
+
+            if (pa_atou(argv[optind+2], &v) < 0) {
+                pa_log(_("Invalid volume specification\n"));
+                goto quit;
+            }
+
+            volume = (pa_volume_t) v;
+
+        } else if (pa_streq(argv[optind], "set-sink-mute")) {
+            int b;
+            action = SET_SINK_MUTE;
+
+            if (argc != optind+3) {
+                pa_log(_("You have to specify a sink name/index and a mute boolean\n"));
+                goto quit;
+            }
+
+            if ((b = pa_parse_boolean(argv[optind+2])) < 0) {
+                pa_log(_("Invalid volume specification\n"));
+                goto quit;
+            }
+
+            sink_name = pa_xstrdup(argv[optind+1]);
+            mute = b;
+
+        } else if (pa_streq(argv[optind], "set-source-mute")) {
+            int b;
+            action = SET_SOURCE_MUTE;
+
+            if (argc != optind+3) {
+                pa_log(_("You have to specify a source name/index and a mute boolean\n"));
+                goto quit;
+            }
+
+            if ((b = pa_parse_boolean(argv[optind+2])) < 0) {
+                pa_log(_("Invalid volume specification\n"));
+                goto quit;
+            }
+
+            source_name = pa_xstrdup(argv[optind+1]);
+            mute = b;
+
+        } else if (pa_streq(argv[optind], "set-sink-input-mute")) {
+            int b;
+            action = SET_SINK_INPUT_MUTE;
+
+            if (argc != optind+3) {
+                pa_log(_("You have to specify a sink input index and a mute boolean\n"));
+                goto quit;
+            }
+
+            if (pa_atou(argv[optind+1], &sink_input_idx) < 0) {
+                pa_log(_("Invalid sink input index specification\n"));
+                goto quit;
+            }
+
+            if ((b = pa_parse_boolean(argv[optind+2])) < 0) {
+                pa_log(_("Invalid volume specification\n"));
+                goto quit;
+            }
+
+            mute = b;
+
         } else if (pa_streq(argv[optind], "help")) {
             help(bn);
             ret = 0;
@@ -1141,7 +1304,6 @@ quit:
     }
 
     pa_xfree(server);
-    pa_xfree(device);
     pa_xfree(sample_name);
     pa_xfree(sink_name);
     pa_xfree(source_name);

commit dee2aa3f0564caed698e600963b592d50cda068c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Aug 31 21:45:19 2009 +0200

    pactl: drop unnecessary newlines from pa_log() invocations

diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index 2009594..b8f4ea7 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -132,7 +132,7 @@ static void complete_action(void) {
 static void stat_callback(pa_context *c, const pa_stat_info *i, void *userdata) {
     char s[128];
     if (!i) {
-        pa_log(_("Failed to get statistics: %s\n"), pa_strerror(pa_context_errno(c)));
+        pa_log(_("Failed to get statistics: %s"), pa_strerror(pa_context_errno(c)));
         quit(1);
         return;
     }
@@ -153,7 +153,7 @@ static void get_server_info_callback(pa_context *c, const pa_server_info *i, voi
     char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
 
     if (!i) {
-        pa_log(_("Failed to get server information: %s\n"), pa_strerror(pa_context_errno(c)));
+        pa_log(_("Failed to get server information: %s"), pa_strerror(pa_context_errno(c)));
         quit(1);
         return;
     }
@@ -202,7 +202,7 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_
     char *pl;
 
     if (is_last < 0) {
-        pa_log(_("Failed to get sink information: %s\n"), pa_strerror(pa_context_errno(c)));
+        pa_log(_("Failed to get sink information: %s"), pa_strerror(pa_context_errno(c)));
         quit(1);
         return;
     }
@@ -294,7 +294,7 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
     char *pl;
 
     if (is_last < 0) {
-        pa_log(_("Failed to get source information: %s\n"), pa_strerror(pa_context_errno(c)));
+        pa_log(_("Failed to get source information: %s"), pa_strerror(pa_context_errno(c)));
         quit(1);
         return;
     }
@@ -372,7 +372,7 @@ static void get_module_info_callback(pa_context *c, const pa_module_info *i, int
     char *pl;
 
     if (is_last < 0) {
-        pa_log(_("Failed to get module information: %s\n"), pa_strerror(pa_context_errno(c)));
+        pa_log(_("Failed to get module information: %s"), pa_strerror(pa_context_errno(c)));
         quit(1);
         return;
     }
@@ -409,7 +409,7 @@ static void get_client_info_callback(pa_context *c, const pa_client_info *i, int
     char *pl;
 
     if (is_last < 0) {
-        pa_log(_("Failed to get client information: %s\n"), pa_strerror(pa_context_errno(c)));
+        pa_log(_("Failed to get client information: %s"), pa_strerror(pa_context_errno(c)));
         quit(1);
         return;
     }
@@ -444,7 +444,7 @@ static void get_card_info_callback(pa_context *c, const pa_card_info *i, int is_
     char *pl;
 
     if (is_last < 0) {
-        pa_log(_("Failed to get card information: %s\n"), pa_strerror(pa_context_errno(c)));
+        pa_log(_("Failed to get card information: %s"), pa_strerror(pa_context_errno(c)));
         complete_action();
         return;
     }
@@ -493,7 +493,7 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
     char *pl;
 
     if (is_last < 0) {
-        pa_log(_("Failed to get sink input information: %s\n"), pa_strerror(pa_context_errno(c)));
+        pa_log(_("Failed to get sink input information: %s"), pa_strerror(pa_context_errno(c)));
         quit(1);
         return;
     }
@@ -551,7 +551,7 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu
     char *pl;
 
     if (is_last < 0) {
-        pa_log(_("Failed to get source output information: %s\n"), pa_strerror(pa_context_errno(c)));
+        pa_log(_("Failed to get source output information: %s"), pa_strerror(pa_context_errno(c)));
         quit(1);
         return;
     }
@@ -602,7 +602,7 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int
     char *pl;
 
     if (is_last < 0) {
-        pa_log(_("Failed to get sample information: %s\n"), pa_strerror(pa_context_errno(c)));
+        pa_log(_("Failed to get sample information: %s"), pa_strerror(pa_context_errno(c)));
         quit(1);
         return;
     }
@@ -650,7 +650,7 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int
 
 static void simple_callback(pa_context *c, int success, void *userdata) {
     if (!success) {
-        pa_log(_("Failure: %s\n"), pa_strerror(pa_context_errno(c)));
+        pa_log(_("Failure: %s"), pa_strerror(pa_context_errno(c)));
         quit(1);
         return;
     }
@@ -660,7 +660,7 @@ static void simple_callback(pa_context *c, int success, void *userdata) {
 
 static void index_callback(pa_context *c, uint32_t idx, void *userdata) {
     if (idx == PA_INVALID_INDEX) {
-        pa_log(_("Failure: %s\n"), pa_strerror(pa_context_errno(c)));
+        pa_log(_("Failure: %s"), pa_strerror(pa_context_errno(c)));
         quit(1);
         return;
     }
@@ -684,7 +684,7 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
 
         case PA_STREAM_FAILED:
         default:
-            pa_log(_("Failed to upload sample: %s\n"), pa_strerror(pa_context_errno(pa_stream_get_context(s))));
+            pa_log(_("Failed to upload sample: %s"), pa_strerror(pa_context_errno(pa_stream_get_context(s))));
             quit(1);
     }
 }
@@ -701,7 +701,7 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata) {
 
     if ((sf_readf_float(sndfile, d, l)) != l) {
         pa_xfree(d);
-        pa_log(_("Premature end of file\n"));
+        pa_log(_("Premature end of file"));
         quit(1);
         return;
     }
@@ -854,13 +854,13 @@ static void context_state_callback(pa_context *c, void *userdata) {
 
         case PA_CONTEXT_FAILED:
         default:
-            pa_log(_("Connection failure: %s\n"), pa_strerror(pa_context_errno(c)));
+            pa_log(_("Connection failure: %s"), pa_strerror(pa_context_errno(c)));
             quit(1);
     }
 }
 
 static void exit_signal_callback(pa_mainloop_api *m, pa_signal_event *e, int sig, void *userdata) {
-    pa_log(_("Got SIGINT, exiting.\n"));
+    pa_log(_("Got SIGINT, exiting."));
     quit(0);
 }
 
@@ -950,7 +950,7 @@ int main(int argc, char *argv[]) {
                 if (!(t = pa_locale_to_utf8(optarg)) ||
                     pa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, t) < 0) {
 
-                    pa_log(_("Invalid client name '%s'\n"), t ? t : optarg);
+                    pa_log(_("Invalid client name '%s'"), t ? t : optarg);
                     pa_xfree(t);
                     goto quit;
                 }
@@ -976,7 +976,7 @@ int main(int argc, char *argv[]) {
             action = UPLOAD_SAMPLE;
 
             if (optind+1 >= argc) {
-                pa_log(_("Please specify a sample file to load\n"));
+                pa_log(_("Please specify a sample file to load"));
                 goto quit;
             }
 
@@ -989,19 +989,19 @@ int main(int argc, char *argv[]) {
 
             pa_zero(sfi);
             if (!(sndfile = sf_open(argv[optind+1], SFM_READ, &sfi))) {
-                pa_log(_("Failed to open sound file.\n"));
+                pa_log(_("Failed to open sound file."));
                 goto quit;
             }
 
             if (pa_sndfile_read_sample_spec(sndfile, &sample_spec) < 0) {
-                pa_log(_("Failed to determine sample specification from file.\n"));
+                pa_log(_("Failed to determine sample specification from file."));
                 goto quit;
             }
             sample_spec.format = PA_SAMPLE_FLOAT32;
 
             if (pa_sndfile_read_channel_map(sndfile, &channel_map) < 0) {
                 if (sample_spec.channels > 2)
-                     pa_log(_("Warning: Failed to determine sample specification from file.\n"));
+                     pa_log(_("Warning: Failed to determine sample specification from file."));
                 pa_channel_map_init_extend(&channel_map, sample_spec.channels, PA_CHANNEL_MAP_DEFAULT);
             }
 
@@ -1011,7 +1011,7 @@ int main(int argc, char *argv[]) {
         } else if (pa_streq(argv[optind], "play-sample")) {
             action = PLAY_SAMPLE;
             if (argc != optind+2 && argc != optind+3) {
-                pa_log(_("You have to specify a sample name to play\n"));
+                pa_log(_("You have to specify a sample name to play"));
                 goto quit;
             }
 
@@ -1023,7 +1023,7 @@ int main(int argc, char *argv[]) {
         } else if (pa_streq(argv[optind], "remove-sample")) {
             action = REMOVE_SAMPLE;
             if (argc != optind+2) {
-                pa_log(_("You have to specify a sample name to remove\n"));
+                pa_log(_("You have to specify a sample name to remove"));
                 goto quit;
             }
 
@@ -1032,7 +1032,7 @@ int main(int argc, char *argv[]) {
         } else if (pa_streq(argv[optind], "move-sink-input")) {
             action = MOVE_SINK_INPUT;
             if (argc != optind+3) {
-                pa_log(_("You have to specify a sink input index and a sink\n"));
+                pa_log(_("You have to specify a sink input index and a sink"));
                 goto quit;
             }
 
@@ -1042,7 +1042,7 @@ int main(int argc, char *argv[]) {
         } else if (pa_streq(argv[optind], "move-source-output")) {
             action = MOVE_SOURCE_OUTPUT;
             if (argc != optind+3) {
-                pa_log(_("You have to specify a source output index and a source\n"));
+                pa_log(_("You have to specify a source output index and a source"));
                 goto quit;
             }
 
@@ -1057,7 +1057,7 @@ int main(int argc, char *argv[]) {
             action = LOAD_MODULE;
 
             if (argc <= optind+1) {
-                pa_log(_("You have to specify a module name and arguments.\n"));
+                pa_log(_("You have to specify a module name and arguments."));
                 goto quit;
             }
 
@@ -1077,7 +1077,7 @@ int main(int argc, char *argv[]) {
             action = UNLOAD_MODULE;
 
             if (argc != optind+2) {
-                pa_log(_("You have to specify a module index\n"));
+                pa_log(_("You have to specify a module index"));
                 goto quit;
             }
 
@@ -1087,7 +1087,7 @@ int main(int argc, char *argv[]) {
             action = SUSPEND_SINK;
 
             if (argc > optind+3 || optind+1 >= argc) {
-                pa_log(_("You may not specify more than one sink. You have to specify a boolean value.\n"));
+                pa_log(_("You may not specify more than one sink. You have to specify a boolean value."));
                 goto quit;
             }
 
@@ -1100,7 +1100,7 @@ int main(int argc, char *argv[]) {
             action = SUSPEND_SOURCE;
 
             if (argc > optind+3 || optind+1 >= argc) {
-                pa_log(_("You may not specify more than one source. You have to specify a boolean value.\n"));
+                pa_log(_("You may not specify more than one source. You have to specify a boolean value."));
                 goto quit;
             }
 
@@ -1112,7 +1112,7 @@ int main(int argc, char *argv[]) {
             action = SET_CARD_PROFILE;
 
             if (argc != optind+3) {
-                pa_log(_("You have to specify a card name/index and a profile name\n"));
+                pa_log(_("You have to specify a card name/index and a profile name"));
                 goto quit;
             }
 
@@ -1123,7 +1123,7 @@ int main(int argc, char *argv[]) {
             action = SET_SINK_PORT;
 
             if (argc != optind+3) {
-                pa_log(_("You have to specify a sink name/index and a port name\n"));
+                pa_log(_("You have to specify a sink name/index and a port name"));
                 goto quit;
             }
 
@@ -1134,7 +1134,7 @@ int main(int argc, char *argv[]) {
             action = SET_SOURCE_PORT;
 
             if (argc != optind+3) {
-                pa_log(_("You have to specify a source name/index and a port name\n"));
+                pa_log(_("You have to specify a source name/index and a port name"));
                 goto quit;
             }
 
@@ -1146,12 +1146,12 @@ int main(int argc, char *argv[]) {
             action = SET_SINK_VOLUME;
 
             if (argc != optind+3) {
-                pa_log(_("You have to specify a sink name/index and a volume\n"));
+                pa_log(_("You have to specify a sink name/index and a volume"));
                 goto quit;
             }
 
             if (pa_atou(argv[optind+2], &v) < 0) {
-                pa_log(_("Invalid volume specification\n"));
+                pa_log(_("Invalid volume specification"));
                 goto quit;
             }
 
@@ -1163,12 +1163,12 @@ int main(int argc, char *argv[]) {
             action = SET_SOURCE_VOLUME;
 
             if (argc != optind+3) {
-                pa_log(_("You have to specify a source name/index and a volume\n"));
+                pa_log(_("You have to specify a source name/index and a volume"));
                 goto quit;
             }
 
             if (pa_atou(argv[optind+2], &v) < 0) {
-                pa_log(_("Invalid volume specification\n"));
+                pa_log(_("Invalid volume specification"));
                 goto quit;
             }
 
@@ -1180,17 +1180,17 @@ int main(int argc, char *argv[]) {
             action = SET_SINK_INPUT_VOLUME;
 
             if (argc != optind+3) {
-                pa_log(_("You have to specify a sink input index and a volume\n"));
+                pa_log(_("You have to specify a sink input index and a volume"));
                 goto quit;
             }
 
             if (pa_atou(argv[optind+1], &sink_input_idx) < 0) {
-                pa_log(_("Invalid sink input index\n"));
+                pa_log(_("Invalid sink input index"));
                 goto quit;
             }
 
             if (pa_atou(argv[optind+2], &v) < 0) {
-                pa_log(_("Invalid volume specification\n"));
+                pa_log(_("Invalid volume specification"));
                 goto quit;
             }
 
@@ -1201,12 +1201,12 @@ int main(int argc, char *argv[]) {
             action = SET_SINK_MUTE;
 
             if (argc != optind+3) {
-                pa_log(_("You have to specify a sink name/index and a mute boolean\n"));
+                pa_log(_("You have to specify a sink name/index and a mute boolean"));
                 goto quit;
             }
 
             if ((b = pa_parse_boolean(argv[optind+2])) < 0) {
-                pa_log(_("Invalid volume specification\n"));
+                pa_log(_("Invalid volume specification"));
                 goto quit;
             }
 
@@ -1218,12 +1218,12 @@ int main(int argc, char *argv[]) {
             action = SET_SOURCE_MUTE;
 
             if (argc != optind+3) {
-                pa_log(_("You have to specify a source name/index and a mute boolean\n"));
+                pa_log(_("You have to specify a source name/index and a mute boolean"));
                 goto quit;
             }
 
             if ((b = pa_parse_boolean(argv[optind+2])) < 0) {
-                pa_log(_("Invalid volume specification\n"));
+                pa_log(_("Invalid volume specification"));
                 goto quit;
             }
 
@@ -1235,17 +1235,17 @@ int main(int argc, char *argv[]) {
             action = SET_SINK_INPUT_MUTE;
 
             if (argc != optind+3) {
-                pa_log(_("You have to specify a sink input index and a mute boolean\n"));
+                pa_log(_("You have to specify a sink input index and a mute boolean"));
                 goto quit;
             }
 
             if (pa_atou(argv[optind+1], &sink_input_idx) < 0) {
-                pa_log(_("Invalid sink input index specification\n"));
+                pa_log(_("Invalid sink input index specification"));
                 goto quit;
             }
 
             if ((b = pa_parse_boolean(argv[optind+2])) < 0) {
-                pa_log(_("Invalid volume specification\n"));
+                pa_log(_("Invalid volume specification"));
                 goto quit;
             }
 
@@ -1259,12 +1259,12 @@ int main(int argc, char *argv[]) {
     }
 
     if (action == NONE) {
-        pa_log(_("No valid command specified.\n"));
+        pa_log(_("No valid command specified."));
         goto quit;
     }
 
     if (!(m = pa_mainloop_new())) {
-        pa_log(_("pa_mainloop_new() failed.\n"));
+        pa_log(_("pa_mainloop_new() failed."));
         goto quit;
     }
 
@@ -1276,7 +1276,7 @@ int main(int argc, char *argv[]) {
     pa_disable_sigpipe();
 
     if (!(context = pa_context_new_with_proplist(mainloop_api, NULL, proplist))) {
-        pa_log(_("pa_context_new() failed.\n"));
+        pa_log(_("pa_context_new() failed."));
         goto quit;
     }
 
@@ -1287,7 +1287,7 @@ int main(int argc, char *argv[]) {
     }
 
     if (pa_mainloop_run(m, &ret) < 0) {
-        pa_log(_("pa_mainloop_run() failed.\n"));
+        pa_log(_("pa_mainloop_run() failed."));
         goto quit;
     }
 

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list