aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutputs/audioOutput_shout.c
diff options
context:
space:
mode:
authorAaron McEwan <chainsawbike@gmail.com>2008-10-12 12:14:51 +0200
committerMax Kellermann <max@duempel.org>2008-10-12 12:14:51 +0200
commit2139d8bba8620a194b980435a3093147f0de50cf (patch)
treecf5a844450e57d33e4ad29ebcbcb85d8640a6636 /src/audioOutputs/audioOutput_shout.c
parentff69f122593f400f68db944505bf007d2938d912 (diff)
downloadmpd-2139d8bba8620a194b980435a3093147f0de50cf.tar.gz
mpd-2139d8bba8620a194b980435a3093147f0de50cf.tar.xz
mpd-2139d8bba8620a194b980435a3093147f0de50cf.zip
shout: make the protocol configurable
Added configuration parameter "protocol" which lets the user choose from 3 shout protocols. This adds support for real shoutcast servers.
Diffstat (limited to '')
-rw-r--r--src/audioOutputs/audioOutput_shout.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c
index 54f2c4ff1..ae31b07ea 100644
--- a/src/audioOutputs/audioOutput_shout.c
+++ b/src/audioOutputs/audioOutput_shout.c
@@ -104,6 +104,7 @@ static void *my_shout_init_driver(struct audio_output *audio_output,
char *mount;
char *passwd;
const char *encoding;
+ unsigned protocol;
const char *user;
char *name;
BlockParam *block_param;
@@ -208,6 +209,29 @@ static void *my_shout_init_driver(struct audio_output *audio_output,
FATAL("couldn't find shout encoder plugin for \"%s\" "
"at line %i\n", encoding, block_param->line);
+ check_block_param("protocol");
+
+ block_param = getBlockParam(param, "protocol");
+ if (block_param) {
+ if (0 == strcmp(block_param->value, "shoutcast") &&
+ 0 != strcmp(encoding, "mp3"))
+ FATAL("you cannot stream \"%s\" to shoutcast, use mp3\n",
+ encoding);
+ else if (0 == strcmp(block_param->value, "shoutcast"))
+ protocol = SHOUT_PROTOCOL_ICY;
+ else if (0 == strcmp(block_param->value, "icecast1"))
+ protocol = SHOUT_PROTOCOL_XAUDIOCAST;
+ else if (0 == strcmp(block_param->value, "icecast2"))
+ protocol = SHOUT_PROTOCOL_HTTP;
+ else
+ FATAL("shout protocol \"%s\" is not \"shoutcast\" or "
+ "\"icecast1\"or "
+ "\"icecast2\", line %i\n", block_param->value,
+ block_param->line);
+ } else {
+ protocol = SHOUT_PROTOCOL_HTTP;
+ }
+
if (shout_set_host(sd->shout_conn, host) != SHOUTERR_SUCCESS ||
shout_set_port(sd->shout_conn, port) != SHOUTERR_SUCCESS ||
shout_set_password(sd->shout_conn, passwd) != SHOUTERR_SUCCESS ||
@@ -218,8 +242,7 @@ static void *my_shout_init_driver(struct audio_output *audio_output,
shout_set_nonblocking(sd->shout_conn, 1) != SHOUTERR_SUCCESS ||
shout_set_format(sd->shout_conn, sd->encoder->shout_format)
!= SHOUTERR_SUCCESS ||
- shout_set_protocol(sd->shout_conn, SHOUT_PROTOCOL_HTTP)
- != SHOUTERR_SUCCESS ||
+ shout_set_protocol(sd->shout_conn, protocol) != SHOUTERR_SUCCESS ||
shout_set_agent(sd->shout_conn, "MPD") != SHOUTERR_SUCCESS) {
FATAL("error configuring shout defined at line %i: %s\n",
param->line, shout_get_error(sd->shout_conn));