diff options
Diffstat (limited to 'meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/alsaerror.patch')
| -rw-r--r-- | meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/alsaerror.patch | 525 |
1 files changed, 525 insertions, 0 deletions
diff --git a/meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/alsaerror.patch b/meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/alsaerror.patch new file mode 100644 index 0000000000..2efa3e89b8 --- /dev/null +++ b/meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/alsaerror.patch | |||
| @@ -0,0 +1,525 @@ | |||
| 1 | From: Lennart Poettering <lennart@poettering.net> | ||
| 2 | Date: Sun, 19 Apr 2009 17:22:51 +0000 (+0200) | ||
| 3 | Subject: alsa: properly convert return values of snd_strerror() to utf8 | ||
| 4 | X-Git-Url: http://git.0pointer.de/?p=pulseaudio.git;a=commitdiff_plain;h=98a25c506e692ab091b4af7e1b37e8432fc08e8f | ||
| 5 | |||
| 6 | alsa: properly convert return values of snd_strerror() to utf8 | ||
| 7 | --- | ||
| 8 | |||
| 9 | diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c | ||
| 10 | index 2fbcd7b..41e8b47 100644 | ||
| 11 | --- a/src/modules/alsa/alsa-sink.c | ||
| 12 | +++ b/src/modules/alsa/alsa-sink.c | ||
| 13 | @@ -281,7 +281,7 @@ static int try_recover(struct userdata *u, const char *call, int err) { | ||
| 14 | pa_assert(call); | ||
| 15 | pa_assert(err < 0); | ||
| 16 | |||
| 17 | - pa_log_debug("%s: %s", call, snd_strerror(err)); | ||
| 18 | + pa_log_debug("%s: %s", call, pa_alsa_strerror(err)); | ||
| 19 | |||
| 20 | pa_assert(err != -EAGAIN); | ||
| 21 | |||
| 22 | @@ -289,7 +289,7 @@ static int try_recover(struct userdata *u, const char *call, int err) { | ||
| 23 | pa_log_debug("%s: Buffer underrun!", call); | ||
| 24 | |||
| 25 | if ((err = snd_pcm_recover(u->pcm_handle, err, 1)) < 0) { | ||
| 26 | - pa_log("%s: %s", call, snd_strerror(err)); | ||
| 27 | + pa_log("%s: %s", call, pa_alsa_strerror(err)); | ||
| 28 | return -1; | ||
| 29 | } | ||
| 30 | |||
| 31 | @@ -636,12 +636,12 @@ static void update_smoother(struct userdata *u) { | ||
| 32 | /* Let's update the time smoother */ | ||
| 33 | |||
| 34 | if (PA_UNLIKELY((err = pa_alsa_safe_delay(u->pcm_handle, &delay, u->hwbuf_size, &u->sink->sample_spec)) < 0)) { | ||
| 35 | - pa_log_warn("Failed to query DSP status data: %s", snd_strerror(err)); | ||
| 36 | + pa_log_warn("Failed to query DSP status data: %s", pa_alsa_strerror(err)); | ||
| 37 | return; | ||
| 38 | } | ||
| 39 | |||
| 40 | if (PA_UNLIKELY((err = snd_pcm_status(u->pcm_handle, status)) < 0)) | ||
| 41 | - pa_log_warn("Failed to get timestamp: %s", snd_strerror(err)); | ||
| 42 | + pa_log_warn("Failed to get timestamp: %s", pa_alsa_strerror(err)); | ||
| 43 | else { | ||
| 44 | snd_htimestamp_t htstamp = { 0, 0 }; | ||
| 45 | snd_pcm_status_get_htstamp(status, &htstamp); | ||
| 46 | @@ -764,7 +764,7 @@ static int update_sw_params(struct userdata *u) { | ||
| 47 | pa_log_debug("setting avail_min=%lu", (unsigned long) avail_min); | ||
| 48 | |||
| 49 | if ((err = pa_alsa_set_sw_params(u->pcm_handle, avail_min)) < 0) { | ||
| 50 | - pa_log("Failed to set software parameters: %s", snd_strerror(err)); | ||
| 51 | + pa_log("Failed to set software parameters: %s", pa_alsa_strerror(err)); | ||
| 52 | return err; | ||
| 53 | } | ||
| 54 | |||
| 55 | @@ -792,7 +792,7 @@ static int unsuspend(struct userdata *u) { | ||
| 56 | SND_PCM_NO_AUTO_RESAMPLE| | ||
| 57 | SND_PCM_NO_AUTO_CHANNELS| | ||
| 58 | SND_PCM_NO_AUTO_FORMAT)) < 0) { | ||
| 59 | - pa_log("Error opening PCM device %s: %s", u->device_name, snd_strerror(err)); | ||
| 60 | + pa_log("Error opening PCM device %s: %s", u->device_name, pa_alsa_strerror(err)); | ||
| 61 | goto fail; | ||
| 62 | } | ||
| 63 | |||
| 64 | @@ -803,7 +803,7 @@ static int unsuspend(struct userdata *u) { | ||
| 65 | d = u->use_tsched; | ||
| 66 | |||
| 67 | if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &nfrags, &period_size, u->hwbuf_size / u->frame_size, &b, &d, TRUE)) < 0) { | ||
| 68 | - pa_log("Failed to set hardware parameters: %s", snd_strerror(err)); | ||
| 69 | + pa_log("Failed to set hardware parameters: %s", pa_alsa_strerror(err)); | ||
| 70 | goto fail; | ||
| 71 | } | ||
| 72 | |||
| 73 | @@ -1030,7 +1030,7 @@ static void sink_get_volume_cb(pa_sink *s) { | ||
| 74 | return; | ||
| 75 | |||
| 76 | fail: | ||
| 77 | - pa_log_error("Unable to read volume: %s", snd_strerror(err)); | ||
| 78 | + pa_log_error("Unable to read volume: %s", pa_alsa_strerror(err)); | ||
| 79 | } | ||
| 80 | |||
| 81 | static void sink_set_volume_cb(pa_sink *s) { | ||
| 82 | @@ -1141,7 +1141,7 @@ static void sink_set_volume_cb(pa_sink *s) { | ||
| 83 | return; | ||
| 84 | |||
| 85 | fail: | ||
| 86 | - pa_log_error("Unable to set volume: %s", snd_strerror(err)); | ||
| 87 | + pa_log_error("Unable to set volume: %s", pa_alsa_strerror(err)); | ||
| 88 | } | ||
| 89 | |||
| 90 | static void sink_get_mute_cb(pa_sink *s) { | ||
| 91 | @@ -1152,7 +1152,7 @@ static void sink_get_mute_cb(pa_sink *s) { | ||
| 92 | pa_assert(u->mixer_elem); | ||
| 93 | |||
| 94 | if ((err = snd_mixer_selem_get_playback_switch(u->mixer_elem, 0, &sw)) < 0) { | ||
| 95 | - pa_log_error("Unable to get switch: %s", snd_strerror(err)); | ||
| 96 | + pa_log_error("Unable to get switch: %s", pa_alsa_strerror(err)); | ||
| 97 | return; | ||
| 98 | } | ||
| 99 | |||
| 100 | @@ -1167,7 +1167,7 @@ static void sink_set_mute_cb(pa_sink *s) { | ||
| 101 | pa_assert(u->mixer_elem); | ||
| 102 | |||
| 103 | if ((err = snd_mixer_selem_set_playback_switch_all(u->mixer_elem, !s->muted)) < 0) { | ||
| 104 | - pa_log_error("Unable to set switch: %s", snd_strerror(err)); | ||
| 105 | + pa_log_error("Unable to set switch: %s", pa_alsa_strerror(err)); | ||
| 106 | return; | ||
| 107 | } | ||
| 108 | } | ||
| 109 | @@ -1206,7 +1206,7 @@ static int process_rewind(struct userdata *u) { | ||
| 110 | pa_log_debug("Requested to rewind %lu bytes.", (unsigned long) rewind_nbytes); | ||
| 111 | |||
| 112 | if (PA_UNLIKELY((unused = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->sink->sample_spec)) < 0)) { | ||
| 113 | - pa_log("snd_pcm_avail() failed: %s", snd_strerror((int) unused)); | ||
| 114 | + pa_log("snd_pcm_avail() failed: %s", pa_alsa_strerror((int) unused)); | ||
| 115 | return -1; | ||
| 116 | } | ||
| 117 | |||
| 118 | @@ -1228,7 +1228,7 @@ static int process_rewind(struct userdata *u) { | ||
| 119 | in_frames = (snd_pcm_sframes_t) (rewind_nbytes / u->frame_size); | ||
| 120 | pa_log_debug("before: %lu", (unsigned long) in_frames); | ||
| 121 | if ((out_frames = snd_pcm_rewind(u->pcm_handle, (snd_pcm_uframes_t) in_frames)) < 0) { | ||
| 122 | - pa_log("snd_pcm_rewind() failed: %s", snd_strerror((int) out_frames)); | ||
| 123 | + pa_log("snd_pcm_rewind() failed: %s", pa_alsa_strerror((int) out_frames)); | ||
| 124 | return -1; | ||
| 125 | } | ||
| 126 | pa_log_debug("after: %lu", (unsigned long) out_frames); | ||
| 127 | @@ -1359,7 +1359,7 @@ static void thread_func(void *userdata) { | ||
| 128 | pollfd = pa_rtpoll_item_get_pollfd(u->alsa_rtpoll_item, &n); | ||
| 129 | |||
| 130 | if ((err = snd_pcm_poll_descriptors_revents(u->pcm_handle, pollfd, n, &revents)) < 0) { | ||
| 131 | - pa_log("snd_pcm_poll_descriptors_revents() failed: %s", snd_strerror(err)); | ||
| 132 | + pa_log("snd_pcm_poll_descriptors_revents() failed: %s", pa_alsa_strerror(err)); | ||
| 133 | goto fail; | ||
| 134 | } | ||
| 135 | |||
| 136 | diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c | ||
| 137 | index c59fc75..843f70b 100644 | ||
| 138 | --- a/src/modules/alsa/alsa-source.c | ||
| 139 | +++ b/src/modules/alsa/alsa-source.c | ||
| 140 | @@ -278,7 +278,7 @@ static int try_recover(struct userdata *u, const char *call, int err) { | ||
| 141 | pa_assert(call); | ||
| 142 | pa_assert(err < 0); | ||
| 143 | |||
| 144 | - pa_log_debug("%s: %s", call, snd_strerror(err)); | ||
| 145 | + pa_log_debug("%s: %s", call, pa_alsa_strerror(err)); | ||
| 146 | |||
| 147 | pa_assert(err != -EAGAIN); | ||
| 148 | |||
| 149 | @@ -286,7 +286,7 @@ static int try_recover(struct userdata *u, const char *call, int err) { | ||
| 150 | pa_log_debug("%s: Buffer overrun!", call); | ||
| 151 | |||
| 152 | if ((err = snd_pcm_recover(u->pcm_handle, err, 1)) < 0) { | ||
| 153 | - pa_log("%s: %s", call, snd_strerror(err)); | ||
| 154 | + pa_log("%s: %s", call, pa_alsa_strerror(err)); | ||
| 155 | return -1; | ||
| 156 | } | ||
| 157 | |||
| 158 | @@ -606,12 +606,12 @@ static void update_smoother(struct userdata *u) { | ||
| 159 | /* Let's update the time smoother */ | ||
| 160 | |||
| 161 | if (PA_UNLIKELY((err = pa_alsa_safe_delay(u->pcm_handle, &delay, u->hwbuf_size, &u->source->sample_spec)) < 0)) { | ||
| 162 | - pa_log_warn("Failed to get delay: %s", snd_strerror(err)); | ||
| 163 | + pa_log_warn("Failed to get delay: %s", pa_alsa_strerror(err)); | ||
| 164 | return; | ||
| 165 | } | ||
| 166 | |||
| 167 | if (PA_UNLIKELY((err = snd_pcm_status(u->pcm_handle, status)) < 0)) | ||
| 168 | - pa_log_warn("Failed to get timestamp: %s", snd_strerror(err)); | ||
| 169 | + pa_log_warn("Failed to get timestamp: %s", pa_alsa_strerror(err)); | ||
| 170 | else { | ||
| 171 | snd_htimestamp_t htstamp = { 0, 0 }; | ||
| 172 | snd_pcm_status_get_htstamp(status, &htstamp); | ||
| 173 | @@ -721,7 +721,7 @@ static int update_sw_params(struct userdata *u) { | ||
| 174 | pa_log_debug("setting avail_min=%lu", (unsigned long) avail_min); | ||
| 175 | |||
| 176 | if ((err = pa_alsa_set_sw_params(u->pcm_handle, avail_min)) < 0) { | ||
| 177 | - pa_log("Failed to set software parameters: %s", snd_strerror(err)); | ||
| 178 | + pa_log("Failed to set software parameters: %s", pa_alsa_strerror(err)); | ||
| 179 | return err; | ||
| 180 | } | ||
| 181 | |||
| 182 | @@ -747,7 +747,7 @@ static int unsuspend(struct userdata *u) { | ||
| 183 | SND_PCM_NO_AUTO_RESAMPLE| | ||
| 184 | SND_PCM_NO_AUTO_CHANNELS| | ||
| 185 | SND_PCM_NO_AUTO_FORMAT)) < 0) { | ||
| 186 | - pa_log("Error opening PCM device %s: %s", u->device_name, snd_strerror(err)); | ||
| 187 | + pa_log("Error opening PCM device %s: %s", u->device_name, pa_alsa_strerror(err)); | ||
| 188 | goto fail; | ||
| 189 | } | ||
| 190 | |||
| 191 | @@ -758,7 +758,7 @@ static int unsuspend(struct userdata *u) { | ||
| 192 | d = u->use_tsched; | ||
| 193 | |||
| 194 | if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &nfrags, &period_size, u->hwbuf_size / u->frame_size, &b, &d, TRUE)) < 0) { | ||
| 195 | - pa_log("Failed to set hardware parameters: %s", snd_strerror(err)); | ||
| 196 | + pa_log("Failed to set hardware parameters: %s", pa_alsa_strerror(err)); | ||
| 197 | goto fail; | ||
| 198 | } | ||
| 199 | |||
| 200 | @@ -988,7 +988,7 @@ static void source_get_volume_cb(pa_source *s) { | ||
| 201 | return; | ||
| 202 | |||
| 203 | fail: | ||
| 204 | - pa_log_error("Unable to read volume: %s", snd_strerror(err)); | ||
| 205 | + pa_log_error("Unable to read volume: %s", pa_alsa_strerror(err)); | ||
| 206 | } | ||
| 207 | |||
| 208 | static void source_set_volume_cb(pa_source *s) { | ||
| 209 | @@ -1100,7 +1100,7 @@ static void source_set_volume_cb(pa_source *s) { | ||
| 210 | return; | ||
| 211 | |||
| 212 | fail: | ||
| 213 | - pa_log_error("Unable to set volume: %s", snd_strerror(err)); | ||
| 214 | + pa_log_error("Unable to set volume: %s", pa_alsa_strerror(err)); | ||
| 215 | } | ||
| 216 | |||
| 217 | static void source_get_mute_cb(pa_source *s) { | ||
| 218 | @@ -1111,7 +1111,7 @@ static void source_get_mute_cb(pa_source *s) { | ||
| 219 | pa_assert(u->mixer_elem); | ||
| 220 | |||
| 221 | if ((err = snd_mixer_selem_get_capture_switch(u->mixer_elem, 0, &sw)) < 0) { | ||
| 222 | - pa_log_error("Unable to get switch: %s", snd_strerror(err)); | ||
| 223 | + pa_log_error("Unable to get switch: %s", pa_alsa_strerror(err)); | ||
| 224 | return; | ||
| 225 | } | ||
| 226 | |||
| 227 | @@ -1126,7 +1126,7 @@ static void source_set_mute_cb(pa_source *s) { | ||
| 228 | pa_assert(u->mixer_elem); | ||
| 229 | |||
| 230 | if ((err = snd_mixer_selem_set_capture_switch_all(u->mixer_elem, !s->muted)) < 0) { | ||
| 231 | - pa_log_error("Unable to set switch: %s", snd_strerror(err)); | ||
| 232 | + pa_log_error("Unable to set switch: %s", pa_alsa_strerror(err)); | ||
| 233 | return; | ||
| 234 | } | ||
| 235 | } | ||
| 236 | @@ -1218,7 +1218,7 @@ static void thread_func(void *userdata) { | ||
| 237 | pollfd = pa_rtpoll_item_get_pollfd(u->alsa_rtpoll_item, &n); | ||
| 238 | |||
| 239 | if ((err = snd_pcm_poll_descriptors_revents(u->pcm_handle, pollfd, n, &revents)) < 0) { | ||
| 240 | - pa_log("snd_pcm_poll_descriptors_revents() failed: %s", snd_strerror(err)); | ||
| 241 | + pa_log("snd_pcm_poll_descriptors_revents() failed: %s", pa_alsa_strerror(err)); | ||
| 242 | goto fail; | ||
| 243 | } | ||
| 244 | |||
| 245 | diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c | ||
| 246 | index d2dc6e8..ddc3c77 100644 | ||
| 247 | --- a/src/modules/alsa/alsa-util.c | ||
| 248 | +++ b/src/modules/alsa/alsa-util.c | ||
| 249 | @@ -33,6 +33,7 @@ | ||
| 250 | #include <pulse/timeval.h> | ||
| 251 | #include <pulse/util.h> | ||
| 252 | #include <pulse/i18n.h> | ||
| 253 | +#include <pulse/utf8.h> | ||
| 254 | |||
| 255 | #include <pulsecore/log.h> | ||
| 256 | #include <pulsecore/macro.h> | ||
| 257 | @@ -40,6 +41,7 @@ | ||
| 258 | #include <pulsecore/atomic.h> | ||
| 259 | #include <pulsecore/core-error.h> | ||
| 260 | #include <pulsecore/once.h> | ||
| 261 | +#include <pulsecore/thread.h> | ||
| 262 | |||
| 263 | #include "alsa-util.h" | ||
| 264 | |||
| 265 | @@ -106,7 +108,7 @@ static void io_cb(pa_mainloop_api*a, pa_io_event* e, int fd, pa_io_event_flags_t | ||
| 266 | pa_assert(i != fdl->num_fds); | ||
| 267 | |||
| 268 | if ((err = snd_mixer_poll_descriptors_revents(fdl->mixer, fdl->work_fds, fdl->num_fds, &revents)) < 0) { | ||
| 269 | - pa_log_error("Unable to get poll revent: %s", snd_strerror(err)); | ||
| 270 | + pa_log_error("Unable to get poll revent: %s", pa_alsa_strerror(err)); | ||
| 271 | return; | ||
| 272 | } | ||
| 273 | |||
| 274 | @@ -129,7 +131,7 @@ static void defer_cb(pa_mainloop_api*a, pa_defer_event* e, void *userdata) { | ||
| 275 | a->defer_enable(fdl->defer, 0); | ||
| 276 | |||
| 277 | if ((n = snd_mixer_poll_descriptors_count(fdl->mixer)) < 0) { | ||
| 278 | - pa_log("snd_mixer_poll_descriptors_count() failed: %s", snd_strerror(n)); | ||
| 279 | + pa_log("snd_mixer_poll_descriptors_count() failed: %s", pa_alsa_strerror(n)); | ||
| 280 | return; | ||
| 281 | } | ||
| 282 | num_fds = (unsigned) n; | ||
| 283 | @@ -146,7 +148,7 @@ static void defer_cb(pa_mainloop_api*a, pa_defer_event* e, void *userdata) { | ||
| 284 | memset(fdl->work_fds, 0, sizeof(struct pollfd) * num_fds); | ||
| 285 | |||
| 286 | if ((err = snd_mixer_poll_descriptors(fdl->mixer, fdl->work_fds, num_fds)) < 0) { | ||
| 287 | - pa_log_error("Unable to get poll descriptors: %s", snd_strerror(err)); | ||
| 288 | + pa_log_error("Unable to get poll descriptors: %s", pa_alsa_strerror(err)); | ||
| 289 | return; | ||
| 290 | } | ||
| 291 | |||
| 292 | @@ -482,42 +484,42 @@ int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min) { | ||
| 293 | snd_pcm_sw_params_alloca(&swparams); | ||
| 294 | |||
| 295 | if ((err = snd_pcm_sw_params_current(pcm, swparams) < 0)) { | ||
| 296 | - pa_log_warn("Unable to determine current swparams: %s\n", snd_strerror(err)); | ||
| 297 | + pa_log_warn("Unable to determine current swparams: %s\n", pa_alsa_strerror(err)); | ||
| 298 | return err; | ||
| 299 | } | ||
| 300 | |||
| 301 | if ((err = snd_pcm_sw_params_set_period_event(pcm, swparams, 0)) < 0) { | ||
| 302 | - pa_log_warn("Unable to disable period event: %s\n", snd_strerror(err)); | ||
| 303 | + pa_log_warn("Unable to disable period event: %s\n", pa_alsa_strerror(err)); | ||
| 304 | return err; | ||
| 305 | } | ||
| 306 | |||
| 307 | if ((err = snd_pcm_sw_params_set_tstamp_mode(pcm, swparams, SND_PCM_TSTAMP_ENABLE)) < 0) { | ||
| 308 | - pa_log_warn("Unable to enable time stamping: %s\n", snd_strerror(err)); | ||
| 309 | + pa_log_warn("Unable to enable time stamping: %s\n", pa_alsa_strerror(err)); | ||
| 310 | return err; | ||
| 311 | } | ||
| 312 | |||
| 313 | if ((err = snd_pcm_sw_params_get_boundary(swparams, &boundary)) < 0) { | ||
| 314 | - pa_log_warn("Unable to get boundary: %s\n", snd_strerror(err)); | ||
| 315 | + pa_log_warn("Unable to get boundary: %s\n", pa_alsa_strerror(err)); | ||
| 316 | return err; | ||
| 317 | } | ||
| 318 | |||
| 319 | if ((err = snd_pcm_sw_params_set_stop_threshold(pcm, swparams, boundary)) < 0) { | ||
| 320 | - pa_log_warn("Unable to set stop threshold: %s\n", snd_strerror(err)); | ||
| 321 | + pa_log_warn("Unable to set stop threshold: %s\n", pa_alsa_strerror(err)); | ||
| 322 | return err; | ||
| 323 | } | ||
| 324 | |||
| 325 | if ((err = snd_pcm_sw_params_set_start_threshold(pcm, swparams, (snd_pcm_uframes_t) -1)) < 0) { | ||
| 326 | - pa_log_warn("Unable to set start threshold: %s\n", snd_strerror(err)); | ||
| 327 | + pa_log_warn("Unable to set start threshold: %s\n", pa_alsa_strerror(err)); | ||
| 328 | return err; | ||
| 329 | } | ||
| 330 | |||
| 331 | if ((err = snd_pcm_sw_params_set_avail_min(pcm, swparams, avail_min)) < 0) { | ||
| 332 | - pa_log_error("snd_pcm_sw_params_set_avail_min() failed: %s", snd_strerror(err)); | ||
| 333 | + pa_log_error("snd_pcm_sw_params_set_avail_min() failed: %s", pa_alsa_strerror(err)); | ||
| 334 | return err; | ||
| 335 | } | ||
| 336 | |||
| 337 | if ((err = snd_pcm_sw_params(pcm, swparams)) < 0) { | ||
| 338 | - pa_log_warn("Unable to set sw params: %s\n", snd_strerror(err)); | ||
| 339 | + pa_log_warn("Unable to set sw params: %s\n", pa_alsa_strerror(err)); | ||
| 340 | return err; | ||
| 341 | } | ||
| 342 | |||
| 343 | @@ -854,7 +856,7 @@ snd_pcm_t *pa_alsa_open_by_device_string( | ||
| 344 | SND_PCM_NO_AUTO_RESAMPLE| | ||
| 345 | SND_PCM_NO_AUTO_CHANNELS| | ||
| 346 | (reformat ? 0 : SND_PCM_NO_AUTO_FORMAT))) < 0) { | ||
| 347 | - pa_log_info("Error opening PCM device %s: %s", d, snd_strerror(err)); | ||
| 348 | + pa_log_info("Error opening PCM device %s: %s", d, pa_alsa_strerror(err)); | ||
| 349 | goto fail; | ||
| 350 | } | ||
| 351 | |||
| 352 | @@ -882,7 +884,7 @@ snd_pcm_t *pa_alsa_open_by_device_string( | ||
| 353 | continue; | ||
| 354 | } | ||
| 355 | |||
| 356 | - pa_log_info("Failed to set hardware parameters on %s: %s", d, snd_strerror(err)); | ||
| 357 | + pa_log_info("Failed to set hardware parameters on %s: %s", d, pa_alsa_strerror(err)); | ||
| 358 | snd_pcm_close(pcm_handle); | ||
| 359 | |||
| 360 | goto fail; | ||
| 361 | @@ -1000,17 +1002,17 @@ int pa_alsa_prepare_mixer(snd_mixer_t *mixer, const char *dev) { | ||
| 362 | pa_assert(dev); | ||
| 363 | |||
| 364 | if ((err = snd_mixer_attach(mixer, dev)) < 0) { | ||
| 365 | - pa_log_info("Unable to attach to mixer %s: %s", dev, snd_strerror(err)); | ||
| 366 | + pa_log_info("Unable to attach to mixer %s: %s", dev, pa_alsa_strerror(err)); | ||
| 367 | return -1; | ||
| 368 | } | ||
| 369 | |||
| 370 | if ((err = snd_mixer_selem_register(mixer, NULL, NULL)) < 0) { | ||
| 371 | - pa_log_warn("Unable to register mixer: %s", snd_strerror(err)); | ||
| 372 | + pa_log_warn("Unable to register mixer: %s", pa_alsa_strerror(err)); | ||
| 373 | return -1; | ||
| 374 | } | ||
| 375 | |||
| 376 | if ((err = snd_mixer_load(mixer)) < 0) { | ||
| 377 | - pa_log_warn("Unable to load mixer: %s", snd_strerror(err)); | ||
| 378 | + pa_log_warn("Unable to load mixer: %s", pa_alsa_strerror(err)); | ||
| 379 | return -1; | ||
| 380 | } | ||
| 381 | |||
| 382 | @@ -1136,7 +1138,7 @@ int pa_alsa_find_mixer_and_elem( | ||
| 383 | } | ||
| 384 | |||
| 385 | if ((err = snd_mixer_open(&m, 0)) < 0) { | ||
| 386 | - pa_log("Error opening mixer: %s", snd_strerror(err)); | ||
| 387 | + pa_log("Error opening mixer: %s", pa_alsa_strerror(err)); | ||
| 388 | return -1; | ||
| 389 | } | ||
| 390 | |||
| 391 | @@ -1338,7 +1340,7 @@ void pa_alsa_dump(pa_log_level_t level, snd_pcm_t *pcm) { | ||
| 392 | pa_assert_se(snd_output_buffer_open(&out) == 0); | ||
| 393 | |||
| 394 | if ((err = snd_pcm_dump(pcm, out)) < 0) | ||
| 395 | - pa_logl(level, "snd_pcm_dump(): %s", snd_strerror(err)); | ||
| 396 | + pa_logl(level, "snd_pcm_dump(): %s", pa_alsa_strerror(err)); | ||
| 397 | else { | ||
| 398 | char *s = NULL; | ||
| 399 | snd_output_buffer_string(out, &s); | ||
| 400 | @@ -1362,7 +1364,7 @@ void pa_alsa_dump_status(snd_pcm_t *pcm) { | ||
| 401 | pa_assert_se(snd_pcm_status(pcm, status) == 0); | ||
| 402 | |||
| 403 | if ((err = snd_pcm_status_dump(status, out)) < 0) | ||
| 404 | - pa_log_debug("snd_pcm_dump(): %s", snd_strerror(err)); | ||
| 405 | + pa_log_debug("snd_pcm_dump(): %s", pa_alsa_strerror(err)); | ||
| 406 | else { | ||
| 407 | char *s = NULL; | ||
| 408 | snd_output_buffer_string(out, &s); | ||
| 409 | @@ -1524,7 +1526,7 @@ void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm, snd_m | ||
| 410 | snd_pcm_info_alloca(&info); | ||
| 411 | |||
| 412 | if ((err = snd_pcm_hw_params_current(pcm, hwparams)) < 0) | ||
| 413 | - pa_log_warn("Error fetching hardware parameter info: %s", snd_strerror(err)); | ||
| 414 | + pa_log_warn("Error fetching hardware parameter info: %s", pa_alsa_strerror(err)); | ||
| 415 | else { | ||
| 416 | |||
| 417 | if ((bits = snd_pcm_hw_params_get_sbits(hwparams)) >= 0) | ||
| 418 | @@ -1535,7 +1537,7 @@ void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm, snd_m | ||
| 419 | pa_proplist_sets(p, "alsa.mixer_element", snd_mixer_selem_get_name(elem)); | ||
| 420 | |||
| 421 | if ((err = snd_pcm_info(pcm, info)) < 0) | ||
| 422 | - pa_log_warn("Error fetching PCM info: %s", snd_strerror(err)); | ||
| 423 | + pa_log_warn("Error fetching PCM info: %s", pa_alsa_strerror(err)); | ||
| 424 | else | ||
| 425 | pa_alsa_init_proplist_pcm_info(c, p, info); | ||
| 426 | } | ||
| 427 | @@ -1568,14 +1570,14 @@ int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents) { | ||
| 428 | |||
| 429 | case SND_PCM_STATE_XRUN: | ||
| 430 | if ((err = snd_pcm_recover(pcm, -EPIPE, 1)) != 0) { | ||
| 431 | - pa_log_warn("Could not recover from POLLERR|POLLNVAL|POLLHUP and XRUN: %s", snd_strerror(err)); | ||
| 432 | + pa_log_warn("Could not recover from POLLERR|POLLNVAL|POLLHUP and XRUN: %s", pa_alsa_strerror(err)); | ||
| 433 | return -1; | ||
| 434 | } | ||
| 435 | break; | ||
| 436 | |||
| 437 | case SND_PCM_STATE_SUSPENDED: | ||
| 438 | if ((err = snd_pcm_recover(pcm, -ESTRPIPE, 1)) != 0) { | ||
| 439 | - pa_log_warn("Could not recover from POLLERR|POLLNVAL|POLLHUP and SUSPENDED: %s", snd_strerror(err)); | ||
| 440 | + pa_log_warn("Could not recover from POLLERR|POLLNVAL|POLLHUP and SUSPENDED: %s", pa_alsa_strerror(err)); | ||
| 441 | return -1; | ||
| 442 | } | ||
| 443 | break; | ||
| 444 | @@ -1585,7 +1587,7 @@ int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents) { | ||
| 445 | snd_pcm_drop(pcm); | ||
| 446 | |||
| 447 | if ((err = snd_pcm_prepare(pcm)) < 0) { | ||
| 448 | - pa_log_warn("Could not recover from POLLERR|POLLNVAL|POLLHUP with snd_pcm_prepare(): %s", snd_strerror(err)); | ||
| 449 | + pa_log_warn("Could not recover from POLLERR|POLLNVAL|POLLHUP with snd_pcm_prepare(): %s", pa_alsa_strerror(err)); | ||
| 450 | return -1; | ||
| 451 | } | ||
| 452 | break; | ||
| 453 | @@ -1602,7 +1604,7 @@ pa_rtpoll_item* pa_alsa_build_pollfd(snd_pcm_t *pcm, pa_rtpoll *rtpoll) { | ||
| 454 | pa_assert(pcm); | ||
| 455 | |||
| 456 | if ((n = snd_pcm_poll_descriptors_count(pcm)) < 0) { | ||
| 457 | - pa_log("snd_pcm_poll_descriptors_count() failed: %s", snd_strerror(n)); | ||
| 458 | + pa_log("snd_pcm_poll_descriptors_count() failed: %s", pa_alsa_strerror(n)); | ||
| 459 | return NULL; | ||
| 460 | } | ||
| 461 | |||
| 462 | @@ -1610,7 +1612,7 @@ pa_rtpoll_item* pa_alsa_build_pollfd(snd_pcm_t *pcm, pa_rtpoll *rtpoll) { | ||
| 463 | pollfd = pa_rtpoll_item_get_pollfd(item, NULL); | ||
| 464 | |||
| 465 | if ((err = snd_pcm_poll_descriptors(pcm, pollfd, (unsigned) n)) < 0) { | ||
| 466 | - pa_log("snd_pcm_poll_descriptors() failed: %s", snd_strerror(err)); | ||
| 467 | + pa_log("snd_pcm_poll_descriptors() failed: %s", pa_alsa_strerror(err)); | ||
| 468 | pa_rtpoll_item_free(item); | ||
| 469 | return NULL; | ||
| 470 | } | ||
| 471 | @@ -1819,3 +1821,30 @@ pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm) { | ||
| 472 | |||
| 473 | return snd_pcm_info_get_class(info) == SND_PCM_CLASS_MODEM; | ||
| 474 | } | ||
| 475 | + | ||
| 476 | +PA_STATIC_TLS_DECLARE(cstrerror, pa_xfree); | ||
| 477 | + | ||
| 478 | +const char* pa_alsa_strerror(int errnum) { | ||
| 479 | + const char *original = NULL; | ||
| 480 | + char *translated, *t; | ||
| 481 | + char errbuf[128]; | ||
| 482 | + | ||
| 483 | + if ((t = PA_STATIC_TLS_GET(cstrerror))) | ||
| 484 | + pa_xfree(t); | ||
| 485 | + | ||
| 486 | + original = snd_strerror(errnum); | ||
| 487 | + | ||
| 488 | + if (!original) { | ||
| 489 | + pa_snprintf(errbuf, sizeof(errbuf), "Unknown error %i", errnum); | ||
| 490 | + original = errbuf; | ||
| 491 | + } | ||
| 492 | + | ||
| 493 | + if (!(translated = pa_locale_to_utf8(original))) { | ||
| 494 | + pa_log_warn("Unable to convert error string to locale, filtering."); | ||
| 495 | + translated = pa_utf8_filter(original); | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + PA_STATIC_TLS_SET(cstrerror, translated); | ||
| 499 | + | ||
| 500 | + return translated; | ||
| 501 | +} | ||
| 502 | diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h | ||
| 503 | index c8acc7c..77ac8a7 100644 | ||
| 504 | --- a/src/modules/alsa/alsa-util.h | ||
| 505 | +++ b/src/modules/alsa/alsa-util.h | ||
| 506 | @@ -146,4 +146,6 @@ pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm); | ||
| 507 | |||
| 508 | pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm); | ||
| 509 | |||
| 510 | +const char* pa_alsa_strerror(int errnum); | ||
| 511 | + | ||
| 512 | #endif | ||
| 513 | diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c | ||
| 514 | index fdc952d..51d466e 100644 | ||
| 515 | --- a/src/modules/alsa/module-alsa-card.c | ||
| 516 | +++ b/src/modules/alsa/module-alsa-card.c | ||
| 517 | @@ -304,7 +304,7 @@ int pa__init(pa_module *m) { | ||
| 518 | u->modargs = ma; | ||
| 519 | |||
| 520 | if ((alsa_card_index = snd_card_get_index(u->device_id)) < 0) { | ||
| 521 | - pa_log("Card '%s' doesn't exist: %s", u->device_id, snd_strerror(alsa_card_index)); | ||
| 522 | + pa_log("Card '%s' doesn't exist: %s", u->device_id, pa_alsa_strerror(alsa_card_index)); | ||
| 523 | goto fail; | ||
| 524 | } | ||
| 525 | |||
