diff options
Diffstat (limited to 'src/modules/alsa/alsa-util.c')
-rw-r--r-- | src/modules/alsa/alsa-util.c | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c index a0907c4d..d00a80f1 100644 --- a/src/modules/alsa/alsa-util.c +++ b/src/modules/alsa/alsa-util.c @@ -32,6 +32,7 @@ #include <pulse/xmalloc.h> #include <pulse/timeval.h> #include <pulse/util.h> +#include <pulse/i18n.h> #include <pulsecore/log.h> #include <pulsecore/macro.h> @@ -468,6 +469,7 @@ finish: int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min) { snd_pcm_sw_params_t *swparams; + snd_pcm_uframes_t boundary; int err; pa_assert(pcm); @@ -479,7 +481,22 @@ int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min) { return err; } - if ((err = snd_pcm_sw_params_set_stop_threshold(pcm, swparams, (snd_pcm_uframes_t) -1)) < 0) { + if ((err = snd_pcm_sw_params_set_period_event(pcm, swparams, 0)) < 0) { + pa_log_warn("Unable to disable period event: %s\n", snd_strerror(err)); + return err; + } + + if ((err = snd_pcm_sw_params_set_tstamp_mode(pcm, swparams, SND_PCM_TSTAMP_ENABLE)) < 0) { + pa_log_warn("Unable to enable time stamping: %s\n", snd_strerror(err)); + return err; + } + + if ((err = snd_pcm_sw_params_get_boundary(swparams, &boundary)) < 0) { + pa_log_warn("Unable to get boundary: %s\n", snd_strerror(err)); + return err; + } + + if ((err = snd_pcm_sw_params_set_stop_threshold(pcm, swparams, boundary)) < 0) { pa_log_warn("Unable to set stop threshold: %s\n", snd_strerror(err)); return err; } @@ -505,39 +522,39 @@ int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min) { static const struct pa_alsa_profile_info device_table[] = { {{ 1, { PA_CHANNEL_POSITION_MONO }}, "hw", - "Analog Mono", + N_("Analog Mono"), "analog-mono", 1 }, {{ 2, { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT }}, "front", - "Analog Stereo", + N_("Analog Stereo"), "analog-stereo", 10 }, {{ 2, { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT }}, "iec958", - "IEC958 Digital Stereo", + N_("Digital Stereo (IEC958)"), "iec958-stereo", 5 }, {{ 2, { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT }}, "hdmi", - "HDMI Digital Stereo", + N_("Digital Stereo (HDMI)"), "hdmi-stereo", 4 }, {{ 4, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT, PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT }}, "surround40", - "Analog Surround 4.0", + N_("Analog Surround 4.0"), "analog-surround-40", 7 }, {{ 4, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT, PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT }}, "a52", - "IEC958/AC3 Digital Surround 4.0", + N_("Digital Surround 4.0 (IEC958/AC3)"), "iec958-ac3-surround-40", 2 }, @@ -545,7 +562,7 @@ static const struct pa_alsa_profile_info device_table[] = { PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT, PA_CHANNEL_POSITION_LFE }}, "surround41", - "Analog Surround 4.1", + N_("Analog Surround 4.1"), "analog-surround-41", 7 }, @@ -553,7 +570,7 @@ static const struct pa_alsa_profile_info device_table[] = { PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT, PA_CHANNEL_POSITION_CENTER }}, "surround50", - "Analog Surround 5.0", + N_("Analog Surround 5.0"), "analog-surround-50", 7 }, @@ -561,7 +578,7 @@ static const struct pa_alsa_profile_info device_table[] = { PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT, PA_CHANNEL_POSITION_CENTER, PA_CHANNEL_POSITION_LFE }}, "surround51", - "Analog Surround 5.1", + N_("Analog Surround 5.1"), "analog-surround-51", 8 }, @@ -569,7 +586,7 @@ static const struct pa_alsa_profile_info device_table[] = { PA_CHANNEL_POSITION_FRONT_RIGHT, PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT, PA_CHANNEL_POSITION_LFE}}, "a52", - "IEC958/AC3 Digital Surround 5.1", + N_("Digital Surround 5.1 (IEC958/AC3)"), "iec958-ac3-surround-51", 3 }, @@ -578,7 +595,7 @@ static const struct pa_alsa_profile_info device_table[] = { PA_CHANNEL_POSITION_CENTER, PA_CHANNEL_POSITION_LFE, PA_CHANNEL_POSITION_SIDE_LEFT, PA_CHANNEL_POSITION_SIDE_RIGHT }}, "surround71", - "Analog Surround 7.1", + N_("Analog Surround 7.1"), "analog-surround-71", 7 }, @@ -1537,7 +1554,7 @@ pa_rtpoll_item* pa_alsa_build_pollfd(snd_pcm_t *pcm, pa_rtpoll *rtpoll) { return item; } -snd_pcm_sframes_t pa_alsa_safe_avail_update(snd_pcm_t *pcm, size_t hwbuf_size, const pa_sample_spec *ss) { +snd_pcm_sframes_t pa_alsa_safe_avail(snd_pcm_t *pcm, size_t hwbuf_size, const pa_sample_spec *ss) { snd_pcm_sframes_t n; size_t k; @@ -1548,7 +1565,7 @@ snd_pcm_sframes_t pa_alsa_safe_avail_update(snd_pcm_t *pcm, size_t hwbuf_size, c /* Some ALSA driver expose weird bugs, let's inform the user about * what is going on */ - n = snd_pcm_avail_update(pcm); + n = snd_pcm_avail(pcm); if (n <= 0) return n; @@ -1557,8 +1574,8 @@ snd_pcm_sframes_t pa_alsa_safe_avail_update(snd_pcm_t *pcm, size_t hwbuf_size, c if (k >= hwbuf_size * 3 || k >= pa_bytes_per_second(ss)*10) - pa_log("snd_pcm_avail_update() returned a value that is exceptionally large: %lu bytes (%lu ms). " - "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers.", + pa_log(_("snd_pcm_avail_update() returned a value that is exceptionally large: %lu bytes (%lu ms). " + "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers."), (unsigned long) k, (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC)); return n; @@ -1589,8 +1606,8 @@ int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas k >= hwbuf_size * 3 || k >= pa_bytes_per_second(ss)*10) - pa_log("snd_pcm_mmap_begin() returned a value that is exceptionally large: %lu bytes (%lu ms). " - "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers.", + pa_log(_("snd_pcm_mmap_begin() returned a value that is exceptionally large: %lu bytes (%lu ms). " + "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers."), (unsigned long) k, (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC)); return r; |