aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-07 19:55:57 +0100
committerMax Kellermann <max@duempel.org>2009-03-07 19:55:57 +0100
commitb13cd03f756db4afe3fd719e551801cd632a596b (patch)
tree8f23462c4f21ca336183f4a806973fb03f49212b
parent498ec26f25e11cf5eefd86dd4abebbf3722dc999 (diff)
downloadmpd-b13cd03f756db4afe3fd719e551801cd632a596b.tar.gz
mpd-b13cd03f756db4afe3fd719e551801cd632a596b.tar.xz
mpd-b13cd03f756db4afe3fd719e551801cd632a596b.zip
output_all: audio_output_all_update() returns bool
audio_output_all_update() returns true when there is at least open output device which is open.
Diffstat (limited to '')
-rw-r--r--src/output_all.c15
-rw-r--r--src/output_control.c6
-rw-r--r--src/output_control.h4
3 files changed, 19 insertions, 6 deletions
diff --git a/src/output_all.c b/src/output_all.c
index e360fd5ae..eca4d191c 100644
--- a/src/output_all.c
+++ b/src/output_all.c
@@ -163,16 +163,25 @@ audio_output_all_reset_reopen(void)
}
}
-static void
+/**
+ * Opens all output devices which are enabled, but closed.
+ *
+ * @return true if there is at least open output device which is open
+ */
+static bool
audio_output_all_update(void)
{
unsigned int i;
+ bool ret = false;
if (!audio_format_defined(&input_audio_format))
- return;
+ return false;
for (i = 0; i < num_audio_outputs; ++i)
- audio_output_update(&audio_outputs[i], &input_audio_format);
+ ret = ret || audio_output_update(&audio_outputs[i],
+ &input_audio_format);
+
+ return ret;
}
bool
diff --git a/src/output_control.c b/src/output_control.c
index c2b7c56d4..a9c41f053 100644
--- a/src/output_control.c
+++ b/src/output_control.c
@@ -94,16 +94,18 @@ audio_output_open(struct audio_output *ao,
return ao->open;
}
-void
+bool
audio_output_update(struct audio_output *ao,
const struct audio_format *audio_format)
{
if (ao->enabled) {
if (ao->fail_timer == NULL ||
g_timer_elapsed(ao->fail_timer, NULL) > REOPEN_AFTER)
- audio_output_open(ao, audio_format);
+ return audio_output_open(ao, audio_format);
} else if (audio_output_is_open(ao))
audio_output_close(ao);
+
+ return false;
}
void
diff --git a/src/output_control.h b/src/output_control.h
index a4287646c..dadda860d 100644
--- a/src/output_control.h
+++ b/src/output_control.h
@@ -45,8 +45,10 @@ audio_output_open(struct audio_output *ao,
/**
* Opens or closes the device, depending on the "enabled" flag.
+ *
+ * @return true if the device is open
*/
-void
+bool
audio_output_update(struct audio_output *ao,
const struct audio_format *audio_format);