diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/pacat.c | 131 | ||||
| -rw-r--r-- | src/utils/pacmd.c | 28 | ||||
| -rw-r--r-- | src/utils/pactl.c | 174 | ||||
| -rw-r--r-- | src/utils/padsp.c | 36 | ||||
| -rw-r--r-- | src/utils/paplay.c | 57 | ||||
| -rw-r--r-- | src/utils/pasuspender.c | 44 | ||||
| -rw-r--r-- | src/utils/pax11publish.c | 35 | 
7 files changed, 263 insertions, 242 deletions
diff --git a/src/utils/pacat.c b/src/utils/pacat.c index 78b9cef8..c1826d7b 100644 --- a/src/utils/pacat.c +++ b/src/utils/pacat.c @@ -33,15 +33,13 @@  #include <stdlib.h>  #include <getopt.h>  #include <fcntl.h> +#include <locale.h> +#include <pulse/i18n.h>  #include <pulse/pulseaudio.h>  #define TIME_EVENT_USEC 50000 -#if PA_API_VERSION < 10 -#error Invalid PulseAudio API version -#endif -  #define CLEAR_LINE "\x1B[K"  static enum { RECORD, PLAYBACK } mode = PLAYBACK; @@ -92,7 +90,7 @@ static void do_stream_write(size_t length) {          l = buffer_length;      if (pa_stream_write(stream, (uint8_t*) buffer + buffer_index, l, NULL, 0, PA_SEEK_RELATIVE) < 0) { -        fprintf(stderr, "pa_stream_write() failed: %s\n", pa_strerror(pa_context_errno(context))); +        fprintf(stderr, _("pa_stream_write() failed: %s\n"), pa_strerror(pa_context_errno(context)));          quit(1);          return;      } @@ -131,7 +129,7 @@ static void stream_read_callback(pa_stream *s, size_t length, void *userdata) {          mainloop_api->io_enable(stdio_event, PA_IO_EVENT_OUTPUT);      if (pa_stream_peek(s, &data, &length) < 0) { -        fprintf(stderr, "pa_stream_peek() failed: %s\n", pa_strerror(pa_context_errno(context))); +        fprintf(stderr, _("pa_stream_peek() failed: %s\n"), pa_strerror(pa_context_errno(context)));          quit(1);          return;      } @@ -140,9 +138,9 @@ static void stream_read_callback(pa_stream *s, size_t length, void *userdata) {      assert(length > 0);      if (buffer) { -        fprintf(stderr, "Buffer overrun, dropping incoming data\n"); +        fprintf(stderr, _("Buffer overrun, dropping incoming data\n"));          if (pa_stream_drop(s) < 0) { -            fprintf(stderr, "pa_stream_drop() failed: %s\n", pa_strerror(pa_context_errno(context))); +            fprintf(stderr, _("pa_stream_drop() failed: %s\n"), pa_strerror(pa_context_errno(context)));              quit(1);          }          return; @@ -168,25 +166,25 @@ static void stream_state_callback(pa_stream *s, void *userdata) {                  const pa_buffer_attr *a;                  char cmt[PA_CHANNEL_MAP_SNPRINT_MAX], sst[PA_SAMPLE_SPEC_SNPRINT_MAX]; -                fprintf(stderr, "Stream successfully created.\n"); +                fprintf(stderr, _("Stream successfully created.\n"));                  if (!(a = pa_stream_get_buffer_attr(s))) -                    fprintf(stderr, "pa_stream_get_buffer_attr() failed: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s)))); +                    fprintf(stderr, _("pa_stream_get_buffer_attr() failed: %s\n"), pa_strerror(pa_context_errno(pa_stream_get_context(s))));                  else {                      if (mode == PLAYBACK) -                        fprintf(stderr, "Buffer metrics: maxlength=%u, tlength=%u, prebuf=%u, minreq=%u\n", a->maxlength, a->tlength, a->prebuf, a->minreq); +                        fprintf(stderr, _("Buffer metrics: maxlength=%u, tlength=%u, prebuf=%u, minreq=%u\n"), a->maxlength, a->tlength, a->prebuf, a->minreq);                      else {                          assert(mode == RECORD); -                        fprintf(stderr, "Buffer metrics: maxlength=%u, fragsize=%u\n", a->maxlength, a->fragsize); +                        fprintf(stderr, _("Buffer metrics: maxlength=%u, fragsize=%u\n"), a->maxlength, a->fragsize);                      }                  } -                fprintf(stderr, "Using sample spec '%s', channel map '%s'.\n", +                fprintf(stderr, _("Using sample spec '%s', channel map '%s'.\n"),                          pa_sample_spec_snprint(sst, sizeof(sst), pa_stream_get_sample_spec(s)),                          pa_channel_map_snprint(cmt, sizeof(cmt), pa_stream_get_channel_map(s))); -                fprintf(stderr, "Connected to device %s (%u, %ssuspended).\n", +                fprintf(stderr, _("Connected to device %s (%u, %ssuspended).\n"),                          pa_stream_get_device_name(s),                          pa_stream_get_device_index(s),                          pa_stream_is_suspended(s) ? "" : "not "); @@ -196,7 +194,7 @@ static void stream_state_callback(pa_stream *s, void *userdata) {          case PA_STREAM_FAILED:          default: -            fprintf(stderr, "Stream error: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s)))); +            fprintf(stderr, _("Stream error: %s\n"), pa_strerror(pa_context_errno(pa_stream_get_context(s))));              quit(1);      }  } @@ -206,9 +204,9 @@ static void stream_suspended_callback(pa_stream *s, void *userdata) {      if (verbose) {          if (pa_stream_is_suspended(s)) -            fprintf(stderr, "Stream device suspended." CLEAR_LINE " \n"); +            fprintf(stderr, _("Stream device suspended.%s \n"), CLEAR_LINE);          else -            fprintf(stderr, "Stream device resumed." CLEAR_LINE " \n"); +            fprintf(stderr, _("Stream device resumed.%s \n"), CLEAR_LINE);      }  } @@ -216,28 +214,28 @@ static void stream_underflow_callback(pa_stream *s, void *userdata) {      assert(s);      if (verbose) -        fprintf(stderr, "Stream underrun." CLEAR_LINE " \n"); +        fprintf(stderr, _("Stream underrun.%s \n"),  CLEAR_LINE);  }  static void stream_overflow_callback(pa_stream *s, void *userdata) {      assert(s);      if (verbose) -        fprintf(stderr, "Stream overrun." CLEAR_LINE " \n"); +        fprintf(stderr, _("Stream overrun.%s \n"), CLEAR_LINE);  }  static void stream_started_callback(pa_stream *s, void *userdata) {      assert(s);      if (verbose) -        fprintf(stderr, "Stream started." CLEAR_LINE " \n"); +        fprintf(stderr, _("Stream started.%s \n"), CLEAR_LINE);  }  static void stream_moved_callback(pa_stream *s, void *userdata) {      assert(s);      if (verbose) -        fprintf(stderr, "Stream moved to device %s (%u, %ssuspended)." CLEAR_LINE " \n", pa_stream_get_device_name(s), pa_stream_get_device_index(s), pa_stream_is_suspended(s) ? "" : "not "); +        fprintf(stderr, _("Stream moved to device %s (%u, %ssuspended).%s \n"), pa_stream_get_device_name(s), pa_stream_get_device_index(s), pa_stream_is_suspended(s) ? "" : _("not "),  CLEAR_LINE);  }  /* This is called whenever the context status changes */ @@ -258,10 +256,10 @@ static void context_state_callback(pa_context *c, void *userdata) {              assert(!stream);              if (verbose) -                fprintf(stderr, "Connection established." CLEAR_LINE " \n"); +                fprintf(stderr, _("Connection established.%s \n"), CLEAR_LINE);              if (!(stream = pa_stream_new(c, stream_name, &sample_spec, channel_map_set ? &channel_map : NULL))) { -                fprintf(stderr, "pa_stream_new() failed: %s\n", pa_strerror(pa_context_errno(c))); +                fprintf(stderr, _("pa_stream_new() failed: %s\n"), pa_strerror(pa_context_errno(c)));                  goto fail;              } @@ -276,8 +274,8 @@ static void context_state_callback(pa_context *c, void *userdata) {              if (latency > 0) {                  memset(&buffer_attr, 0, sizeof(buffer_attr)); -                buffer_attr.tlength = latency; -                buffer_attr.minreq = process_time; +                buffer_attr.tlength = (uint32_t) latency; +                buffer_attr.minreq = (uint32_t) process_time;                  buffer_attr.maxlength = (uint32_t) -1;                  buffer_attr.prebuf = (uint32_t) -1;                  flags |= PA_STREAM_ADJUST_LATENCY; @@ -286,13 +284,13 @@ static void context_state_callback(pa_context *c, void *userdata) {              if (mode == PLAYBACK) {                  pa_cvolume cv;                  if ((r = pa_stream_connect_playback(stream, device, latency > 0 ? &buffer_attr : NULL, flags, pa_cvolume_set(&cv, sample_spec.channels, volume), NULL)) < 0) { -                    fprintf(stderr, "pa_stream_connect_playback() failed: %s\n", pa_strerror(pa_context_errno(c))); +                    fprintf(stderr, _("pa_stream_connect_playback() failed: %s\n"), pa_strerror(pa_context_errno(c)));                      goto fail;                  }              } else {                  if ((r = pa_stream_connect_record(stream, device, latency > 0 ? &buffer_attr : NULL, flags)) < 0) { -                    fprintf(stderr, "pa_stream_connect_record() failed: %s\n", pa_strerror(pa_context_errno(c))); +                    fprintf(stderr, _("pa_stream_connect_record() failed: %s\n"), pa_strerror(pa_context_errno(c)));                      goto fail;                  }              } @@ -306,7 +304,7 @@ static void context_state_callback(pa_context *c, void *userdata) {          case PA_CONTEXT_FAILED:          default: -            fprintf(stderr, "Connection failure: %s\n", pa_strerror(pa_context_errno(c))); +            fprintf(stderr, _("Connection failure: %s\n"), pa_strerror(pa_context_errno(c)));              goto fail;      } @@ -327,12 +325,12 @@ static void stream_drain_complete(pa_stream*s, int success, void *userdata) {      pa_operation *o;      if (!success) { -        fprintf(stderr, "Failed to drain stream: %s\n", pa_strerror(pa_context_errno(context))); +        fprintf(stderr, _("Failed to drain stream: %s\n"), pa_strerror(pa_context_errno(context)));          quit(1);      }      if (verbose) -        fprintf(stderr, "Playback stream drained.\n"); +        fprintf(stderr, _("Playback stream drained.\n"));      pa_stream_disconnect(stream);      pa_stream_unref(stream); @@ -342,7 +340,7 @@ static void stream_drain_complete(pa_stream*s, int success, void *userdata) {          pa_context_disconnect(context);      else {          if (verbose) -            fprintf(stderr, "Draining connection to server.\n"); +            fprintf(stderr, _("Draining connection to server.\n"));      }  } @@ -368,13 +366,13 @@ static void stdin_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_even      if ((r = read(fd, buffer, l)) <= 0) {          if (r == 0) {              if (verbose) -                fprintf(stderr, "Got EOF.\n"); +                fprintf(stderr, _("Got EOF.\n"));              if (stream) {                  pa_operation *o;                  if (!(o = pa_stream_drain(stream, stream_drain_complete, NULL))) { -                    fprintf(stderr, "pa_stream_drain(): %s\n", pa_strerror(pa_context_errno(context))); +                    fprintf(stderr, _("pa_stream_drain(): %s\n"), pa_strerror(pa_context_errno(context)));                      quit(1);                      return;                  } @@ -384,7 +382,7 @@ static void stdin_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_even                  quit(0);          } else { -            fprintf(stderr, "read() failed: %s\n", strerror(errno)); +            fprintf(stderr, _("read() failed: %s\n"), strerror(errno));              quit(1);          } @@ -393,7 +391,7 @@ static void stdin_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_even          return;      } -    buffer_length = r; +    buffer_length = (uint32_t) r;      buffer_index = 0;      if (w) @@ -416,7 +414,7 @@ static void stdout_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_eve      assert(buffer_length);      if ((r = write(fd, (uint8_t*) buffer+buffer_index, buffer_length)) <= 0) { -        fprintf(stderr, "write() failed: %s\n", strerror(errno)); +        fprintf(stderr, _("write() failed: %s\n"), strerror(errno));          quit(1);          mainloop_api->io_free(stdio_event); @@ -424,8 +422,8 @@ static void stdout_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_eve          return;      } -    buffer_length -= r; -    buffer_index += r; +    buffer_length -= (uint32_t) r; +    buffer_index += (uint32_t) r;      if (!buffer_length) {          pa_xfree(buffer); @@ -437,7 +435,7 @@ static void stdout_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_eve  /* UNIX signal to quit recieved */  static void exit_signal_callback(pa_mainloop_api*m, pa_signal_event *e, int sig, void *userdata) {      if (verbose) -        fprintf(stderr, "Got signal, exiting.\n"); +        fprintf(stderr, _("Got signal, exiting.\n"));      quit(0);  } @@ -451,14 +449,14 @@ static void stream_update_timing_callback(pa_stream *s, int success, void *userd      if (!success ||          pa_stream_get_time(s, &usec) < 0 ||          pa_stream_get_latency(s, &l, &negative) < 0) { -        fprintf(stderr, "Failed to get latency: %s\n", pa_strerror(pa_context_errno(context))); +        fprintf(stderr, _("Failed to get latency: %s\n"), pa_strerror(pa_context_errno(context)));          quit(1);          return;      } -    fprintf(stderr, "Time: %0.3f sec; Latency: %0.0f usec.  \r", +    fprintf(stderr, _("Time: %0.3f sec; Latency: %0.0f usec.  \r"),              (float) usec / 1000000, -            (float) l * (negative?-1:1)); +            (float) l * (negative?-1.0f:1.0f));  }  /* Someone requested that the latency is shown */ @@ -476,7 +474,7 @@ static void time_event_callback(pa_mainloop_api*m, pa_time_event *e, const struc      if (stream && pa_stream_get_state(stream) == PA_STREAM_READY) {          pa_operation *o;          if (!(o = pa_stream_update_timing_info(stream, stream_update_timing_callback, NULL))) -            fprintf(stderr, "pa_stream_update_timing_info() failed: %s\n", pa_strerror(pa_context_errno(context))); +            fprintf(stderr, _("pa_stream_update_timing_info() failed: %s\n"), pa_strerror(pa_context_errno(context)));          else              pa_operation_unref(o);      } @@ -489,7 +487,7 @@ static void time_event_callback(pa_mainloop_api*m, pa_time_event *e, const struc  static void help(const char *argv0) { -    printf("%s [options]\n\n" +    printf(_("%s [options]\n\n"             "  -h, --help                            Show this help\n"             "      --version                         Show version\n\n"             "  -r, --record                          Create a connection for recording\n" @@ -515,7 +513,7 @@ static void help(const char *argv0) {             "      --no-remix                        Don't upmix or downmix channels.\n"             "      --no-remap                        Map channels by index instead of name.\n"             "      --latency=BYTES                   Request the specified latency in bytes.\n" -           "      --process-time=BYTES              Request the specified process time per request in bytes.\n" +           "      --process-time=BYTES              Request the specified process time per request in bytes.\n")             ,             argv0);  } @@ -568,6 +566,9 @@ int main(int argc, char *argv[]) {          {NULL,           0, NULL, 0}      }; +    setlocale(LC_ALL, ""); +    bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR); +      if (!(bn = strrchr(argv[0], '/')))          bn = argv[0];      else @@ -587,7 +588,7 @@ int main(int argc, char *argv[]) {                  goto quit;              case ARG_VERSION: -                printf("pacat "PACKAGE_VERSION"\nCompiled with libpulse %s\nLinked with libpulse %s\n", pa_get_headers_version(), pa_get_library_version()); +                printf(_("pacat %s\nCompiled with libpulse %s\nLinked with libpulse %s\n"), PACKAGE_VERSION, pa_get_headers_version(), pa_get_library_version());                  ret = 0;                  goto quit; @@ -625,12 +626,12 @@ int main(int argc, char *argv[]) {              case ARG_VOLUME: {                  int v = atoi(optarg); -                volume = v < 0 ? 0 : v; +                volume = v < 0 ? 0U : (pa_volume_t) v;                  break;              }              case ARG_CHANNELS: -                sample_spec.channels = atoi(optarg); +                sample_spec.channels = (uint8_t) atoi(optarg);                  break;              case ARG_SAMPLEFORMAT: @@ -638,12 +639,12 @@ int main(int argc, char *argv[]) {                  break;              case ARG_SAMPLERATE: -                sample_spec.rate = atoi(optarg); +                sample_spec.rate = (uint32_t) atoi(optarg);                  break;              case ARG_CHANNELMAP:                  if (!pa_channel_map_parse(&channel_map, optarg)) { -                    fprintf(stderr, "Invalid channel map '%s'\n", optarg); +                    fprintf(stderr, _("Invalid channel map '%s'\n"), optarg);                      goto quit;                  } @@ -671,15 +672,15 @@ int main(int argc, char *argv[]) {                  break;              case ARG_LATENCY: -                if (((latency = atoi(optarg))) <= 0) { -                    fprintf(stderr, "Invalid latency specification '%s'\n", optarg); +                if (((latency = (size_t) atoi(optarg))) <= 0) { +                    fprintf(stderr, _("Invalid latency specification '%s'\n"), optarg);                      goto quit;                  }                  break;              case ARG_PROCESS_TIME: -                if (((process_time = atoi(optarg))) <= 0) { -                    fprintf(stderr, "Invalid process time specification '%s'\n", optarg); +                if (((process_time = (size_t) atoi(optarg))) <= 0) { +                    fprintf(stderr, _("Invalid process time specification '%s'\n"), optarg);                      goto quit;                  }                  break; @@ -690,19 +691,19 @@ int main(int argc, char *argv[]) {      }      if (!pa_sample_spec_valid(&sample_spec)) { -        fprintf(stderr, "Invalid sample specification\n"); +        fprintf(stderr, _("Invalid sample specification\n"));          goto quit;      }      if (channel_map_set && channel_map.channels != sample_spec.channels) { -        fprintf(stderr, "Channel map doesn't match sample specification\n"); +        fprintf(stderr, _("Channel map doesn't match sample specification\n"));          goto quit;      }      if (verbose) {          char t[PA_SAMPLE_SPEC_SNPRINT_MAX];          pa_sample_spec_snprint(t, sizeof(t), &sample_spec); -        fprintf(stderr, "Opening a %s stream with sample specification '%s'.\n", mode == RECORD ? "recording" : "playback", t); +        fprintf(stderr, _("Opening a %s stream with sample specification '%s'.\n"), mode == RECORD ? _("recording") : _("playback"), t);      }      if (!(optind >= argc)) { @@ -710,12 +711,12 @@ int main(int argc, char *argv[]) {              int fd;              if ((fd = open(argv[optind], mode == PLAYBACK ? O_RDONLY : O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0) { -                fprintf(stderr, "open(): %s\n", strerror(errno)); +                fprintf(stderr, _("open(): %s\n"), strerror(errno));                  goto quit;              }              if (dup2(fd, mode == PLAYBACK ? 0 : 1) < 0) { -                fprintf(stderr, "dup2(): %s\n", strerror(errno)); +                fprintf(stderr, _("dup2(): %s\n"), strerror(errno));                  goto quit;              } @@ -725,7 +726,7 @@ int main(int argc, char *argv[]) {                  stream_name = pa_xstrdup(argv[optind]);          } else { -            fprintf(stderr, "Too many arguments.\n"); +            fprintf(stderr, _("Too many arguments.\n"));              goto quit;          }      } @@ -738,7 +739,7 @@ int main(int argc, char *argv[]) {      /* Set up a new main loop */      if (!(m = pa_mainloop_new())) { -        fprintf(stderr, "pa_mainloop_new() failed.\n"); +        fprintf(stderr, _("pa_mainloop_new() failed.\n"));          goto quit;      } @@ -759,13 +760,13 @@ int main(int argc, char *argv[]) {                                               mode == PLAYBACK ? STDIN_FILENO : STDOUT_FILENO,                                               mode == PLAYBACK ? PA_IO_EVENT_INPUT : PA_IO_EVENT_OUTPUT,                                               mode == PLAYBACK ? stdin_callback : stdout_callback, NULL))) { -        fprintf(stderr, "io_new() failed.\n"); +        fprintf(stderr, _("io_new() failed.\n"));          goto quit;      }      /* Create a new connection context */      if (!(context = pa_context_new(mainloop_api, client_name))) { -        fprintf(stderr, "pa_context_new() failed.\n"); +        fprintf(stderr, _("pa_context_new() failed.\n"));          goto quit;      } @@ -781,14 +782,14 @@ int main(int argc, char *argv[]) {          pa_timeval_add(&tv, TIME_EVENT_USEC);          if (!(time_event = mainloop_api->time_new(mainloop_api, &tv, time_event_callback, NULL))) { -            fprintf(stderr, "time_new() failed.\n"); +            fprintf(stderr, _("time_new() failed.\n"));              goto quit;          }      }      /* Run the main loop */      if (pa_mainloop_run(m, &ret) < 0) { -        fprintf(stderr, "pa_mainloop_run() failed.\n"); +        fprintf(stderr, _("pa_mainloop_run() failed.\n"));          goto quit;      } diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c index 67d95252..2c89c8d9 100644 --- a/src/utils/pacmd.c +++ b/src/utils/pacmd.c @@ -31,16 +31,18 @@  #include <errno.h>  #include <string.h>  #include <sys/un.h> +#include <locale.h>  #include <pulse/error.h>  #include <pulse/util.h>  #include <pulse/xmalloc.h> +#include <pulse/i18n.h>  #include <pulsecore/core-util.h>  #include <pulsecore/log.h>  #include <pulsecore/pid.h> -int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) { +int main(int argc, char*argv[]) {      pid_t pid ;      int fd = -1;      int ret = 1, i; @@ -50,13 +52,16 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {      fd_set ifds, ofds;      char *cli; +    setlocale(LC_ALL, ""); +    bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR); +      if (pa_pid_file_check_running(&pid, "pulseaudio") < 0) { -        pa_log("no PulseAudio daemon running"); +        pa_log("No PulseAudio daemon running");          goto fail;      }      if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) { -        pa_log("socket(PF_UNIX, SOCK_STREAM, 0): %s", strerror(errno)); +        pa_log(_("socket(PF_UNIX, SOCK_STREAM, 0): %s"), strerror(errno));          goto fail;      } @@ -73,7 +78,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {          int r;          if ((r = connect(fd, (struct sockaddr*) &sa, sizeof(sa))) < 0 && (errno != ECONNREFUSED && errno != ENOENT)) { -            pa_log("connect(): %s", strerror(errno)); +            pa_log(_("connect(): %s"), strerror(errno));              goto fail;          } @@ -81,7 +86,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {              break;          if (pa_pid_file_kill(SIGUSR2, NULL, "pulseaudio") < 0) { -            pa_log("failed to kill PulseAudio daemon."); +            pa_log(_("Failed to kill PulseAudio daemon."));              goto fail;          } @@ -89,7 +94,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {      }      if (i >= 5) { -        pa_log("daemon not responding."); +        pa_log(_("Daemon not responding."));          goto fail;      } @@ -104,7 +109,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {      for (;;) {          if (select(FD_SETSIZE, &ifds, &ofds, NULL, NULL) < 0) { -            pa_log("select(): %s", strerror(errno)); +            pa_log(_("select(): %s"), strerror(errno));              goto fail;          } @@ -116,7 +121,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {                  if (r == 0)                      break; -                pa_log("read(): %s", strerror(errno)); +                pa_log(_("read(): %s"), strerror(errno));                  goto fail;              } @@ -132,7 +137,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {                  if (r == 0)                      break; -                pa_log("read(): %s", strerror(errno)); +                pa_log(_("read(): %s"), strerror(errno));                  goto fail;              } @@ -145,7 +150,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {              assert(obuf_length);              if ((r = write(1, obuf + obuf_index, obuf_length)) < 0) { -                pa_log("write(): %s", strerror(errno)); +                pa_log(_("write(): %s"), strerror(errno));                  goto fail;              } @@ -159,7 +164,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {              assert(ibuf_length);              if ((r = write(fd, ibuf + ibuf_index, ibuf_length)) < 0) { -                pa_log("write(): %s", strerror(errno)); +                pa_log(_("write(): %s"), strerror(errno));                  goto fail;              } @@ -182,7 +187,6 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {              FD_SET(fd, &ofds);      } -      ret = 0;  fail: diff --git a/src/utils/pactl.c b/src/utils/pactl.c index 4cca2f86..2f430ca7 100644 --- a/src/utils/pactl.c +++ b/src/utils/pactl.c @@ -32,16 +32,14 @@  #include <stdlib.h>  #include <limits.h>  #include <getopt.h> +#include <locale.h>  #include <sndfile.h> +#include <pulse/i18n.h>  #include <pulse/pulseaudio.h>  #include <pulsecore/core-util.h> -#if PA_API_VERSION < 10 -#error Invalid PulseAudio API version -#endif -  #define BUFSIZE 1024  static pa_context *context = NULL; @@ -106,19 +104,19 @@ static void complete_action(void) {  static void stat_callback(pa_context *c, const pa_stat_info *i, void *userdata) {      char s[128];      if (!i) { -        fprintf(stderr, "Failed to get statistics: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failed to get statistics: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      }      pa_bytes_snprint(s, sizeof(s), i->memblock_total_size); -    printf("Currently in use: %u blocks containing %s bytes total.\n", i->memblock_total, s); +    printf(_("Currently in use: %u blocks containing %s bytes total.\n"), i->memblock_total, s);      pa_bytes_snprint(s, sizeof(s), i->memblock_allocated_size); -    printf("Allocated during whole lifetime: %u blocks containing %s bytes total.\n", i->memblock_allocated, s); +    printf(_("Allocated during whole lifetime: %u blocks containing %s bytes total.\n"), i->memblock_allocated, s);      pa_bytes_snprint(s, sizeof(s), i->scache_size); -    printf("Sample cache size: %s\n", s); +    printf(_("Sample cache size: %s\n"), s);      complete_action();  } @@ -127,21 +125,21 @@ static void get_server_info_callback(pa_context *c, const pa_server_info *i, voi      char s[PA_SAMPLE_SPEC_SNPRINT_MAX];      if (!i) { -        fprintf(stderr, "Failed to get server information: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failed to get server information: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      }      pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec); -    printf("User name: %s\n" +    printf(_("User name: %s\n"             "Host Name: %s\n"             "Server Name: %s\n"             "Server Version: %s\n"             "Default Sample Specification: %s\n"             "Default Sink: %s\n"             "Default Source: %s\n" -           "Cookie: %08x\n", +           "Cookie: %08x\n"),             i->user_name,             i->host_name,             i->server_name, @@ -159,7 +157,7 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_      char *pl;      if (is_last < 0) { -        fprintf(stderr, "Failed to get sink information: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failed to get sink information: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      } @@ -175,7 +173,7 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_          printf("\n");      nl = 1; -    printf("*** Sink #%u ***\n" +    printf(_("*** Sink #%u ***\n"             "Name: %s\n"             "Driver: %s\n"             "Sample Specification: %s\n" @@ -185,14 +183,14 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_             "Monitor Source: %s\n"             "Latency: %0.0f usec, configured %0.0f usec\n"             "Flags: %s%s%s%s%s%s\n" -           "Properties:\n%s", +           "Properties:\n%s"),             i->index,             i->name,             pa_strnull(i->driver),             pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec),             pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),             i->owner_module, -           i->mute ? "muted" : pa_cvolume_snprint(cv, sizeof(cv), &i->volume), +           i->mute ? _("muted") : pa_cvolume_snprint(cv, sizeof(cv), &i->volume),             pa_strnull(i->monitor_source_name),             (double) i->latency, (double) i->configured_latency,             i->flags & PA_SINK_HARDWARE ? "HARDWARE " : "", @@ -211,7 +209,7 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int      char *pl;      if (is_last < 0) { -        fprintf(stderr, "Failed to get source information: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failed to get source information: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      } @@ -227,7 +225,7 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int          printf("\n");      nl = 1; -    printf("*** Source #%u ***\n" +    printf(_("*** Source #%u ***\n"             "Name: %s\n"             "Driver: %s\n"             "Sample Specification: %s\n" @@ -237,7 +235,7 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int             "Monitor of Sink: %s\n"             "Latency: %0.0f usec, configured %0.0f usec\n"             "Flags: %s%s%s%s%s%s\n" -           "Properties:\n%s", +           "Properties:\n%s"),             i->index,             i->name,             pa_strnull(i->driver), @@ -245,7 +243,7 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int             pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),             i->owner_module,             i->mute ? "muted" : pa_cvolume_snprint(cv, sizeof(cv), &i->volume), -           i->monitor_of_sink_name ? i->monitor_of_sink_name : "n/a", +           i->monitor_of_sink_name ? i->monitor_of_sink_name : _("n/a"),             (double) i->latency, (double) i->configured_latency,             i->flags & PA_SOURCE_HARDWARE ? "HARDWARE " : "",             i->flags & PA_SOURCE_NETWORK ? "NETWORK " : "", @@ -262,7 +260,7 @@ static void get_module_info_callback(pa_context *c, const pa_module_info *i, int      char t[32];      if (is_last < 0) { -        fprintf(stderr, "Failed to get module information: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failed to get module information: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      } @@ -280,15 +278,15 @@ static void get_module_info_callback(pa_context *c, const pa_module_info *i, int      snprintf(t, sizeof(t), "%u", i->n_used); -    printf("*** Module #%u ***\n" +    printf(_("*** Module #%u ***\n"             "Name: %s\n"             "Argument: %s\n"             "Usage counter: %s\n" -           "Auto unload: %s\n", +           "Auto unload: %s\n"),             i->index,             i->name,             i->argument ? i->argument : "", -           i->n_used != PA_INVALID_INDEX ? t : "n/a", +           i->n_used != PA_INVALID_INDEX ? t : _("n/a"),             pa_yes_no(i->auto_unload));  } @@ -297,7 +295,7 @@ static void get_client_info_callback(pa_context *c, const pa_client_info *i, int      char *pl;      if (is_last < 0) { -        fprintf(stderr, "Failed to get client information: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failed to get client information: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      } @@ -315,13 +313,13 @@ static void get_client_info_callback(pa_context *c, const pa_client_info *i, int      snprintf(t, sizeof(t), "%u", i->owner_module); -    printf("*** Client #%u ***\n" +    printf(_("*** Client #%u ***\n"             "Driver: %s\n"             "Owner Module: %s\n" -           "Properties:\n%s", +           "Properties:\n%s"),             i->index,             pa_strnull(i->driver), -           i->owner_module != PA_INVALID_INDEX ? t : "n/a", +           i->owner_module != PA_INVALID_INDEX ? t : _("n/a"),             pl = pa_proplist_to_string(i->proplist));      pa_xfree(pl); @@ -332,7 +330,7 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info      char *pl;      if (is_last < 0) { -        fprintf(stderr, "Failed to get sink input information: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failed to get sink input information: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      } @@ -351,7 +349,7 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info      snprintf(t, sizeof(t), "%u", i->owner_module);      snprintf(k, sizeof(k), "%u", i->client); -    printf("*** Sink Input #%u ***\n" +    printf(_("*** Sink Input #%u ***\n"             "Driver: %s\n"             "Owner Module: %s\n"             "Client: %s\n" @@ -362,18 +360,18 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info             "Buffer Latency: %0.0f usec\n"             "Sink Latency: %0.0f usec\n"             "Resample method: %s\n" -           "Properties:\n%s", +             "Properties:\n%s"),             i->index,             pa_strnull(i->driver), -           i->owner_module != PA_INVALID_INDEX ? t : "n/a", -           i->client != PA_INVALID_INDEX ? k : "n/a", +           i->owner_module != PA_INVALID_INDEX ? t : _("n/a"), +           i->client != PA_INVALID_INDEX ? k : _("n/a"),             i->sink,             pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec),             pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map), -           i->mute ? "muted" : pa_cvolume_snprint(cv, sizeof(cv), &i->volume), +           i->mute ? _("muted") : pa_cvolume_snprint(cv, sizeof(cv), &i->volume),             (double) i->buffer_usec,             (double) i->sink_usec, -           i->resample_method ? i->resample_method : "n/a", +           i->resample_method ? i->resample_method : _("n/a"),             pl = pa_proplist_to_string(i->proplist));      pa_xfree(pl); @@ -384,7 +382,7 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu      char *pl;      if (is_last < 0) { -        fprintf(stderr, "Failed to get source output information: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failed to get source output information: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      } @@ -404,7 +402,7 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu      snprintf(t, sizeof(t), "%u", i->owner_module);      snprintf(k, sizeof(k), "%u", i->client); -    printf("*** Source Output #%u ***\n" +    printf(_("*** Source Output #%u ***\n"             "Driver: %s\n"             "Owner Module: %s\n"             "Client: %s\n" @@ -414,17 +412,17 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu             "Buffer Latency: %0.0f usec\n"             "Source Latency: %0.0f usec\n"             "Resample method: %s\n" -           "Properties:\n%s", +           "Properties:\n%s"),             i->index,             pa_strnull(i->driver), -           i->owner_module != PA_INVALID_INDEX ? t : "n/a", -           i->client != PA_INVALID_INDEX ? k : "n/a", +           i->owner_module != PA_INVALID_INDEX ? t : _("n/a"), +           i->client != PA_INVALID_INDEX ? k : _("n/a"),             i->source,             pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec),             pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),             (double) i->buffer_usec,             (double) i->source_usec, -           i->resample_method ? i->resample_method : "n/a", +           i->resample_method ? i->resample_method : _("n/a"),             pl = pa_proplist_to_string(i->proplist));      pa_xfree(pl); @@ -435,7 +433,7 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int      char *pl;      if (is_last < 0) { -        fprintf(stderr, "Failed to get sample information: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failed to get sample information: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      } @@ -454,7 +452,7 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int      pa_bytes_snprint(t, sizeof(t), i->bytes); -    printf("*** Sample #%u ***\n" +    printf(_("*** Sample #%u ***\n"             "Name: %s\n"             "Volume: %s\n"             "Sample Specification: %s\n" @@ -463,16 +461,16 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int             "Size: %s\n"             "Lazy: %s\n"             "Filename: %s\n" -           "Properties:\n%s", +           "Properties:\n%s"),             i->index,             i->name,             pa_cvolume_snprint(cv, sizeof(cv), &i->volume), -           pa_sample_spec_valid(&i->sample_spec) ? pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec) : "n/a", -           pa_sample_spec_valid(&i->sample_spec) ? pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map) : "n/a", +           pa_sample_spec_valid(&i->sample_spec) ? pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec) : _("n/a"), +           pa_sample_spec_valid(&i->sample_spec) ? pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map) : _("n/a"),             (double) i->duration/1000000,             t,             pa_yes_no(i->lazy), -           i->filename ? i->filename : "n/a", +           i->filename ? i->filename : _("n/a"),             pl = pa_proplist_to_string(i->proplist));      pa_xfree(pl); @@ -480,7 +478,7 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int  static void get_autoload_info_callback(pa_context *c, const pa_autoload_info *i, int is_last, void *userdata) {      if (is_last < 0) { -        fprintf(stderr, "Failed to get autoload information: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failed to get autoload information: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      } @@ -496,21 +494,21 @@ static void get_autoload_info_callback(pa_context *c, const pa_autoload_info *i,          printf("\n");      nl = 1; -    printf("*** Autoload Entry #%u ***\n" +    printf(_("*** Autoload Entry #%u ***\n"             "Name: %s\n"             "Type: %s\n"             "Module: %s\n" -           "Argument: %s\n", +             "Argument: %s\n"),             i->index,             i->name, -           i->type == PA_AUTOLOAD_SINK ? "sink" : "source", +           i->type == PA_AUTOLOAD_SINK ? _("sink") : _("source"),             i->module,             i->argument ? i->argument : "");  }  static void simple_callback(pa_context *c, int success, void *userdata) {      if (!success) { -        fprintf(stderr, "Failure: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failure: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      } @@ -520,7 +518,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) { -        fprintf(stderr, "Failure: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failure: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      } @@ -544,7 +542,7 @@ static void stream_state_callback(pa_stream *s, void *userdata) {          case PA_STREAM_FAILED:          default: -            fprintf(stderr, "Failed to upload sample: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s)))); +            fprintf(stderr, _("Failed to upload sample: %s\n"), pa_strerror(pa_context_errno(pa_stream_get_context(s))));              quit(1);      }  } @@ -557,11 +555,11 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata) {      d = pa_xmalloc(length);      assert(sample_length >= length); -    l = length/pa_frame_size(&sample_spec); +    l = (sf_count_t) (length/pa_frame_size(&sample_spec));      if ((sf_readf_float(sndfile, d, l)) != l) {          pa_xfree(d); -        fprintf(stderr, "Premature end of file\n"); +        fprintf(stderr, _("Premature end of file\n"));          quit(1);      } @@ -609,8 +607,8 @@ static void context_state_callback(pa_context *c, void *userdata) {                      break;                  case EXIT: -                    pa_operation_unref(pa_context_exit_daemon(c, NULL, NULL)); -                    drain(); +                    pa_operation_unref(pa_context_exit_daemon(c, simple_callback, NULL)); +                    break;                  case LIST:                      actions = 8; @@ -665,19 +663,19 @@ static void context_state_callback(pa_context *c, void *userdata) {          case PA_CONTEXT_FAILED:          default: -            fprintf(stderr, "Connection failure: %s\n", pa_strerror(pa_context_errno(c))); +            fprintf(stderr, _("Connection failure: %s\n"), 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) { -    fprintf(stderr, "Got SIGINT, exiting.\n"); +    fprintf(stderr, _("Got SIGINT, exiting.\n"));      quit(0);  }  static void help(const char *argv0) { -    printf("%s [options] stat\n" +    printf(_("%s [options] stat\n"             "%s [options] list\n"             "%s [options] exit\n"             "%s [options] upload-sample FILENAME [NAME]\n" @@ -692,7 +690,7 @@ static void help(const char *argv0) {             "  -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", +           "  -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);  } @@ -712,6 +710,9 @@ int main(int argc, char *argv[]) {          {NULL,          0, NULL, 0}      }; +    setlocale(LC_ALL, ""); +    bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR); +      if (!(bn = strrchr(argv[0], '/')))          bn = argv[0];      else @@ -725,7 +726,12 @@ int main(int argc, char *argv[]) {                  goto quit;              case ARG_VERSION: -                printf("pactl "PACKAGE_VERSION"\nCompiled with libpulse %s\nLinked with libpulse %s\n", pa_get_headers_version(), pa_get_library_version()); +                printf(_("pactl %s\n" +                         "Compiled with libpulse %s\n" +                         "Linked with libpulse %s\n"), +                       PACKAGE_VERSION, +                       pa_get_headers_version(), +                       pa_get_library_version());                  ret = 0;                  goto quit; @@ -759,7 +765,7 @@ int main(int argc, char *argv[]) {              action = UPLOAD_SAMPLE;              if (optind+1 >= argc) { -                fprintf(stderr, "Please specify a sample file to load\n"); +                fprintf(stderr, _("Please specify a sample file to load\n"));                  goto quit;              } @@ -781,19 +787,19 @@ int main(int argc, char *argv[]) {              memset(&sfinfo, 0, sizeof(sfinfo));              if (!(sndfile = sf_open(argv[optind+1], SFM_READ, &sfinfo))) { -                fprintf(stderr, "Failed to open sound file.\n"); +                fprintf(stderr, _("Failed to open sound file.\n"));                  goto quit;              } -            sample_spec.format =  PA_SAMPLE_FLOAT32; -            sample_spec.rate = sfinfo.samplerate; -            sample_spec.channels = sfinfo.channels; +            sample_spec.format = PA_SAMPLE_FLOAT32; +            sample_spec.rate = (uint32_t) sfinfo.samplerate; +            sample_spec.channels = (uint8_t) sfinfo.channels; -            sample_length = sfinfo.frames*pa_frame_size(&sample_spec); +            sample_length = (size_t)sfinfo.frames*pa_frame_size(&sample_spec);          } else if (!strcmp(argv[optind], "play-sample")) {              action = PLAY_SAMPLE;              if (argc != optind+2 && argc != optind+3) { -                fprintf(stderr, "You have to specify a sample name to play\n"); +                fprintf(stderr, _("You have to specify a sample name to play\n"));                  goto quit;              } @@ -805,7 +811,7 @@ int main(int argc, char *argv[]) {          } else if (!strcmp(argv[optind], "remove-sample")) {              action = REMOVE_SAMPLE;              if (argc != optind+2) { -                fprintf(stderr, "You have to specify a sample name to remove\n"); +                fprintf(stderr, _("You have to specify a sample name to remove\n"));                  goto quit;              } @@ -813,20 +819,20 @@ int main(int argc, char *argv[]) {          } else if (!strcmp(argv[optind], "move-sink-input")) {              action = MOVE_SINK_INPUT;              if (argc != optind+3) { -                fprintf(stderr, "You have to specify a sink input index and a sink\n"); +                fprintf(stderr, _("You have to specify a sink input index and a sink\n"));                  goto quit;              } -            sink_input_idx = atoi(argv[optind+1]); +            sink_input_idx = (uint32_t) atoi(argv[optind+1]);              sink_name = pa_xstrdup(argv[optind+2]);          } else if (!strcmp(argv[optind], "move-source-output")) {              action = MOVE_SOURCE_OUTPUT;              if (argc != optind+3) { -                fprintf(stderr, "You have to specify a source output index and a source\n"); +                fprintf(stderr, _("You have to specify a source output index and a source\n"));                  goto quit;              } -            source_output_idx = atoi(argv[optind+1]); +            source_output_idx = (uint32_t) atoi(argv[optind+1]);              source_name = pa_xstrdup(argv[optind+2]);          } else if (!strcmp(argv[optind], "load-module")) {              int i; @@ -836,7 +842,7 @@ int main(int argc, char *argv[]) {              action = LOAD_MODULE;              if (argc <= optind+1) { -                fprintf(stderr, "You have to specify a module name and arguments.\n"); +                fprintf(stderr, _("You have to specify a module name and arguments.\n"));                  goto quit;              } @@ -846,7 +852,7 @@ int main(int argc, char *argv[]) {                  n += strlen(argv[i])+1;              if (n > 0) { -                p = module_args = pa_xnew0(char, n); +                p = module_args = pa_xmalloc(n);                  for (i = optind+2; i < argc; i++)                      p += sprintf(p, "%s%s", p == module_args ? "" : " ", argv[i]); @@ -856,17 +862,17 @@ int main(int argc, char *argv[]) {              action = UNLOAD_MODULE;              if (argc != optind+2) { -                fprintf(stderr, "You have to specify a module index\n"); +                fprintf(stderr, _("You have to specify a module index\n"));                  goto quit;              } -            module_index = atoi(argv[optind+1]); +            module_index = (uint32_t) atoi(argv[optind+1]);          } else if (!strcmp(argv[optind], "suspend-sink")) {              action = SUSPEND_SINK;              if (argc > optind+3 || optind+1 >= argc) { -                fprintf(stderr, "You may not specify more than one sink. You have to specify at least one boolean value.\n"); +                fprintf(stderr, _("You may not specify more than one sink. You have to specify at least one boolean value.\n"));                  goto quit;              } @@ -879,7 +885,7 @@ int main(int argc, char *argv[]) {              action = SUSPEND_SOURCE;              if (argc > optind+3 || optind+1 >= argc) { -                fprintf(stderr, "You may not specify more than one source. You have to specify at least one boolean value.\n"); +                fprintf(stderr, _("You may not specify more than one source. You have to specify at least one boolean value.\n"));                  goto quit;              } @@ -895,12 +901,12 @@ int main(int argc, char *argv[]) {      }      if (action == NONE) { -        fprintf(stderr, "No valid command specified.\n"); +        fprintf(stderr, _("No valid command specified.\n"));          goto quit;      }      if (!(m = pa_mainloop_new())) { -        fprintf(stderr, "pa_mainloop_new() failed.\n"); +        fprintf(stderr, _("pa_mainloop_new() failed.\n"));          goto quit;      } @@ -914,7 +920,7 @@ int main(int argc, char *argv[]) {  #endif      if (!(context = pa_context_new(mainloop_api, client_name))) { -        fprintf(stderr, "pa_context_new() failed.\n"); +        fprintf(stderr, _("pa_context_new() failed.\n"));          goto quit;      } @@ -922,7 +928,7 @@ int main(int argc, char *argv[]) {      pa_context_connect(context, server, 0, NULL);      if (pa_mainloop_run(m, &ret) < 0) { -        fprintf(stderr, "pa_mainloop_run() failed.\n"); +        fprintf(stderr, _("pa_mainloop_run() failed.\n"));          goto quit;      } diff --git a/src/utils/padsp.c b/src/utils/padsp.c index d650707e..134a7e58 100644 --- a/src/utils/padsp.c +++ b/src/utils/padsp.c @@ -748,7 +748,7 @@ static void fix_metrics(fd_info *i) {      /* Number of fragments set? */      if (i->n_fragments < 2) {          if (i->fragment_size > 0) { -            i->n_fragments = pa_bytes_per_second(&i->sample_spec) / 2 / i->fragment_size; +            i->n_fragments = (unsigned) (pa_bytes_per_second(&i->sample_spec) / 2 / i->fragment_size);              if (i->n_fragments < 2)                  i->n_fragments = 2;          } else @@ -864,7 +864,7 @@ static int fd_info_copy_data(fd_info *i, int force) {                  return -1;              } -            if (pa_stream_write(i->play_stream, i->buf, r, free, 0, PA_SEEK_RELATIVE) < 0) { +            if (pa_stream_write(i->play_stream, i->buf, (size_t) r, free, 0, PA_SEEK_RELATIVE) < 0) {                  debug(DEBUG_LEVEL_NORMAL, __FILE__": pa_stream_write(): %s\n", pa_strerror(pa_context_errno(i->context)));                  return -1;              } @@ -872,7 +872,7 @@ static int fd_info_copy_data(fd_info *i, int force) {              i->buf = NULL;              assert(n >= (size_t) r); -            n -= r; +            n -= (size_t) r;          }          if (n >= i->fragment_size) @@ -916,7 +916,7 @@ static int fd_info_copy_data(fd_info *i, int force) {              }              assert((size_t)r <= len - i->rec_offset); -            i->rec_offset += r; +            i->rec_offset += (size_t) r;              if (i->rec_offset == len) {                  if (pa_stream_drop(i->rec_stream) < 0) { @@ -927,7 +927,7 @@ static int fd_info_copy_data(fd_info *i, int force) {              }              assert(n >= (size_t) r); -            n -= r; +            n -= (size_t) r;          }          if (n >= i->fragment_size) @@ -998,10 +998,10 @@ static int create_playback_stream(fd_info *i) {      pa_stream_set_latency_update_callback(i->play_stream, stream_latency_update_cb, i);      memset(&attr, 0, sizeof(attr)); -    attr.maxlength = i->fragment_size * (i->n_fragments+1); -    attr.tlength = i->fragment_size * i->n_fragments; -    attr.prebuf = i->fragment_size; -    attr.minreq = i->fragment_size; +    attr.maxlength = (uint32_t) (i->fragment_size * (i->n_fragments+1)); +    attr.tlength = (uint32_t) (i->fragment_size * i->n_fragments); +    attr.prebuf = (uint32_t) i->fragment_size; +    attr.minreq = (uint32_t) i->fragment_size;      flags = PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE;      if (i->play_precork) { @@ -1013,9 +1013,9 @@ static int create_playback_stream(fd_info *i) {          goto fail;      } -    n = i->fragment_size; +    n = (int) i->fragment_size;      setsockopt(i->app_fd, SOL_SOCKET, SO_SNDBUF, &n, sizeof(n)); -    n = i->fragment_size; +    n = (int) i->fragment_size;      setsockopt(i->thread_fd, SOL_SOCKET, SO_RCVBUF, &n, sizeof(n));      return 0; @@ -1042,8 +1042,8 @@ static int create_record_stream(fd_info *i) {      pa_stream_set_latency_update_callback(i->rec_stream, stream_latency_update_cb, i);      memset(&attr, 0, sizeof(attr)); -    attr.maxlength = i->fragment_size * (i->n_fragments+1); -    attr.fragsize = i->fragment_size; +    attr.maxlength = (uint32_t) (i->fragment_size * (i->n_fragments+1)); +    attr.fragsize = (uint32_t) i->fragment_size;      flags = PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE;      if (i->rec_precork) { @@ -1055,9 +1055,9 @@ static int create_record_stream(fd_info *i) {          goto fail;      } -    n = i->fragment_size; +    n = (int) i->fragment_size;      setsockopt(i->app_fd, SOL_SOCKET, SO_RCVBUF, &n, sizeof(n)); -    n = i->fragment_size; +    n = (int) i->fragment_size;      setsockopt(i->thread_fd, SOL_SOCKET, SO_SNDBUF, &n, sizeof(n));      return 0; @@ -1474,7 +1474,7 @@ int open(const char *filename, int flags, ...) {      if (flags & O_CREAT) {          va_start(args, flags);          if (sizeof(mode_t) < sizeof(int)) -            mode = va_arg(args, int); +            mode = (mode_t) va_arg(args, int);          else              mode = va_arg(args, mode_t);          va_end(args); @@ -2250,7 +2250,7 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)              for (;;) {                  pa_usec_t usec; -                PLAYBACK_STREAM_CHECK_DEAD_GOTO(i, exit_loop); +                PLAYBACK_STREAM_CHECK_DEAD_GOTO(i, exit_loop2);                  if (pa_stream_get_time(i->play_stream, &usec) >= 0) {                      size_t k = pa_usec_to_bytes(usec, &i->sample_spec); @@ -2272,6 +2272,8 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)                  pa_threaded_mainloop_wait(i->mainloop);              } +        exit_loop2: +              pa_threaded_mainloop_unlock(i->mainloop);              debug(DEBUG_LEVEL_NORMAL, __FILE__": GETOPTR bytes=%i, blocks=%i, ptr=%i\n", info->bytes, info->blocks, info->ptr); diff --git a/src/utils/paplay.c b/src/utils/paplay.c index 1b6228b1..df2edf62 100644 --- a/src/utils/paplay.c +++ b/src/utils/paplay.c @@ -37,10 +37,7 @@  #include <sndfile.h>  #include <pulse/pulseaudio.h> - -#if PA_API_VERSION < 9 -#error Invalid PulseAudio API version -#endif +#include <pulse/i18n.h>  static pa_context *context = NULL;  static pa_stream *stream = NULL; @@ -75,12 +72,12 @@ static void stream_drain_complete(pa_stream*s, int success, void *userdata) {      pa_operation *o;      if (!success) { -        fprintf(stderr, "Failed to drain stream: %s\n", pa_strerror(pa_context_errno(context))); +        fprintf(stderr, _("Failed to drain stream: %s\n"), pa_strerror(pa_context_errno(context)));          quit(1);      }      if (verbose) -        fprintf(stderr, "Playback stream drained.\n"); +        fprintf(stderr, _("Playback stream drained.\n"));      pa_stream_disconnect(stream);      pa_stream_unref(stream); @@ -92,7 +89,7 @@ static void stream_drain_complete(pa_stream*s, int success, void *userdata) {          pa_operation_unref(o);          if (verbose) -            fprintf(stderr, "Draining connection to server.\n"); +            fprintf(stderr, _("Draining connection to server.\n"));      }  } @@ -110,14 +107,14 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata) {      if (readf_function) {          size_t k = pa_frame_size(&sample_spec); -        if ((bytes = readf_function(sndfile, data, length/k)) > 0) -            bytes *= k; +        if ((bytes = readf_function(sndfile, data, (sf_count_t) (length/k))) > 0) +            bytes *= (sf_count_t) k;      } else -        bytes = sf_read_raw(sndfile, data, length); +        bytes = sf_read_raw(sndfile, data, (sf_count_t) length);      if (bytes > 0) -        pa_stream_write(s, data, bytes, pa_xfree, 0, PA_SEEK_RELATIVE); +        pa_stream_write(s, data, (size_t) bytes, pa_xfree, 0, PA_SEEK_RELATIVE);      else          pa_xfree(data); @@ -139,12 +136,12 @@ static void stream_state_callback(pa_stream *s, void *userdata) {          case PA_STREAM_READY:              if (verbose) -                fprintf(stderr, "Stream successfully created\n"); +                fprintf(stderr, _("Stream successfully created\n"));              break;          case PA_STREAM_FAILED:          default: -            fprintf(stderr, "Stream errror: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s)))); +            fprintf(stderr, _("Stream errror: %s\n"), pa_strerror(pa_context_errno(pa_stream_get_context(s))));              quit(1);      }  } @@ -165,7 +162,7 @@ static void context_state_callback(pa_context *c, void *userdata) {              assert(c && !stream);              if (verbose) -                fprintf(stderr, "Connection established.\n"); +                fprintf(stderr, _("Connection established.\n"));              stream = pa_stream_new(c, stream_name, &sample_spec, channel_map_set ? &channel_map : NULL);              assert(stream); @@ -183,7 +180,7 @@ static void context_state_callback(pa_context *c, void *userdata) {          case PA_CONTEXT_FAILED:          default: -            fprintf(stderr, "Connection failure: %s\n", pa_strerror(pa_context_errno(c))); +            fprintf(stderr, _("Connection failure: %s\n"), pa_strerror(pa_context_errno(c)));              quit(1);      }  } @@ -191,14 +188,14 @@ static void context_state_callback(pa_context *c, void *userdata) {  /* UNIX signal to quit recieved */  static void exit_signal_callback(pa_mainloop_api*m, pa_signal_event *e, int sig, void *userdata) {      if (verbose) -        fprintf(stderr, "Got SIGINT, exiting.\n"); +        fprintf(stderr, _("Got SIGINT, exiting.\n"));      quit(0);  }  static void help(const char *argv0) { -    printf("%s [options] [FILE]\n\n" +    printf(_("%s [options] [FILE]\n\n"             "  -h, --help                            Show this help\n"             "      --version                         Show version\n\n"             "  -v, --verbose                         Enable verbose operation\n\n" @@ -207,7 +204,7 @@ static void help(const char *argv0) {             "  -n, --client-name=NAME                How to call this client on the server\n"             "      --stream-name=NAME                How to call this stream on the server\n"             "      --volume=VOLUME                   Specify the initial (linear) volume in range 0...65536\n" -           "      --channel-map=CHANNELMAP          Set the channel map to the use\n", +             "      --channel-map=CHANNELMAP          Set the channel map to the use\n"),             argv0);  } @@ -239,6 +236,7 @@ int main(int argc, char *argv[]) {      };      setlocale(LC_ALL, ""); +    bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);      if (!(bn = strrchr(argv[0], '/')))          bn = argv[0]; @@ -254,7 +252,8 @@ int main(int argc, char *argv[]) {                  goto quit;              case ARG_VERSION: -                printf("paplay "PACKAGE_VERSION"\nCompiled with libpulse %s\nLinked with libpulse %s\n", pa_get_headers_version(), pa_get_library_version()); +                printf(_("paplay %s\nCompiled with libpulse %s\n" +                        "Linked with libpulse %s\n"), PACKAGE_VERSION, pa_get_headers_version(), pa_get_library_version());                  ret = 0;                  goto quit; @@ -284,13 +283,13 @@ int main(int argc, char *argv[]) {              case ARG_VOLUME: {                  int v = atoi(optarg); -                volume = v < 0 ? 0 : v; +                volume = v < 0 ? 0U : (pa_volume_t) v;                  break;              }              case ARG_CHANNELMAP:                  if (!pa_channel_map_parse(&channel_map, optarg)) { -                    fprintf(stderr, "Invalid channel map\n"); +                    fprintf(stderr, _("Invalid channel map\n"));                      goto quit;                  } @@ -312,12 +311,12 @@ int main(int argc, char *argv[]) {          sndfile = sf_open_fd(STDIN_FILENO, SFM_READ, &sfinfo, 0);      if (!sndfile) { -        fprintf(stderr, "Failed to open file '%s'\n", filename); +        fprintf(stderr, _("Failed to open file '%s'\n"), filename);          goto quit;      } -    sample_spec.rate = sfinfo.samplerate; -    sample_spec.channels = sfinfo.channels; +    sample_spec.rate = (uint32_t) sfinfo.samplerate; +    sample_spec.channels = (uint8_t) sfinfo.channels;      readf_function = NULL; @@ -348,7 +347,7 @@ int main(int argc, char *argv[]) {      assert(pa_sample_spec_valid(&sample_spec));      if (channel_map_set && channel_map.channels != sample_spec.channels) { -        fprintf(stderr, "Channel map doesn't match file.\n"); +        fprintf(stderr, _("Channel map doesn't match file.\n"));          goto quit;      } @@ -374,12 +373,12 @@ int main(int argc, char *argv[]) {      if (verbose) {          char t[PA_SAMPLE_SPEC_SNPRINT_MAX];          pa_sample_spec_snprint(t, sizeof(t), &sample_spec); -        fprintf(stderr, "Using sample spec '%s'\n", t); +        fprintf(stderr, _("Using sample spec '%s'\n"), t);      }      /* Set up a new main loop */      if (!(m = pa_mainloop_new())) { -        fprintf(stderr, "pa_mainloop_new() failed.\n"); +        fprintf(stderr, _("pa_mainloop_new() failed.\n"));          goto quit;      } @@ -394,7 +393,7 @@ int main(int argc, char *argv[]) {      /* Create a new connection context */      if (!(context = pa_context_new(mainloop_api, client_name))) { -        fprintf(stderr, "pa_context_new() failed.\n"); +        fprintf(stderr, _("pa_context_new() failed.\n"));          goto quit;      } @@ -405,7 +404,7 @@ int main(int argc, char *argv[]) {      /* Run the main loop */      if (pa_mainloop_run(m, &ret) < 0) { -        fprintf(stderr, "pa_mainloop_run() failed.\n"); +        fprintf(stderr, _("pa_mainloop_run() failed.\n"));          goto quit;      } diff --git a/src/utils/pasuspender.c b/src/utils/pasuspender.c index 5b4885db..8a59d5e4 100644 --- a/src/utils/pasuspender.c +++ b/src/utils/pasuspender.c @@ -35,20 +35,16 @@  #include <stdlib.h>  #include <limits.h>  #include <getopt.h> - -#include <sndfile.h> +#include <locale.h>  #ifdef __linux__  #include <sys/prctl.h>  #endif +#include <pulse/i18n.h>  #include <pulse/pulseaudio.h>  #include <pulsecore/macro.h> -#if PA_API_VERSION < 10 -#error Invalid PulseAudio API version -#endif -  #define BUFSIZE 1024  static pa_context *context = NULL; @@ -82,7 +78,7 @@ static void start_child(void) {      if ((child_pid = fork()) < 0) { -        fprintf(stderr, "fork(): %s\n", strerror(errno)); +        fprintf(stderr, _("fork(): %s\n"), strerror(errno));          quit(1);      } else if (child_pid == 0) { @@ -93,7 +89,7 @@ static void start_child(void) {  #endif          if (execvp(child_argv[0], child_argv) < 0) -            fprintf(stderr, "execvp(): %s\n", strerror(errno)); +            fprintf(stderr, _("execvp(): %s\n"), strerror(errno));          _exit(1); @@ -110,7 +106,7 @@ static void suspend_complete(pa_context *c, int success, void *userdata) {      n++;      if (!success) { -        fprintf(stderr, "Failure to suspend: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failure to suspend: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      } @@ -125,7 +121,7 @@ static void resume_complete(pa_context *c, int success, void *userdata) {      n++;      if (!success) { -        fprintf(stderr, "Failure to resume: %s\n", pa_strerror(pa_context_errno(c))); +        fprintf(stderr, _("Failure to resume: %s\n"), pa_strerror(pa_context_errno(c)));          quit(1);          return;      } @@ -148,7 +144,7 @@ static void context_state_callback(pa_context *c, void *userdata) {                  pa_operation_unref(pa_context_suspend_sink_by_index(c, PA_INVALID_INDEX, 1, suspend_complete, NULL));                  pa_operation_unref(pa_context_suspend_source_by_index(c, PA_INVALID_INDEX, 1, suspend_complete, NULL));              } else { -                fprintf(stderr, "WARNING: Sound server is not local, not suspending.\n"); +                fprintf(stderr, _("WARNING: Sound server is not local, not suspending.\n"));                  start_child();              } @@ -160,7 +156,7 @@ static void context_state_callback(pa_context *c, void *userdata) {          case PA_CONTEXT_FAILED:          default: -            fprintf(stderr, "Connection failure: %s\n", pa_strerror(pa_context_errno(c))); +            fprintf(stderr, _("Connection failure: %s\n"), pa_strerror(pa_context_errno(c)));              pa_context_unref(context);              context = NULL; @@ -177,7 +173,7 @@ static void context_state_callback(pa_context *c, void *userdata) {  }  static void sigint_callback(pa_mainloop_api *m, pa_signal_event *e, int sig, void *userdata) { -    fprintf(stderr, "Got SIGINT, exiting.\n"); +    fprintf(stderr, _("Got SIGINT, exiting.\n"));      quit(0);  } @@ -195,7 +191,7 @@ static void sigchld_callback(pa_mainloop_api *m, pa_signal_event *e, int sig, vo      if (WIFEXITED(status))          child_ret = WEXITSTATUS(status);      else if (WIFSIGNALED(status)) { -        fprintf(stderr, "WARNING: Child process terminated by signal %u\n", WTERMSIG(status)); +        fprintf(stderr, _("WARNING: Child process terminated by signal %u\n"), WTERMSIG(status));          child_ret = 1;      } @@ -213,10 +209,10 @@ static void sigchld_callback(pa_mainloop_api *m, pa_signal_event *e, int sig, vo  static void help(const char *argv0) { -    printf("%s [options] ... \n\n" +    printf(_("%s [options] ... \n\n"             "  -h, --help                            Show this help\n"             "      --version                         Show version\n" -           "  -s, --server=SERVER                   The name of the server to connect to\n\n", +           "  -s, --server=SERVER                   The name of the server to connect to\n\n"),             argv0);  } @@ -236,6 +232,9 @@ int main(int argc, char *argv[]) {          {NULL,          0, NULL, 0}      }; +    setlocale(LC_ALL, ""); +    bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR); +      if (!(bn = strrchr(argv[0], '/')))          bn = argv[0];      else @@ -249,7 +248,12 @@ int main(int argc, char *argv[]) {                  goto quit;              case ARG_VERSION: -                printf("pasuspender "PACKAGE_VERSION"\nCompiled with libpulse %s\nLinked with libpulse %s\n", pa_get_headers_version(), pa_get_library_version()); +                printf(_("pasuspender %s\n" +                         "Compiled with libpulse %s\n" +                         "Linked with libpulse %s\n"), +                       PACKAGE_VERSION, +                       pa_get_headers_version(), +                       pa_get_library_version());                  ret = 0;                  goto quit; @@ -273,7 +277,7 @@ int main(int argc, char *argv[]) {      }      if (!(m = pa_mainloop_new())) { -        fprintf(stderr, "pa_mainloop_new() failed.\n"); +        fprintf(stderr, _("pa_mainloop_new() failed.\n"));          goto quit;      } @@ -286,7 +290,7 @@ int main(int argc, char *argv[]) {  #endif      if (!(context = pa_context_new(mainloop_api, bn))) { -        fprintf(stderr, "pa_context_new() failed.\n"); +        fprintf(stderr, _("pa_context_new() failed.\n"));          goto quit;      } @@ -294,7 +298,7 @@ int main(int argc, char *argv[]) {      pa_context_connect(context, server, PA_CONTEXT_NOAUTOSPAWN, NULL);      if (pa_mainloop_run(m, &ret) < 0) { -        fprintf(stderr, "pa_mainloop_run() failed.\n"); +        fprintf(stderr, _("pa_mainloop_run() failed.\n"));          goto quit;      } diff --git a/src/utils/pax11publish.c b/src/utils/pax11publish.c index eee7b6a8..50d621d4 100644 --- a/src/utils/pax11publish.c +++ b/src/utils/pax11publish.c @@ -27,11 +27,13 @@  #include <getopt.h>  #include <string.h>  #include <assert.h> +#include <locale.h>  #include <X11/Xlib.h>  #include <X11/Xatom.h>  #include <pulse/util.h> +#include <pulse/i18n.h>  #include <pulsecore/core-util.h>  #include <pulsecore/log.h> @@ -47,17 +49,20 @@ int main(int argc, char *argv[]) {      Display *d = NULL;      enum { DUMP, EXPORT, IMPORT, REMOVE } mode = DUMP; +    setlocale(LC_ALL, ""); +    bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR); +      while ((c = getopt(argc, argv, "deiD:S:O:I:c:hr")) != -1) {          switch (c) {              case 'D' :                  dname = optarg;                  break;              case 'h': -                printf("%s [-D display] [-S server] [-O sink] [-I source] [-c file]  [-d|-e|-i|-r]\n\n" +                printf(_("%s [-D display] [-S server] [-O sink] [-I source] [-c file]  [-d|-e|-i|-r]\n\n"                         " -d    Show current PulseAudio data attached to X11 display (default)\n"                         " -e    Export local PulseAudio data to X11 display\n"                         " -i    Import PulseAudio data from X11 display to local environment variables and cookie file.\n" -                       " -r    Remove PulseAudio data from X11 display\n", +                       " -r    Remove PulseAudio data from X11 display\n"),                         pa_path_get_filename(argv[0]));                  ret = 0;                  goto finish; @@ -86,13 +91,13 @@ int main(int argc, char *argv[]) {                  server = optarg;                  break;              default: -                fprintf(stderr, "Failed to parse command line.\n"); +                fprintf(stderr, _("Failed to parse command line.\n"));                  goto finish;          }      }      if (!(d = XOpenDisplay(dname))) { -        pa_log("XOpenDisplay() failed"); +        pa_log(_("XOpenDisplay() failed"));          goto finish;      } @@ -100,13 +105,13 @@ int main(int argc, char *argv[]) {          case DUMP: {              char t[1024];              if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t))) -                printf("Server: %s\n", t); +                printf(_("Server: %s\n"), t);              if (pa_x11_get_prop(d, "PULSE_SOURCE", t, sizeof(t))) -                printf("Source: %s\n", t); +                printf(_("Source: %s\n"), t);              if (pa_x11_get_prop(d, "PULSE_SINK", t, sizeof(t))) -                printf("Sink: %s\n", t); +                printf(_("Sink: %s\n"), t);              if (pa_x11_get_prop(d, "PULSE_COOKIE", t, sizeof(t))) -                printf("Cookie: %s\n", t); +                printf(_("Cookie: %s\n"), t);              break;          } @@ -124,12 +129,12 @@ int main(int argc, char *argv[]) {                  uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];                  size_t l;                  if ((l = pa_parsehex(t, cookie, sizeof(cookie))) != sizeof(cookie)) { -                    fprintf(stderr, "Failed to parse cookie data\n"); +                    fprintf(stderr, _("Failed to parse cookie data\n"));                      goto finish;                  }                  if (pa_authkey_save(cookie_file, cookie, l) < 0) { -                    fprintf(stderr, "Failed to save cookie data\n"); +                    fprintf(stderr, _("Failed to save cookie data\n"));                      goto finish;                  }              } @@ -144,12 +149,12 @@ int main(int argc, char *argv[]) {              assert(conf);              if (pa_client_conf_load(conf, NULL) < 0) { -                fprintf(stderr, "Failed to load client configuration file.\n"); +                fprintf(stderr, _("Failed to load client configuration file.\n"));                  goto finish;              }              if (pa_client_conf_env(conf) < 0) { -                fprintf(stderr, "Failed to read environment configuration data.\n"); +                fprintf(stderr, _("Failed to read environment configuration data.\n"));                  goto finish;              } @@ -166,7 +171,7 @@ int main(int argc, char *argv[]) {              else {                  char hn[256];                  if (!pa_get_fqdn(hn, sizeof(hn))) { -                    fprintf(stderr, "Failed to get FQDN.\n"); +                    fprintf(stderr, _("Failed to get FQDN.\n"));                      goto finish;                  } @@ -186,7 +191,7 @@ int main(int argc, char *argv[]) {              pa_client_conf_free(conf);              if (pa_authkey_load_auto(cookie_file, cookie, sizeof(cookie)) < 0) { -                fprintf(stderr, "Failed to load cookie data\n"); +                fprintf(stderr, _("Failed to load cookie data\n"));                  goto finish;              } @@ -203,7 +208,7 @@ int main(int argc, char *argv[]) {              break;          default: -            fprintf(stderr, "No yet implemented.\n"); +            fprintf(stderr, _("Not yet implemented.\n"));              goto finish;      }  | 
