aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audioOutputs/audioOutput_alsa.c5
-rw-r--r--src/audioOutputs/audioOutput_ao.c4
-rw-r--r--src/audioOutputs/audioOutput_fifo.c4
-rw-r--r--src/audioOutputs/audioOutput_jack.c5
-rw-r--r--src/audioOutputs/audioOutput_mvp.c2
-rw-r--r--src/audioOutputs/audioOutput_null.c3
-rw-r--r--src/audioOutputs/audioOutput_oss.c5
-rw-r--r--src/audioOutputs/audioOutput_osx.c4
-rw-r--r--src/audioOutputs/audioOutput_pulse.c3
-rw-r--r--src/audioOutputs/audioOutput_shout.c4
-rw-r--r--src/output_thread.c8
11 files changed, 8 insertions, 39 deletions
diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c
index b2e4b9025..b6d00f176 100644
--- a/src/audioOutputs/audioOutput_alsa.c
+++ b/src/audioOutputs/audioOutput_alsa.c
@@ -292,8 +292,6 @@ configure_hw:
ad->sampleSize = audio_format_sample_size(audioFormat) * audioFormat->channels;
- audioOutput->open = 1;
-
DEBUG("ALSA device \"%s\" will be playing %i bit, %i channel audio at "
"%i Hz\n", ad->device, (int)audioFormat->bits,
channels, sampleRate);
@@ -312,7 +310,6 @@ fail:
if (ad->pcmHandle)
snd_pcm_close(ad->pcmHandle);
ad->pcmHandle = NULL;
- audioOutput->open = 0;
return -1;
}
@@ -372,8 +369,6 @@ static void alsa_closeDevice(struct audio_output *audioOutput)
snd_pcm_close(ad->pcmHandle);
ad->pcmHandle = NULL;
}
-
- audioOutput->open = 0;
}
static int alsa_playAudio(struct audio_output *audioOutput,
diff --git a/src/audioOutputs/audioOutput_ao.c b/src/audioOutputs/audioOutput_ao.c
index 22a4cb96a..c1266f311 100644
--- a/src/audioOutputs/audioOutput_ao.c
+++ b/src/audioOutputs/audioOutput_ao.c
@@ -171,8 +171,6 @@ static void audioOutputAo_closeDevice(struct audio_output *audioOutput)
ao_close(ad->device);
ad->device = NULL;
}
-
- audioOutput->open = 0;
}
static int audioOutputAo_openDevice(struct audio_output *audioOutput,
@@ -195,8 +193,6 @@ static int audioOutputAo_openDevice(struct audio_output *audioOutput,
if (ad->device == NULL)
return -1;
- audioOutput->open = 1;
-
return 0;
}
diff --git a/src/audioOutputs/audioOutput_fifo.c b/src/audioOutputs/audioOutput_fifo.c
index a41284a14..38aad8e2c 100644
--- a/src/audioOutputs/audioOutput_fifo.c
+++ b/src/audioOutputs/audioOutput_fifo.c
@@ -201,8 +201,6 @@ static int fifo_openDevice(struct audio_output *audioOutput,
fd->timer = timer_new(audio_format);
- audioOutput->open = 1;
-
return 0;
}
@@ -214,8 +212,6 @@ static void fifo_closeDevice(struct audio_output *audioOutput)
timer_free(fd->timer);
fd->timer = NULL;
}
-
- audioOutput->open = 0;
}
static void fifo_dropBufferedAudio(struct audio_output *audioOutput)
diff --git a/src/audioOutputs/audioOutput_jack.c b/src/audioOutputs/audioOutput_jack.c
index 99b9cdf8b..46b879f64 100644
--- a/src/audioOutputs/audioOutput_jack.c
+++ b/src/audioOutputs/audioOutput_jack.c
@@ -363,22 +363,19 @@ static int jack_openDevice(struct audio_output *audioOutput,
if (jd->client == NULL && connect_jack(audioOutput,
audio_format) < 0) {
freeJackClient(jd);
- audioOutput->open = 0;
return -1;
}
set_audioformat(audioOutput, audio_format);
- audioOutput->open = 1;
DEBUG("jack_openDevice (pid=%d)!\n", getpid ());
return 0;
}
-static void jack_closeDevice(struct audio_output *audioOutput)
+static void jack_closeDevice(mpd_unused struct audio_output *audioOutput)
{
/*jack_finishDriver(audioOutput);*/
- audioOutput->open = 0;
DEBUG("jack_closeDevice (pid=%d)\n", getpid());
}
diff --git a/src/audioOutputs/audioOutput_mvp.c b/src/audioOutputs/audioOutput_mvp.c
index 2b80a3251..9ffdd4fdf 100644
--- a/src/audioOutputs/audioOutput_mvp.c
+++ b/src/audioOutputs/audioOutput_mvp.c
@@ -208,7 +208,6 @@ static int mvp_openDevice(struct audio_output *audioOutput,
mvp_setPcmParams(md, audioFormat->sampleRate, audioFormat->channels, 1,
audioFormat->bits);
#endif
- audioOutput->open = 1;
return 0;
}
@@ -218,7 +217,6 @@ static void mvp_closeDevice(struct audio_output *audioOutput)
if (md->fd >= 0)
close(md->fd);
md->fd = -1;
- audioOutput->open = 0;
}
static void mvp_dropBufferedAudio(struct audio_output *audioOutput)
diff --git a/src/audioOutputs/audioOutput_null.c b/src/audioOutputs/audioOutput_null.c
index 37e0ec0c8..c4c7d339e 100644
--- a/src/audioOutputs/audioOutput_null.c
+++ b/src/audioOutputs/audioOutput_null.c
@@ -31,7 +31,6 @@ static int null_openDevice(struct audio_output *audioOutput,
struct audio_format *audio_format)
{
audioOutput->data = timer_new(audio_format);
- audioOutput->open = 1;
return 0;
}
@@ -41,8 +40,6 @@ static void null_closeDevice(struct audio_output *audioOutput)
timer_free(audioOutput->data);
audioOutput->data = NULL;
}
-
- audioOutput->open = 0;
}
static int null_playAudio(struct audio_output *audioOutput,
diff --git a/src/audioOutputs/audioOutput_oss.c b/src/audioOutputs/audioOutput_oss.c
index 5f8db8276..d2041faa1 100644
--- a/src/audioOutputs/audioOutput_oss.c
+++ b/src/audioOutputs/audioOutput_oss.c
@@ -471,13 +471,10 @@ static int oss_open(struct audio_output *audioOutput)
goto fail;
}
- audioOutput->open = 1;
-
return 0;
fail:
oss_close(od);
- audioOutput->open = 0;
return -1;
}
@@ -509,8 +506,6 @@ static void oss_closeDevice(struct audio_output *audioOutput)
OssData *od = audioOutput->data;
oss_close(od);
-
- audioOutput->open = 0;
}
static void oss_dropBufferedAudio(struct audio_output *audioOutput)
diff --git a/src/audioOutputs/audioOutput_osx.c b/src/audioOutputs/audioOutput_osx.c
index 260489caa..b87504bd5 100644
--- a/src/audioOutputs/audioOutput_osx.c
+++ b/src/audioOutputs/audioOutput_osx.c
@@ -132,8 +132,6 @@ static void osx_closeDevice(struct audio_output *audioOutput)
CloseComponent(od->au);
AudioUnitUninitialize(od->au);
-
- audioOutput->open = 0;
}
static OSStatus osx_render(void *vdata,
@@ -292,8 +290,6 @@ static int osx_openDevice(struct audio_output *audioOutput,
od->pos = 0;
od->len = 0;
- audioOutput->open = 1;
-
return 0;
}
diff --git a/src/audioOutputs/audioOutput_pulse.c b/src/audioOutputs/audioOutput_pulse.c
index 3892b5a25..8e477a2de 100644
--- a/src/audioOutputs/audioOutput_pulse.c
+++ b/src/audioOutputs/audioOutput_pulse.c
@@ -149,7 +149,6 @@ static int pulse_openDevice(struct audio_output *audioOutput,
}
pd->connAttempts = 0;
- audioOutput->open = 1;
DEBUG("PulseAudio output \"%s\" connected and playing %i bit, %i "
"channel audio at %i Hz\n", audioOutput->name, audioFormat->bits,
@@ -178,8 +177,6 @@ static void pulse_closeDevice(struct audio_output *audioOutput)
pa_simple_drain(pd->s, NULL);
pa_simple_free(pd->s);
}
-
- audioOutput->open = 0;
}
static int pulse_playAudio(struct audio_output *audioOutput,
diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c
index 835b6022d..8612cde2f 100644
--- a/src/audioOutputs/audioOutput_shout.c
+++ b/src/audioOutputs/audioOutput_shout.c
@@ -358,8 +358,6 @@ static void my_shout_close_device(struct audio_output *audio_output)
timer_free(sd->timer);
sd->timer = NULL;
}
-
- audio_output->open = 0;
}
static int shout_connect(struct shout_data *sd)
@@ -455,8 +453,6 @@ static int my_shout_open_device(struct audio_output *audio_output,
sd->timer = timer_new(audio_format);
- audio_output->open = 1;
-
return 0;
}
diff --git a/src/output_thread.c b/src/output_thread.c
index a93f5f64a..3f410958c 100644
--- a/src/output_thread.c
+++ b/src/output_thread.c
@@ -75,13 +75,19 @@ static void *audio_output_task(void *arg)
case AO_COMMAND_OPEN:
assert(!ao->open);
- ao->plugin->open(ao, &ao->outAudioFormat);
+ ao->result = ao->plugin->open(ao, &ao->outAudioFormat);
+
+ assert(!ao->open);
+ if (ao->result == 0)
+ ao->open = 1;
+
ao_command_finished(ao);
break;
case AO_COMMAND_CLOSE:
assert(ao->open);
ao->plugin->close(ao);
+ ao->open = 0;
ao_command_finished(ao);
break;