summaryrefslogtreecommitdiffstats
path: root/src/modules/alsa
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2009-11-11 10:48:39 +0100
committerDaniel Mack <daniel@caiaq.de>2009-11-11 10:48:39 +0100
commited7642ebac32bde8d9c47f3a1d8eabf75c3ea986 (patch)
tree9db77a271430da8abf7b6d11079bc660f7428094 /src/modules/alsa
parent21ffcd55a5a425870f8f4c3b4933bc7cb352e339 (diff)
parent22946427624afde1d53973fa5a2e9e2041ffc5b7 (diff)
Merge branch 'master' of git://0pointer.de/pulseaudio
Diffstat (limited to 'src/modules/alsa')
-rw-r--r--src/modules/alsa/alsa-mixer.c24
-rw-r--r--src/modules/alsa/alsa-sink.c5
-rw-r--r--src/modules/alsa/alsa-source.c5
-rw-r--r--src/modules/alsa/alsa-util.c24
-rw-r--r--src/modules/alsa/alsa-util.h2
-rw-r--r--src/modules/alsa/mixer/paths/analog-output.conf.common17
6 files changed, 59 insertions, 18 deletions
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index f3ce681f..8b13239c 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -1712,7 +1712,9 @@ static int option_verify(pa_alsa_option *o) {
{ "input-boost-on", N_("Boost") },
{ "input-boost-off", N_("No Boost") },
{ "output-amplifier-on", N_("Amplifier") },
- { "output-amplifier-off", N_("No Amplifier") }
+ { "output-amplifier-off", N_("No Amplifier") },
+ { "output-speaker", N_("Speaker") },
+ { "output-headphones", N_("Headphones") }
};
pa_assert(o);
@@ -1770,15 +1772,17 @@ static int element_verify(pa_alsa_element *e) {
static int path_verify(pa_alsa_path *p) {
static const struct description_map well_known_descriptions[] = {
- { "analog-input", N_("Analog Input") },
- { "analog-input-microphone", N_("Analog Microphone") },
- { "analog-input-linein", N_("Analog Line-In") },
- { "analog-input-radio", N_("Analog Radio") },
- { "analog-input-video", N_("Analog Video") },
- { "analog-output", N_("Analog Output") },
- { "analog-output-headphones", N_("Analog Headphones") },
- { "analog-output-lfe-on-mono", N_("Analog Output (LFE)") },
- { "analog-output-mono", N_("Analog Mono Output") }
+ { "analog-input", N_("Analog Input") },
+ { "analog-input-microphone", N_("Analog Microphone") },
+ { "analog-input-linein", N_("Analog Line-In") },
+ { "analog-input-radio", N_("Analog Radio") },
+ { "analog-input-video", N_("Analog Video") },
+ { "analog-output", N_("Analog Output") },
+ { "analog-output-headphones", N_("Analog Headphones") },
+ { "analog-output-lfe-on-mono", N_("Analog Output (LFE)") },
+ { "analog-output-mono", N_("Analog Mono Output") },
+ { "analog-output-headphones-2", N_("Analog Headphones 2") },
+ { "analog-output-speaker", N_("Analog Speaker") }
};
pa_alsa_element *e;
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 37419d98..856adb14 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1698,10 +1698,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
goto fail;
}
- if (use_tsched && !pa_rtclock_hrtimer()) {
- pa_log_notice("Disabling timer-based scheduling because high-resolution timers are not available from the kernel.");
- use_tsched = FALSE;
- }
+ use_tsched = pa_alsa_may_tsched(use_tsched);
u = pa_xnew0(struct userdata, 1);
u->core = m->core;
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 37dd6476..e775b20c 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1541,10 +1541,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
goto fail;
}
- if (use_tsched && !pa_rtclock_hrtimer()) {
- pa_log_notice("Disabling timer-based scheduling because high-resolution timers are not available from the kernel.");
- use_tsched = FALSE;
- }
+ use_tsched = pa_alsa_may_tsched(use_tsched);
u = pa_xnew0(struct userdata, 1);
u->core = m->core;
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index 0e22d17e..b8d13575 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -43,6 +43,7 @@
#include <pulsecore/once.h>
#include <pulsecore/thread.h>
#include <pulsecore/conf-parser.h>
+#include <pulsecore/core-rtclock.h>
#include "alsa-util.h"
#include "alsa-mixer.h"
@@ -1308,3 +1309,26 @@ const char* pa_alsa_strerror(int errnum) {
return translated;
}
+
+pa_bool_t pa_alsa_may_tsched(pa_bool_t want) {
+
+ if (!want)
+ return FALSE;
+
+ if (!pa_rtclock_hrtimer()) {
+ /* We cannot depend on being woken up in time when the timers
+ are inaccurate, so let's fallback to classic IO based playback
+ then. */
+ pa_log_notice("Disabling timer-based scheduling because high-resolution timers are not available from the kernel.");
+ return FALSE; }
+
+ if (pa_running_in_vm()) {
+ /* We cannot depend on being woken up when we ask for in a VM,
+ * so let's fallback to classic IO based playback then. */
+ pa_log_notice("Disabling timer-based scheduling because running inside a VM.");
+ return FALSE;
+ }
+
+
+ return TRUE;
+}
diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h
index f6206fe2..1d1256bd 100644
--- a/src/modules/alsa/alsa-util.h
+++ b/src/modules/alsa/alsa-util.h
@@ -142,4 +142,6 @@ pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm);
const char* pa_alsa_strerror(int errnum);
+pa_bool_t pa_alsa_may_tsched(pa_bool_t want);
+
#endif
diff --git a/src/modules/alsa/mixer/paths/analog-output.conf.common b/src/modules/alsa/mixer/paths/analog-output.conf.common
index 3c6ce803..fd7f0cfb 100644
--- a/src/modules/alsa/mixer/paths/analog-output.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-output.conf.common
@@ -109,3 +109,20 @@ priority = 10
[Option External Amplifier:off]
name = output-amplifier-off
priority = 0
+
+;;; 'Analog Output'
+
+[Element Analog Output]
+enumeration = select
+
+[Option Analog Output:Speakers]
+name = output-speaker
+priority = 10
+
+[Option Analog Output:Headphones]
+name = output-headphones
+priority = 9
+
+[Option Analog Output:FP Headphones]
+name = output-headphones
+priority = 8