diff options
5 files changed, 941 insertions, 1 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 | |||
diff --git a/meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/fallback.patch b/meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/fallback.patch new file mode 100644 index 0000000000..2fae0d4e78 --- /dev/null +++ b/meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/fallback.patch | |||
| @@ -0,0 +1,338 @@ | |||
| 1 | From: Lennart Poettering <lennart@poettering.net> | ||
| 2 | Date: Tue, 28 Apr 2009 23:58:18 +0000 (+0200) | ||
| 3 | Subject: alsa: allow configuration of fallback device strings in profiles | ||
| 4 | X-Git-Url: http://git.0pointer.de/?p=pulseaudio.git;a=commitdiff_plain;h=d8710711fb0c74b4ad83ac99c2501218155b502b | ||
| 5 | |||
| 6 | alsa: allow configuration of fallback device strings in profiles | ||
| 7 | |||
| 8 | This has the benefit that we can properly support ALSA devices where | ||
| 9 | only the raw 'hw' device exists but no 'front' although it's a proper | ||
| 10 | 2ch stereo device. | ||
| 11 | --- | ||
| 12 | |||
| 13 | diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c | ||
| 14 | index 18d6880..a3a0450 100644 | ||
| 15 | --- a/src/modules/alsa/alsa-util.c | ||
| 16 | +++ b/src/modules/alsa/alsa-util.c | ||
| 17 | @@ -528,7 +528,7 @@ int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min) { | ||
| 18 | |||
| 19 | static const struct pa_alsa_profile_info device_table[] = { | ||
| 20 | {{ 1, { PA_CHANNEL_POSITION_MONO }}, | ||
| 21 | - "hw", | ||
| 22 | + "hw", NULL, | ||
| 23 | N_("Analog Mono"), | ||
| 24 | "analog-mono", | ||
| 25 | 1, | ||
| 26 | @@ -536,7 +536,7 @@ static const struct pa_alsa_profile_info device_table[] = { | ||
| 27 | "Capture", "Mic" }, | ||
| 28 | |||
| 29 | {{ 2, { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT }}, | ||
| 30 | - "front", | ||
| 31 | + "front", "hw", | ||
| 32 | N_("Analog Stereo"), | ||
| 33 | "analog-stereo", | ||
| 34 | 10, | ||
| 35 | @@ -544,7 +544,7 @@ static const struct pa_alsa_profile_info device_table[] = { | ||
| 36 | "Capture", "Mic" }, | ||
| 37 | |||
| 38 | {{ 2, { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT }}, | ||
| 39 | - "iec958", | ||
| 40 | + "iec958", NULL, | ||
| 41 | N_("Digital Stereo (IEC958)"), | ||
| 42 | "iec958-stereo", | ||
| 43 | 5, | ||
| 44 | @@ -552,7 +552,7 @@ static const struct pa_alsa_profile_info device_table[] = { | ||
| 45 | "IEC958 In", NULL }, | ||
| 46 | |||
| 47 | {{ 2, { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT }}, | ||
| 48 | - "hdmi", | ||
| 49 | + "hdmi", NULL, | ||
| 50 | N_("Digital Stereo (HDMI)"), | ||
| 51 | "hdmi-stereo", | ||
| 52 | 4, | ||
| 53 | @@ -561,7 +561,7 @@ static const struct pa_alsa_profile_info device_table[] = { | ||
| 54 | |||
| 55 | {{ 4, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT, | ||
| 56 | PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT }}, | ||
| 57 | - "surround40", | ||
| 58 | + "surround40", NULL, | ||
| 59 | N_("Analog Surround 4.0"), | ||
| 60 | "analog-surround-40", | ||
| 61 | 7, | ||
| 62 | @@ -570,7 +570,7 @@ static const struct pa_alsa_profile_info device_table[] = { | ||
| 63 | |||
| 64 | {{ 4, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT, | ||
| 65 | PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT }}, | ||
| 66 | - "a52", | ||
| 67 | + "a52", NULL, | ||
| 68 | N_("Digital Surround 4.0 (IEC958/AC3)"), | ||
| 69 | "iec958-ac3-surround-40", | ||
| 70 | 2, | ||
| 71 | @@ -580,7 +580,7 @@ static const struct pa_alsa_profile_info device_table[] = { | ||
| 72 | {{ 5, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT, | ||
| 73 | PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT, | ||
| 74 | PA_CHANNEL_POSITION_LFE }}, | ||
| 75 | - "surround41", | ||
| 76 | + "surround41", NULL, | ||
| 77 | N_("Analog Surround 4.1"), | ||
| 78 | "analog-surround-41", | ||
| 79 | 7, | ||
| 80 | @@ -590,7 +590,7 @@ static const struct pa_alsa_profile_info device_table[] = { | ||
| 81 | {{ 5, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT, | ||
| 82 | PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT, | ||
| 83 | PA_CHANNEL_POSITION_CENTER }}, | ||
| 84 | - "surround50", | ||
| 85 | + "surround50", NULL, | ||
| 86 | N_("Analog Surround 5.0"), | ||
| 87 | "analog-surround-50", | ||
| 88 | 7, | ||
| 89 | @@ -600,7 +600,7 @@ static const struct pa_alsa_profile_info device_table[] = { | ||
| 90 | {{ 6, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT, | ||
| 91 | PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT, | ||
| 92 | PA_CHANNEL_POSITION_CENTER, PA_CHANNEL_POSITION_LFE }}, | ||
| 93 | - "surround51", | ||
| 94 | + "surround51", NULL, | ||
| 95 | N_("Analog Surround 5.1"), | ||
| 96 | "analog-surround-51", | ||
| 97 | 8, | ||
| 98 | @@ -610,7 +610,7 @@ static const struct pa_alsa_profile_info device_table[] = { | ||
| 99 | {{ 6, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT, | ||
| 100 | PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT, | ||
| 101 | PA_CHANNEL_POSITION_FRONT_CENTER, PA_CHANNEL_POSITION_LFE}}, | ||
| 102 | - "a52", | ||
| 103 | + "a52", NULL, | ||
| 104 | N_("Digital Surround 5.1 (IEC958/AC3)"), | ||
| 105 | "iec958-ac3-surround-51", | ||
| 106 | 3, | ||
| 107 | @@ -621,16 +621,72 @@ static const struct pa_alsa_profile_info device_table[] = { | ||
| 108 | PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT, | ||
| 109 | PA_CHANNEL_POSITION_CENTER, PA_CHANNEL_POSITION_LFE, | ||
| 110 | PA_CHANNEL_POSITION_SIDE_LEFT, PA_CHANNEL_POSITION_SIDE_RIGHT }}, | ||
| 111 | - "surround71", | ||
| 112 | + "surround71", NULL, | ||
| 113 | N_("Analog Surround 7.1"), | ||
| 114 | "analog-surround-71", | ||
| 115 | 7, | ||
| 116 | "Master", "PCM", | ||
| 117 | "Capture", "Mic" }, | ||
| 118 | |||
| 119 | - {{ 0, { 0 }}, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL } | ||
| 120 | + {{ 0, { 0 }}, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL } | ||
| 121 | }; | ||
| 122 | |||
| 123 | +static snd_pcm_t *open_by_device_string_with_fallback( | ||
| 124 | + const char *prefix, | ||
| 125 | + const char *prefix_fallback, | ||
| 126 | + const char *dev_id, | ||
| 127 | + char **dev, | ||
| 128 | + pa_sample_spec *ss, | ||
| 129 | + pa_channel_map* map, | ||
| 130 | + int mode, | ||
| 131 | + uint32_t *nfrags, | ||
| 132 | + snd_pcm_uframes_t *period_size, | ||
| 133 | + snd_pcm_uframes_t tsched_size, | ||
| 134 | + pa_bool_t *use_mmap, | ||
| 135 | + pa_bool_t *use_tsched, | ||
| 136 | + pa_bool_t require_exact_channel_number) { | ||
| 137 | + | ||
| 138 | + snd_pcm_t *pcm_handle; | ||
| 139 | + char *d; | ||
| 140 | + | ||
| 141 | + d = pa_sprintf_malloc("%s:%s", prefix, dev_id); | ||
| 142 | + | ||
| 143 | + pcm_handle = pa_alsa_open_by_device_string( | ||
| 144 | + d, | ||
| 145 | + dev, | ||
| 146 | + ss, | ||
| 147 | + map, | ||
| 148 | + mode, | ||
| 149 | + nfrags, | ||
| 150 | + period_size, | ||
| 151 | + tsched_size, | ||
| 152 | + use_mmap, | ||
| 153 | + use_tsched, | ||
| 154 | + require_exact_channel_number); | ||
| 155 | + pa_xfree(d); | ||
| 156 | + | ||
| 157 | + if (!pcm_handle && prefix_fallback) { | ||
| 158 | + | ||
| 159 | + d = pa_sprintf_malloc("%s:%s", prefix_fallback, dev_id); | ||
| 160 | + | ||
| 161 | + pcm_handle = pa_alsa_open_by_device_string( | ||
| 162 | + d, | ||
| 163 | + dev, | ||
| 164 | + ss, | ||
| 165 | + map, | ||
| 166 | + mode, | ||
| 167 | + nfrags, | ||
| 168 | + period_size, | ||
| 169 | + tsched_size, | ||
| 170 | + use_mmap, | ||
| 171 | + use_tsched, | ||
| 172 | + require_exact_channel_number); | ||
| 173 | + pa_xfree(d); | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + return pcm_handle; | ||
| 177 | +} | ||
| 178 | + | ||
| 179 | snd_pcm_t *pa_alsa_open_by_device_id_auto( | ||
| 180 | const char *dev_id, | ||
| 181 | char **dev, | ||
| 182 | @@ -671,14 +727,14 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto( | ||
| 183 | |||
| 184 | pa_log_debug("Checking for %s (%s)", device_table[i].name, device_table[i].alsa_name); | ||
| 185 | |||
| 186 | - d = pa_sprintf_malloc("%s:%s", device_table[i].alsa_name, dev_id); | ||
| 187 | - | ||
| 188 | try_ss.channels = device_table[i].map.channels; | ||
| 189 | try_ss.rate = ss->rate; | ||
| 190 | try_ss.format = ss->format; | ||
| 191 | |||
| 192 | - pcm_handle = pa_alsa_open_by_device_string( | ||
| 193 | - d, | ||
| 194 | + pcm_handle = open_by_device_string_with_fallback( | ||
| 195 | + device_table[i].alsa_name, | ||
| 196 | + device_table[i].alsa_name_fallback, | ||
| 197 | + dev_id, | ||
| 198 | dev, | ||
| 199 | &try_ss, | ||
| 200 | map, | ||
| 201 | @@ -690,8 +746,6 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto( | ||
| 202 | use_tsched, | ||
| 203 | TRUE); | ||
| 204 | |||
| 205 | - pa_xfree(d); | ||
| 206 | - | ||
| 207 | if (pcm_handle) { | ||
| 208 | |||
| 209 | *ss = try_ss; | ||
| 210 | @@ -703,6 +757,7 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto( | ||
| 211 | |||
| 212 | return pcm_handle; | ||
| 213 | } | ||
| 214 | + | ||
| 215 | } | ||
| 216 | |||
| 217 | if (direction > 0) { | ||
| 218 | @@ -775,7 +830,6 @@ snd_pcm_t *pa_alsa_open_by_device_id_profile( | ||
| 219 | pa_bool_t *use_tsched, | ||
| 220 | const pa_alsa_profile_info *profile) { | ||
| 221 | |||
| 222 | - char *d; | ||
| 223 | snd_pcm_t *pcm_handle; | ||
| 224 | pa_sample_spec try_ss; | ||
| 225 | |||
| 226 | @@ -787,14 +841,14 @@ snd_pcm_t *pa_alsa_open_by_device_id_profile( | ||
| 227 | pa_assert(period_size); | ||
| 228 | pa_assert(profile); | ||
| 229 | |||
| 230 | - d = pa_sprintf_malloc("%s:%s", profile->alsa_name, dev_id); | ||
| 231 | - | ||
| 232 | try_ss.channels = profile->map.channels; | ||
| 233 | try_ss.rate = ss->rate; | ||
| 234 | try_ss.format = ss->format; | ||
| 235 | |||
| 236 | - pcm_handle = pa_alsa_open_by_device_string( | ||
| 237 | - d, | ||
| 238 | + pcm_handle = open_by_device_string_with_fallback( | ||
| 239 | + profile->alsa_name, | ||
| 240 | + profile->alsa_name_fallback, | ||
| 241 | + dev_id, | ||
| 242 | dev, | ||
| 243 | &try_ss, | ||
| 244 | map, | ||
| 245 | @@ -806,8 +860,6 @@ snd_pcm_t *pa_alsa_open_by_device_id_profile( | ||
| 246 | use_tsched, | ||
| 247 | TRUE); | ||
| 248 | |||
| 249 | - pa_xfree(d); | ||
| 250 | - | ||
| 251 | if (!pcm_handle) | ||
| 252 | return NULL; | ||
| 253 | |||
| 254 | @@ -860,6 +912,8 @@ snd_pcm_t *pa_alsa_open_by_device_string( | ||
| 255 | goto fail; | ||
| 256 | } | ||
| 257 | |||
| 258 | + pa_log_debug("Managed to open %s", d); | ||
| 259 | + | ||
| 260 | if ((err = pa_alsa_set_hw_params(pcm_handle, ss, nfrags, period_size, tsched_size, use_mmap, use_tsched, require_exact_channel_number)) < 0) { | ||
| 261 | |||
| 262 | if (!reformat) { | ||
| 263 | @@ -928,26 +982,25 @@ int pa_alsa_probe_profiles( | ||
| 264 | snd_pcm_t *pcm_i = NULL; | ||
| 265 | |||
| 266 | if (i->alsa_name) { | ||
| 267 | - char *id; | ||
| 268 | pa_sample_spec try_ss; | ||
| 269 | pa_channel_map try_map; | ||
| 270 | |||
| 271 | pa_log_debug("Checking for playback on %s (%s)", i->name, i->alsa_name); | ||
| 272 | - id = pa_sprintf_malloc("%s:%s", i->alsa_name, dev_id); | ||
| 273 | |||
| 274 | try_ss = *ss; | ||
| 275 | try_ss.channels = i->map.channels; | ||
| 276 | try_map = i->map; | ||
| 277 | |||
| 278 | - pcm_i = pa_alsa_open_by_device_string( | ||
| 279 | - id, NULL, | ||
| 280 | + pcm_i = open_by_device_string_with_fallback( | ||
| 281 | + i->alsa_name, | ||
| 282 | + i->alsa_name_fallback, | ||
| 283 | + dev_id, | ||
| 284 | + NULL, | ||
| 285 | &try_ss, &try_map, | ||
| 286 | SND_PCM_STREAM_PLAYBACK, | ||
| 287 | NULL, NULL, 0, NULL, NULL, | ||
| 288 | TRUE); | ||
| 289 | |||
| 290 | - pa_xfree(id); | ||
| 291 | - | ||
| 292 | if (!pcm_i) | ||
| 293 | continue; | ||
| 294 | } | ||
| 295 | @@ -956,26 +1009,25 @@ int pa_alsa_probe_profiles( | ||
| 296 | snd_pcm_t *pcm_j = NULL; | ||
| 297 | |||
| 298 | if (j->alsa_name) { | ||
| 299 | - char *jd; | ||
| 300 | pa_sample_spec try_ss; | ||
| 301 | pa_channel_map try_map; | ||
| 302 | |||
| 303 | pa_log_debug("Checking for capture on %s (%s)", j->name, j->alsa_name); | ||
| 304 | - jd = pa_sprintf_malloc("%s:%s", j->alsa_name, dev_id); | ||
| 305 | |||
| 306 | try_ss = *ss; | ||
| 307 | try_ss.channels = j->map.channels; | ||
| 308 | try_map = j->map; | ||
| 309 | |||
| 310 | - pcm_j = pa_alsa_open_by_device_string( | ||
| 311 | - jd, NULL, | ||
| 312 | + pcm_j = open_by_device_string_with_fallback( | ||
| 313 | + j->alsa_name, | ||
| 314 | + j->alsa_name_fallback, | ||
| 315 | + dev_id, | ||
| 316 | + NULL, | ||
| 317 | &try_ss, &try_map, | ||
| 318 | SND_PCM_STREAM_CAPTURE, | ||
| 319 | NULL, NULL, 0, NULL, NULL, | ||
| 320 | TRUE); | ||
| 321 | |||
| 322 | - pa_xfree(jd); | ||
| 323 | - | ||
| 324 | if (!pcm_j) | ||
| 325 | continue; | ||
| 326 | } | ||
| 327 | diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h | ||
| 328 | index 77ac8a7..4c5d336 100644 | ||
| 329 | --- a/src/modules/alsa/alsa-util.h | ||
| 330 | +++ b/src/modules/alsa/alsa-util.h | ||
| 331 | @@ -56,6 +56,7 @@ int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min); | ||
| 332 | typedef struct pa_alsa_profile_info { | ||
| 333 | pa_channel_map map; | ||
| 334 | const char *alsa_name; | ||
| 335 | + const char *alsa_name_fallback; | ||
| 336 | const char *description; /* internationalized */ | ||
| 337 | const char *name; | ||
| 338 | unsigned priority; | ||
diff --git a/meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/periodfix.patch b/meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/periodfix.patch new file mode 100644 index 0000000000..3a1c605009 --- /dev/null +++ b/meta-moblin/packages/pulseaudio/pulseaudio-0.9.15/periodfix.patch | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | X-Git-Url: http://git.0pointer.de/?p=pulseaudio.git;a=blobdiff_plain;f=src%2Fmodules%2Falsa%2Falsa-util.c;h=107bec357c7889f0197853f5e5f1951a5a2f5be0;hp=a3a045080dac0e1b30e8671443ce73a03337cf14;hb=4bffc7849f7898fa85dd6ac8e735db86b57814b3;hpb=d2b5ae5525e9036c4f91b1615879a5a07aac5bf2 | ||
| 2 | |||
| 3 | diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c | ||
| 4 | index a3a0450..107bec3 100644 | ||
| 5 | --- a/src/modules/alsa/alsa-util.c | ||
| 6 | +++ b/src/modules/alsa/alsa-util.c | ||
| 7 | @@ -334,7 +334,6 @@ int pa_alsa_set_hw_params( | ||
| 8 | int ret = -1; | ||
| 9 | snd_pcm_uframes_t _period_size = period_size ? *period_size : 0; | ||
| 10 | unsigned int _periods = periods ? *periods : 0; | ||
| 11 | - snd_pcm_uframes_t buffer_size; | ||
| 12 | unsigned int r = ss->rate; | ||
| 13 | unsigned int c = ss->channels; | ||
| 14 | pa_sample_format_t f = ss->format; | ||
| 15 | @@ -390,39 +389,47 @@ int pa_alsa_set_hw_params( | ||
| 16 | goto finish; | ||
| 17 | |||
| 18 | if (_period_size && tsched_size && _periods) { | ||
| 19 | + | ||
| 20 | /* Adjust the buffer sizes, if we didn't get the rate we were asking for */ | ||
| 21 | _period_size = (snd_pcm_uframes_t) (((uint64_t) _period_size * r) / ss->rate); | ||
| 22 | tsched_size = (snd_pcm_uframes_t) (((uint64_t) tsched_size * r) / ss->rate); | ||
| 23 | |||
| 24 | if (_use_tsched) { | ||
| 25 | - _period_size = tsched_size; | ||
| 26 | - _periods = 1; | ||
| 27 | + snd_pcm_uframes_t buffer_size; | ||
| 28 | |||
| 29 | pa_assert_se(snd_pcm_hw_params_get_buffer_size_max(hwparams, &buffer_size) == 0); | ||
| 30 | pa_log_debug("Maximum hw buffer size is %u ms", (unsigned) buffer_size * 1000 / r); | ||
| 31 | + | ||
| 32 | + _period_size = tsched_size; | ||
| 33 | + _periods = 1; | ||
| 34 | } | ||
| 35 | |||
| 36 | + if (_period_size > 0 && _periods > 0) { | ||
| 37 | + snd_pcm_uframes_t buffer_size; | ||
| 38 | + | ||
| 39 | buffer_size = _periods * _period_size; | ||
| 40 | |||
| 41 | + if ((ret = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &buffer_size)) < 0) | ||
| 42 | + pa_log_info("snd_pcm_hw_params_set_buffer_size_near() failed: %s", pa_alsa_strerror(ret)); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | if (_periods > 0) { | ||
| 46 | |||
| 47 | - /* First we pass 0 as direction to get exactly what we asked | ||
| 48 | - * for. That this is necessary is presumably a bug in ALSA */ | ||
| 49 | + /* First we pass 0 as direction to get exactly what we | ||
| 50 | + * asked for. That this is necessary is presumably a bug | ||
| 51 | + * in ALSA. All in all this is mostly a hint to ALSA, so | ||
| 52 | + * we don't care if this fails. */ | ||
| 53 | |||
| 54 | dir = 0; | ||
| 55 | - if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir)) < 0) { | ||
| 56 | + if (snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir) < 0) { | ||
| 57 | dir = 1; | ||
| 58 | - if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir)) < 0) { | ||
| 59 | + if (snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir) < 0) { | ||
| 60 | dir = -1; | ||
| 61 | if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir)) < 0) | ||
| 62 | - goto finish; | ||
| 63 | + pa_log_info("snd_pcm_hw_params_set_periods_near() failed: %s", pa_alsa_strerror(ret)); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | } | ||
| 67 | - | ||
| 68 | - if (_period_size > 0) | ||
| 69 | - if ((ret = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &buffer_size)) < 0) | ||
| 70 | - goto finish; | ||
| 71 | } | ||
| 72 | |||
| 73 | if ((ret = snd_pcm_hw_params(pcm_handle, hwparams)) < 0) | ||
diff --git a/meta-moblin/packages/pulseaudio/pulseaudio.inc b/meta-moblin/packages/pulseaudio/pulseaudio.inc index aab6a79bf1..85b70a25ab 100644 --- a/meta-moblin/packages/pulseaudio/pulseaudio.inc +++ b/meta-moblin/packages/pulseaudio/pulseaudio.inc | |||
| @@ -115,6 +115,7 @@ RDEPENDS_pulseaudio-server = " \ | |||
| 115 | pulseaudio-module-detect \ | 115 | pulseaudio-module-detect \ |
| 116 | pulseaudio-module-alsa-sink \ | 116 | pulseaudio-module-alsa-sink \ |
| 117 | pulseaudio-module-alsa-source \ | 117 | pulseaudio-module-alsa-source \ |
| 118 | pulseaudio-module-alsa-card \ | ||
| 118 | pulseaudio-module-native-protocol-unix \ | 119 | pulseaudio-module-native-protocol-unix \ |
| 119 | pulseaudio-module-hal-detect \ | 120 | pulseaudio-module-hal-detect \ |
| 120 | pulseaudio-module-default-device-restore \ | 121 | pulseaudio-module-default-device-restore \ |
diff --git a/meta-moblin/packages/pulseaudio/pulseaudio_0.9.15.bb b/meta-moblin/packages/pulseaudio/pulseaudio_0.9.15.bb index 81193e3994..2b3ce75d90 100644 --- a/meta-moblin/packages/pulseaudio/pulseaudio_0.9.15.bb +++ b/meta-moblin/packages/pulseaudio/pulseaudio_0.9.15.bb | |||
| @@ -1,10 +1,13 @@ | |||
| 1 | require pulseaudio.inc | 1 | require pulseaudio.inc |
| 2 | 2 | ||
| 3 | DEPENDS += "dbus gdbm speex" | 3 | DEPENDS += "dbus gdbm speex" |
| 4 | PR = "r8" | 4 | PR = "r12" |
| 5 | 5 | ||
| 6 | SRC_URI += "\ | 6 | SRC_URI += "\ |
| 7 | file://buildfix.patch;patch=1 \ | 7 | file://buildfix.patch;patch=1 \ |
| 8 | file://alsaerror.patch;patch=1 \ | ||
| 9 | file://periodfix.patch;patch=1 \ | ||
| 10 | file://fallback.patch;patch=1 \ | ||
| 8 | file://autoconf_version.patch;patch=1 \ | 11 | file://autoconf_version.patch;patch=1 \ |
| 9 | " | 12 | " |
| 10 | 13 | ||
