aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/OutputAll.cxx (renamed from src/output_all.c)51
-rw-r--r--src/OutputCommand.cxx (renamed from src/output_command.c)7
-rw-r--r--src/OutputCommand.hxx (renamed from src/output_command.h)8
-rw-r--r--src/OutputControl.cxx (renamed from src/output_control.c)21
-rw-r--r--src/OutputControl.hxx (renamed from src/output_control.h)13
-rw-r--r--src/OutputFinish.cxx (renamed from src/output_finish.c)5
-rw-r--r--src/OutputInit.cxx (renamed from src/output_init.c)16
-rw-r--r--src/OutputList.cxx (renamed from src/output_list.c)4
-rw-r--r--src/OutputList.hxx (renamed from src/output_list.h)6
-rw-r--r--src/OutputPlugin.cxx (renamed from src/output_plugin.c)6
-rw-r--r--src/OutputPrint.cxx (renamed from src/output_print.c)13
-rw-r--r--src/OutputPrint.hxx (renamed from src/output_print.h)10
-rw-r--r--src/OutputState.cxx (renamed from src/output_state.c)7
-rw-r--r--src/OutputState.hxx (renamed from src/output_state.h)7
-rw-r--r--src/OutputThread.cxx (renamed from src/output_thread.c)44
-rw-r--r--src/OutputThread.hxx (renamed from src/output_thread.h)6
-rw-r--r--src/output/httpd_client.h3
-rw-r--r--src/output/pulse_output_plugin.h4
-rw-r--r--src/output/shout_output_plugin.c71
-rw-r--r--src/output_all.h11
-rw-r--r--src/output_internal.h7
-rw-r--r--src/output_plugin.h7
22 files changed, 206 insertions, 121 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 */
diff --git a/src/output_command.c b/src/OutputCommand.cxx
index 3988f350a..cce1a5b04 100644
--- a/src/output_command.c
+++ b/src/OutputCommand.cxx
@@ -25,13 +25,16 @@
*/
#include "config.h"
-#include "output_command.h"
+#include "OutputCommand.hxx"
+#include "PlayerControl.hxx"
+
+extern "C" {
#include "output_all.h"
#include "output_internal.h"
#include "output_plugin.h"
#include "mixer_control.h"
-#include "player_control.h"
#include "idle.h"
+}
extern unsigned audio_output_state_version;
diff --git a/src/output_command.h b/src/OutputCommand.hxx
index eda30acc8..74eaf8f1c 100644
--- a/src/output_command.h
+++ b/src/OutputCommand.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -24,10 +24,8 @@
*
*/
-#ifndef OUTPUT_COMMAND_H
-#define OUTPUT_COMMAND_H
-
-#include <stdbool.h>
+#ifndef MPD_OUTPUT_COMMAND_HXX
+#define MPD_OUTPUT_COMMAND_HXX
/**
* Enables an audio output. Returns false if the specified output
diff --git a/src/output_control.c b/src/OutputControl.cxx
index 7b95be49b..7cc2814de 100644
--- a/src/output_control.c
+++ b/src/OutputControl.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,14 +18,19 @@
*/
#include "config.h"
-#include "output_control.h"
+#include "OutputControl.hxx"
+#include "OutputThread.hxx"
+
+extern "C" {
#include "output_api.h"
#include "output_internal.h"
-#include "output_thread.h"
#include "mixer_control.h"
#include "mixer_plugin.h"
-#include "filter_plugin.h"
#include "notify.h"
+#include "filter/replay_gain_filter_plugin.h"
+}
+
+#include "filter_plugin.h"
#include <assert.h>
#include <stdlib.h>
@@ -92,6 +97,14 @@ ao_lock_command(struct audio_output *ao, enum audio_output_command cmd)
}
void
+audio_output_set_replay_gain_mode(struct audio_output *ao,
+ enum replay_gain_mode mode)
+{
+ if (ao->replay_gain_filter != NULL)
+ replay_gain_filter_set_mode(ao->replay_gain_filter, mode);
+}
+
+void
audio_output_enable(struct audio_output *ao)
{
if (ao->thread == NULL) {
diff --git a/src/output_control.h b/src/OutputControl.hxx
index 874a53518..cf906d2f0 100644
--- a/src/output_control.h
+++ b/src/OutputControl.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,13 +17,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_OUTPUT_CONTROL_H
-#define MPD_OUTPUT_CONTROL_H
+#ifndef MPD_OUTPUT_CONTROL_HXX
+#define MPD_OUTPUT_CONTROL_HXX
+
+#include "replay_gain_info.h"
#include <glib.h>
#include <stddef.h>
-#include <stdbool.h>
struct audio_output;
struct audio_format;
@@ -37,6 +38,10 @@ audio_output_quark(void)
return g_quark_from_static_string("audio_output");
}
+void
+audio_output_set_replay_gain_mode(struct audio_output *ao,
+ enum replay_gain_mode mode);
+
/**
* Enables the device.
*/
diff --git a/src/output_finish.c b/src/OutputFinish.cxx
index e11b43675..ac6ad6977 100644
--- a/src/output_finish.c
+++ b/src/OutputFinish.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,10 +18,13 @@
*/
#include "config.h"
+
+extern "C" {
#include "output_internal.h"
#include "output_plugin.h"
#include "mixer_control.h"
#include "filter_plugin.h"
+}
#include <assert.h>
diff --git a/src/output_init.c b/src/OutputInit.cxx
index c3b808e94..5fc800d19 100644
--- a/src/output_init.c
+++ b/src/OutputInit.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,10 +18,12 @@
*/
#include "config.h"
-#include "output_control.h"
+#include "OutputControl.hxx"
+#include "OutputList.hxx"
+
+extern "C" {
#include "output_api.h"
#include "output_internal.h"
-#include "output_list.h"
#include "audio_parser.h"
#include "mixer_control.h"
#include "mixer_type.h"
@@ -33,6 +35,7 @@
#include "filter/chain_filter_plugin.h"
#include "filter/autoconvert_filter_plugin.h"
#include "filter/replay_gain_filter_plugin.h"
+}
#include <glib.h>
@@ -165,6 +168,7 @@ ao_base_init(struct audio_output *ao,
}
ao->plugin = plugin;
+ ao->tags = config_get_block_bool(param, "tags", true);
ao->always_on = config_get_block_bool(param, "always_on", false);
ao->enabled = config_get_block_bool(param, "enabled", true);
ao->really_enabled = false;
@@ -297,14 +301,14 @@ audio_output_new(const struct config_param *param,
if (p == NULL) {
g_set_error(error_r, audio_output_quark(), 0,
"Missing \"type\" configuration");
- return false;
+ return nullptr;
}
plugin = audio_output_plugin_get(p);
if (plugin == NULL) {
g_set_error(error_r, audio_output_quark(), 0,
"No such audio output plugin: %s", p);
- return false;
+ return nullptr;
}
} else {
g_warning("No \"%s\" defined in config file\n",
@@ -312,7 +316,7 @@ audio_output_new(const struct config_param *param,
plugin = audio_output_detect(error_r);
if (plugin == NULL)
- return false;
+ return nullptr;
g_message("Successfully detected a %s audio device",
plugin->name);
diff --git a/src/output_list.c b/src/OutputList.cxx
index 835c02bba..3e469385f 100644
--- a/src/output_list.c
+++ b/src/OutputList.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,7 @@
*/
#include "config.h"
-#include "output_list.h"
+#include "OutputList.hxx"
#include "output_api.h"
#include "output/alsa_output_plugin.h"
#include "output/ao_output_plugin.h"
diff --git a/src/output_list.h b/src/OutputList.hxx
index 185ada716..b7716c67e 100644
--- a/src/output_list.h
+++ b/src/OutputList.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_OUTPUT_LIST_H
-#define MPD_OUTPUT_LIST_H
+#ifndef MPD_OUTPUT_LIST_HXX
+#define MPD_OUTPUT_LIST_HXX
extern const struct audio_output_plugin *const audio_output_plugins[];
diff --git a/src/output_plugin.c b/src/OutputPlugin.cxx
index 221570c1c..9aa0f7792 100644
--- a/src/output_plugin.c
+++ b/src/OutputPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,11 @@
*/
#include "config.h"
+
+extern "C" {
#include "output_plugin.h"
+}
+
#include "output_internal.h"
struct audio_output *
diff --git a/src/output_print.c b/src/OutputPrint.cxx
index 483648ca2..ed4391547 100644
--- a/src/output_print.c
+++ b/src/OutputPrint.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -23,15 +23,18 @@
*/
#include "config.h"
-#include "output_print.h"
+#include "OutputPrint.hxx"
#include "output_internal.h"
+#include "Client.hxx"
+
+extern "C" {
#include "output_all.h"
-#include "client.h"
+}
void
-printAudioDevices(struct client *client)
+printAudioDevices(Client *client)
{
- unsigned n = audio_output_count();
+ const unsigned n = audio_output_count();
for (unsigned i = 0; i < n; ++i) {
const struct audio_output *ao = audio_output_get(i);
diff --git a/src/output_print.h b/src/OutputPrint.hxx
index e02f4e9f5..78717d0af 100644
--- a/src/output_print.h
+++ b/src/OutputPrint.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -22,12 +22,12 @@
*
*/
-#ifndef OUTPUT_PRINT_H
-#define OUTPUT_PRINT_H
+#ifndef MPD_OUTPUT_PRINT_HXX
+#define MPD_OUTPUT_PRINT_HXX
-struct client;
+class Client;
void
-printAudioDevices(struct client *client);
+printAudioDevices(Client *client);
#endif
diff --git a/src/output_state.c b/src/OutputState.cxx
index 7bcafb36b..95aeacbca 100644
--- a/src/output_state.c
+++ b/src/OutputState.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -23,9 +23,12 @@
*/
#include "config.h"
-#include "output_state.h"
+#include "OutputState.hxx"
#include "output_internal.h"
+
+extern "C" {
#include "output_all.h"
+}
#include <glib.h>
diff --git a/src/output_state.h b/src/OutputState.hxx
index 320a3520a..5ab765ba8 100644
--- a/src/output_state.h
+++ b/src/OutputState.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -22,10 +22,9 @@
*
*/
-#ifndef OUTPUT_STATE_H
-#define OUTPUT_STATE_H
+#ifndef MPD_OUTPUT_STATE_HXX
+#define MPD_OUTPUT_STATE_HXX
-#include <stdbool.h>
#include <stdio.h>
bool
diff --git a/src/output_thread.c b/src/OutputThread.cxx
index 4eef2ccdd..3d0d96f7a 100644
--- a/src/output_thread.c
+++ b/src/OutputThread.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,18 +18,23 @@
*/
#include "config.h"
-#include "output_thread.h"
+#include "OutputThread.hxx"
+
+extern "C" {
#include "output_api.h"
#include "output_internal.h"
-#include "chunk.h"
-#include "pipe.h"
-#include "player_control.h"
#include "pcm_mix.h"
#include "filter_plugin.h"
#include "filter/convert_filter_plugin.h"
#include "filter/replay_gain_filter_plugin.h"
-#include "mpd_error.h"
#include "notify.h"
+}
+
+#include "PlayerControl.hxx"
+#include "MusicPipe.hxx"
+#include "MusicChunk.hxx"
+
+#include "mpd_error.h"
#include "gcc.h"
#include <glib.h>
@@ -315,17 +320,17 @@ ao_wait(struct audio_output *ao)
}
}
-static const char *
+static const void *
ao_chunk_data(struct audio_output *ao, const struct music_chunk *chunk,
struct filter *replay_gain_filter,
unsigned *replay_gain_serial_p,
size_t *length_r)
{
assert(chunk != NULL);
- assert(!music_chunk_is_empty(chunk));
- assert(music_chunk_check_format(chunk, &ao->in_audio_format));
+ assert(!chunk->IsEmpty());
+ assert(chunk->CheckFormat(ao->in_audio_format));
- const char *data = chunk->data;
+ const void *data = chunk->data;
size_t length = chunk->length;
(void)ao;
@@ -356,14 +361,14 @@ ao_chunk_data(struct audio_output *ao, const struct music_chunk *chunk,
return data;
}
-static const char *
+static const void *
ao_filter_chunk(struct audio_output *ao, const struct music_chunk *chunk,
size_t *length_r)
{
GError *error = NULL;
size_t length;
- const char *data = ao_chunk_data(ao, chunk, ao->replay_gain_filter,
+ const void *data = ao_chunk_data(ao, chunk, ao->replay_gain_filter,
&ao->replay_gain_serial, &length);
if (data == NULL)
return NULL;
@@ -378,7 +383,7 @@ ao_filter_chunk(struct audio_output *ao, const struct music_chunk *chunk,
if (chunk->other != NULL) {
size_t other_length;
- const char *other_data =
+ const void *other_data =
ao_chunk_data(ao, chunk->other,
ao->other_replay_gain_filter,
&ao->other_replay_gain_serial,
@@ -399,13 +404,14 @@ ao_filter_chunk(struct audio_output *ao, const struct music_chunk *chunk,
if (length > other_length)
length = other_length;
- char *dest = pcm_buffer_get(&ao->cross_fade_buffer,
+ void *dest = pcm_buffer_get(&ao->cross_fade_buffer,
other_length);
memcpy(dest, other_data, other_length);
- if (!pcm_mix(dest, data, length, ao->in_audio_format.format,
+ if (!pcm_mix(dest, data, length,
+ sample_format(ao->in_audio_format.format),
1.0 - chunk->mix_ratio)) {
g_warning("Cannot cross-fade format %s",
- sample_format_to_string(ao->in_audio_format.format));
+ sample_format_to_string(sample_format(ao->in_audio_format.format)));
return NULL;
}
@@ -435,7 +441,7 @@ ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk)
assert(ao != NULL);
assert(ao->filter != NULL);
- if (chunk->tag != NULL) {
+ if (ao->tags && gcc_unlikely(chunk->tag != NULL)) {
g_mutex_unlock(ao->mutex);
ao_plugin_send_tag(ao, chunk->tag);
g_mutex_lock(ao->mutex);
@@ -446,7 +452,7 @@ ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk)
/* workaround -Wmaybe-uninitialized false positive */
size = 0;
#endif
- const char *data = ao_filter_chunk(ao, chunk, &size);
+ const char *data = (const char *)ao_filter_chunk(ao, chunk, &size);
if (data == NULL) {
ao_close(ao, false);
@@ -578,7 +584,7 @@ static void ao_pause(struct audio_output *ao)
static gpointer audio_output_task(gpointer arg)
{
- struct audio_output *ao = arg;
+ struct audio_output *ao = (struct audio_output *)arg;
g_mutex_lock(ao->mutex);
diff --git a/src/output_thread.h b/src/OutputThread.hxx
index 5ad9a7527..1a7932162 100644
--- a/src/output_thread.h
+++ b/src/OutputThread.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_OUTPUT_THREAD_H
-#define MPD_OUTPUT_THREAD_H
+#ifndef MPD_OUTPUT_THREAD_HXX
+#define MPD_OUTPUT_THREAD_HXX
struct audio_output;
diff --git a/src/output/httpd_client.h b/src/output/httpd_client.h
index 739163f42..f0df829db 100644
--- a/src/output/httpd_client.h
+++ b/src/output/httpd_client.h
@@ -20,9 +20,8 @@
#ifndef MPD_OUTPUT_HTTPD_CLIENT_H
#define MPD_OUTPUT_HTTPD_CLIENT_H
-#include <glib.h>
-
#include <stdbool.h>
+#include <stddef.h>
struct httpd_client;
struct httpd_output;
diff --git a/src/output/pulse_output_plugin.h b/src/output/pulse_output_plugin.h
index 02a51f27b..b285b5e4d 100644
--- a/src/output/pulse_output_plugin.h
+++ b/src/output/pulse_output_plugin.h
@@ -20,9 +20,9 @@
#ifndef MPD_PULSE_OUTPUT_PLUGIN_H
#define MPD_PULSE_OUTPUT_PLUGIN_H
-#include <stdbool.h>
+#include "gerror.h"
-#include <glib.h>
+#include <stdbool.h>
struct pulse_output;
struct pulse_mixer;
diff --git a/src/output/shout_output_plugin.c b/src/output/shout_output_plugin.c
index 56456a0ea..8f9df2ccf 100644
--- a/src/output/shout_output_plugin.c
+++ b/src/output/shout_output_plugin.c
@@ -105,15 +105,10 @@ static void free_shout_data(struct shout_data *sd)
} \
}
-static struct audio_output *
-my_shout_init_driver(const struct config_param *param,
- GError **error)
+static bool
+my_shout_configure(struct shout_data *sd, const struct config_param *param,
+ GError **error)
{
- struct shout_data *sd = new_shout_data();
- if (!ao_base_init(&sd->base, &shout_output_plugin, param, error)) {
- free_shout_data(sd);
- return NULL;
- }
const struct audio_format *audio_format =
&sd->base.config_audio_format;
@@ -125,11 +120,6 @@ my_shout_init_driver(const struct config_param *param,
return NULL;
}
- if (shout_init_count == 0)
- shout_init();
-
- shout_init_count++;
-
const struct block_param *block_param;
check_block_param("host");
char *host = block_param->value;
@@ -141,7 +131,7 @@ my_shout_init_driver(const struct config_param *param,
if (port == 0) {
g_set_error(error, shout_output_quark(), 0,
"shout port must be configured");
- goto failure;
+ return false;
}
check_block_param("password");
@@ -164,21 +154,21 @@ my_shout_init_driver(const struct config_param *param,
"shout quality \"%s\" is not a number in the "
"range -1 to 10, line %i",
value, param->line);
- goto failure;
+ return false;
}
if (config_get_block_string(param, "bitrate", NULL) != NULL) {
g_set_error(error, shout_output_quark(), 0,
"quality and bitrate are "
"both defined");
- goto failure;
+ return false;
}
} else {
value = config_get_block_string(param, "bitrate", NULL);
if (value == NULL) {
g_set_error(error, shout_output_quark(), 0,
"neither bitrate nor quality defined");
- goto failure;
+ return false;
}
char *test;
@@ -187,7 +177,7 @@ my_shout_init_driver(const struct config_param *param,
if (*test != '\0' || sd->bitrate <= 0) {
g_set_error(error, shout_output_quark(), 0,
"bitrate must be a positive integer");
- goto failure;
+ return false;
}
}
@@ -199,12 +189,12 @@ my_shout_init_driver(const struct config_param *param,
g_set_error(error, shout_output_quark(), 0,
"couldn't find shout encoder plugin \"%s\"",
encoding);
- goto failure;
+ return false;
}
sd->encoder = encoder_init(encoder_plugin, param, error);
if (sd->encoder == NULL)
- goto failure;
+ return false;
unsigned shout_format;
if (strcmp(encoding, "mp3") == 0 || strcmp(encoding, "lame") == 0)
@@ -220,7 +210,7 @@ my_shout_init_driver(const struct config_param *param,
g_set_error(error, shout_output_quark(), 0,
"you cannot stream \"%s\" to shoutcast, use mp3",
encoding);
- goto failure;
+ return false;
} else if (0 == strcmp(value, "shoutcast"))
protocol = SHOUT_PROTOCOL_ICY;
else if (0 == strcmp(value, "icecast1"))
@@ -232,7 +222,7 @@ my_shout_init_driver(const struct config_param *param,
"shout protocol \"%s\" is not \"shoutcast\" or "
"\"icecast1\"or \"icecast2\"",
value);
- goto failure;
+ return false;
}
} else {
protocol = SHOUT_PROTOCOL_HTTP;
@@ -251,7 +241,7 @@ my_shout_init_driver(const struct config_param *param,
shout_set_agent(sd->shout_conn, "MPD") != SHOUTERR_SUCCESS) {
g_set_error(error, shout_output_quark(), 0,
"%s", shout_get_error(sd->shout_conn));
- goto failure;
+ return false;
}
/* optional paramters */
@@ -262,21 +252,21 @@ my_shout_init_driver(const struct config_param *param,
if (value != NULL && shout_set_genre(sd->shout_conn, value)) {
g_set_error(error, shout_output_quark(), 0,
"%s", shout_get_error(sd->shout_conn));
- goto failure;
+ return false;
}
value = config_get_block_string(param, "description", NULL);
if (value != NULL && shout_set_description(sd->shout_conn, value)) {
g_set_error(error, shout_output_quark(), 0,
"%s", shout_get_error(sd->shout_conn));
- goto failure;
+ return false;
}
value = config_get_block_string(param, "url", NULL);
if (value != NULL && shout_set_url(sd->shout_conn, value)) {
g_set_error(error, shout_output_quark(), 0,
"%s", shout_get_error(sd->shout_conn));
- goto failure;
+ return false;
}
{
@@ -301,12 +291,31 @@ my_shout_init_driver(const struct config_param *param,
}
}
- return &sd->base;
+ return true;
+}
-failure:
- ao_base_finish(&sd->base);
- free_shout_data(sd);
- return NULL;
+static struct audio_output *
+my_shout_init_driver(const struct config_param *param,
+ GError **error)
+{
+ struct shout_data *sd = new_shout_data();
+ if (!ao_base_init(&sd->base, &shout_output_plugin, param, error)) {
+ free_shout_data(sd);
+ return NULL;
+ }
+
+ if (!my_shout_configure(sd, param, error)) {
+ ao_base_finish(&sd->base);
+ free_shout_data(sd);
+ return NULL;
+ }
+
+ if (shout_init_count == 0)
+ shout_init();
+
+ shout_init_count++;
+
+ return &sd->base;
}
static bool
diff --git a/src/output_all.h b/src/output_all.h
index 4eeb94f13..becf4b695 100644
--- a/src/output_all.h
+++ b/src/output_all.h
@@ -26,6 +26,9 @@
#ifndef OUTPUT_ALL_H
#define OUTPUT_ALL_H
+#include "replay_gain_info.h"
+#include "gerror.h"
+
#include <stdbool.h>
#include <stddef.h>
@@ -84,7 +87,8 @@ audio_output_all_enable_disable(void);
*/
bool
audio_output_all_open(const struct audio_format *audio_format,
- struct music_buffer *buffer);
+ struct music_buffer *buffer,
+ GError **error_r);
/**
* Closes all audio outputs.
@@ -99,6 +103,9 @@ audio_output_all_close(void);
void
audio_output_all_release(void);
+void
+audio_output_all_set_replay_gain_mode(enum replay_gain_mode mode);
+
/**
* Enqueue a #music_chunk object for playing, i.e. pushes it to a
* #music_pipe.
@@ -108,7 +115,7 @@ audio_output_all_release(void);
* (all closed then)
*/
bool
-audio_output_all_play(struct music_chunk *chunk);
+audio_output_all_play(struct music_chunk *chunk, GError **error_r);
/**
* Checks if the output devices have drained their music pipe, and
diff --git a/src/output_internal.h b/src/output_internal.h
index 9d975d789..1a3e8aa1f 100644
--- a/src/output_internal.h
+++ b/src/output_internal.h
@@ -73,6 +73,13 @@ struct audio_output {
struct mixer *mixer;
/**
+ * Will this output receive tags from the decoder? The
+ * default is true, but it may be configured to false to
+ * suppress sending tags to the output.
+ */
+ bool tags;
+
+ /**
* Shall this output always play something (i.e. silence),
* even when playback is stopped?
*/
diff --git a/src/output_plugin.h b/src/output_plugin.h
index 209ca6221..a47296566 100644
--- a/src/output_plugin.h
+++ b/src/output_plugin.h
@@ -20,7 +20,8 @@
#ifndef MPD_OUTPUT_PLUGIN_H
#define MPD_OUTPUT_PLUGIN_H
-#include <glib.h>
+#include "gcc.h"
+#include "gerror.h"
#include <stdbool.h>
#include <stddef.h>
@@ -165,7 +166,7 @@ ao_plugin_test_default_device(const struct audio_output_plugin *plugin)
: false;
}
-G_GNUC_MALLOC
+gcc_malloc
struct audio_output *
ao_plugin_init(const struct audio_output_plugin *plugin,
const struct config_param *param,
@@ -187,7 +188,7 @@ ao_plugin_open(struct audio_output *ao, struct audio_format *audio_format,
void
ao_plugin_close(struct audio_output *ao);
-G_GNUC_PURE
+gcc_pure
unsigned
ao_plugin_delay(struct audio_output *ao);