diff options
Diffstat (limited to '')
-rw-r--r-- | src/OutputAll.cxx (renamed from src/output_all.c) | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/src/output_all.c b/src/OutputAll.cxx index f56cd04ee..a18a63385 100644 --- a/src/output_all.c +++ b/src/OutputAll.cxx @@ -18,20 +18,21 @@ */ #include "config.h" -#include "output_all.h" +#include "OutputAll.hxx" + +extern "C" { #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 "mpd_error.h" -#include "notify.h" +} -#ifndef NDEBUG -#include "chunk.h" -#endif +#include "PlayerControl.hxx" +#include "OutputControl.hxx" +#include "OutputError.hxx" +#include "MusicBuffer.hxx" +#include "MusicPipe.hxx" +#include "MusicChunk.hxx" +#include "mpd_error.h" +#include "conf.h" +#include "notify.hxx" #include <assert.h> #include <string.h> @@ -109,8 +110,6 @@ audio_output_all_init(struct player_control *pc) unsigned int i; GError *error = NULL; - notify_init(&audio_output_client_notify); - num_audio_outputs = audio_output_config_count(); audio_outputs = g_new(struct audio_output *, num_audio_outputs); @@ -157,8 +156,6 @@ audio_output_all_finish(void) g_free(audio_outputs); audio_outputs = NULL; num_audio_outputs = 0; - - notify_deinit(&audio_output_client_notify); } void @@ -207,7 +204,7 @@ audio_output_all_finished(void) static void audio_output_wait_all(void) { while (!audio_output_all_finished()) - notify_wait(&audio_output_client_notify); + audio_output_client_notify.Wait(); } /** @@ -269,8 +266,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 +282,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 +302,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 +343,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 */ |