aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutputs/audioOutput_alsa.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2005-03-12 03:10:09 +0000
committerWarren Dukes <warren.dukes@gmail.com>2005-03-12 03:10:09 +0000
commit8583a3bc4e9af2a1be06c82422a7cac1470341ce (patch)
tree4befe14e73239f6bcabc6046499bd0e4a99ebe88 /src/audioOutputs/audioOutput_alsa.c
parent18651935754dbf8972cd8188c2ec5b05ded60299 (diff)
downloadmpd-8583a3bc4e9af2a1be06c82422a7cac1470341ce.tar.gz
mpd-8583a3bc4e9af2a1be06c82422a7cac1470341ce.tar.xz
mpd-8583a3bc4e9af2a1be06c82422a7cac1470341ce.zip
if no audioOutput specified, we no attempt to detect if there exists a usable oss or alsa device
git-svn-id: https://svn.musicpd.org/mpd/trunk@3057 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/audioOutputs/audioOutput_alsa.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c
index d804720b0..9cc15c842 100644
--- a/src/audioOutputs/audioOutput_alsa.c
+++ b/src/audioOutputs/audioOutput_alsa.c
@@ -69,7 +69,10 @@ static void freeAlsaData(AlsaData * ad) {
}
static int alsa_initDriver(AudioOutput * audioOutput, ConfigParam * param) {
- BlockParam * bp = getBlockParam(param, "device");
+ BlockParam * bp = NULL;
+
+ if(param) bp = getBlockParam(param, "device");
+
AlsaData * ad = newAlsaData();
audioOutput->data = ad;
@@ -85,6 +88,23 @@ static void alsa_finishDriver(AudioOutput * audioOutput) {
freeAlsaData(ad);
}
+static int alsa_testDefault()
+{
+ snd_pcm_t * handle;
+
+ int ret = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK,
+ SND_PCM_NONBLOCK);
+
+ if(ret) {
+ WARNING("Error opening default alsa device: %s\n",
+ snd_strerror(-ret));
+ return -1;
+ }
+ else snd_pcm_close(handle);
+
+ return 0;
+}
+
static int alsa_openDevice(AudioOutput * audioOutput)
{
AlsaData * ad = audioOutput->data;
@@ -313,6 +333,7 @@ static int alsa_playAudio(AudioOutput * audioOutput, char * playChunk,
AudioOutputPlugin alsaPlugin =
{
"alsa",
+ alsa_testDefault,
alsa_initDriver,
alsa_finishDriver,
alsa_openDevice,
@@ -332,6 +353,7 @@ AudioOutputPlugin alsaPlugin =
NULL,
NULL,
NULL,
+ NULL,
NULL /* sendMetadataFunc */
};