aboutsummaryrefslogtreecommitdiffstats
path: root/src/OutputAll.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/OutputAll.cxx (renamed from src/output_all.c)51
1 files changed, 36 insertions, 15 deletions
diff --git a/src/output_all.c b/src/OutputAll.cxx
index f56cd04ee..9c65ddcae 100644
--- a/src/output_all.c
+++ b/src/OutputAll.cxx
@@ -18,20 +18,24 @@
*/
#include "config.h"
+
+extern "C" {
#include "output_all.h"
#include "output_internal.h"
-#include "output_control.h"
-#include "chunk.h"
-#include "conf.h"
-#include "pipe.h"
-#include "buffer.h"
-#include "player_control.h"
+}
+
+#include "PlayerControl.hxx"
+#include "OutputControl.hxx"
+#include "OutputError.hxx"
+#include "MusicBuffer.hxx"
+#include "MusicPipe.hxx"
+#include "MusicChunk.hxx"
#include "mpd_error.h"
-#include "notify.h"
-#ifndef NDEBUG
-#include "chunk.h"
-#endif
+extern "C" {
+#include "conf.h"
+#include "notify.h"
+}
#include <assert.h>
#include <string.h>
@@ -269,8 +273,15 @@ audio_output_all_update(void)
return ret;
}
+void
+audio_output_all_set_replay_gain_mode(enum replay_gain_mode mode)
+{
+ for (unsigned i = 0; i < num_audio_outputs; ++i)
+ audio_output_set_replay_gain_mode(audio_outputs[i], mode);
+}
+
bool
-audio_output_all_play(struct music_chunk *chunk)
+audio_output_all_play(struct music_chunk *chunk, GError **error_r)
{
bool ret;
unsigned int i;
@@ -278,11 +289,15 @@ audio_output_all_play(struct music_chunk *chunk)
assert(g_music_buffer != NULL);
assert(g_mp != NULL);
assert(chunk != NULL);
- assert(music_chunk_check_format(chunk, &input_audio_format));
+ assert(chunk->CheckFormat(input_audio_format));
ret = audio_output_all_update();
- if (!ret)
+ if (!ret) {
+ /* TODO: obtain real error */
+ g_set_error(error_r, output_quark(), 0,
+ "Failed to open audio output");
return false;
+ }
music_pipe_push(g_mp, chunk);
@@ -294,7 +309,8 @@ audio_output_all_play(struct music_chunk *chunk)
bool
audio_output_all_open(const struct audio_format *audio_format,
- struct music_buffer *buffer)
+ struct music_buffer *buffer,
+ GError **error_r)
{
bool ret = false, enabled = false;
unsigned int i;
@@ -334,7 +350,12 @@ audio_output_all_open(const struct audio_format *audio_format,
}
if (!enabled)
- g_warning("All audio outputs are disabled");
+ g_set_error(error_r, output_quark(), 0,
+ "All audio outputs are disabled");
+ else if (!ret)
+ /* TODO: obtain real error */
+ g_set_error(error_r, output_quark(), 0,
+ "Failed to open audio output");
if (!ret)
/* close all devices if there was an error */