diff options
author | Aaron McEwan <chainsawbike@gmail.com> | 2008-10-12 12:14:51 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-12 12:14:51 +0200 |
commit | 2139d8bba8620a194b980435a3093147f0de50cf (patch) | |
tree | cf5a844450e57d33e4ad29ebcbcb85d8640a6636 | |
parent | ff69f122593f400f68db944505bf007d2938d912 (diff) | |
download | mpd-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-- | doc/mpd.conf.5 | 6 | ||||
-rw-r--r-- | doc/mpdconf.example | 1 | ||||
-rw-r--r-- | src/audioOutputs/audioOutput_shout.c | 27 |
3 files changed, 31 insertions, 3 deletions
diff --git a/doc/mpd.conf.5 b/doc/mpd.conf.5 index 5a77d4944..9263b0865 100644 --- a/doc/mpd.conf.5 +++ b/doc/mpd.conf.5 @@ -382,8 +382,12 @@ for encoding. .TP .B encoding <encoding> This specifies which output encoding to use. Should be either "ogg" -or "mp3". The default is "ogg". +or "mp3", "mp3" is needed for shoutcast streaming. The default is "ogg". .TP +.B protocol <protocol> +This specifies the protocol that wil be used to connect to the +icecast/shoutcast server. The options are "shoutcast", "icecast1" and +"icecast2". The default is "icecast2". .B user <username> This specifies the username to use when logging in to the icecast server. The default is "source". diff --git a/doc/mpdconf.example b/doc/mpdconf.example index 995bba3aa..a3dd6048f 100644 --- a/doc/mpdconf.example +++ b/doc/mpdconf.example @@ -121,6 +121,7 @@ error_file "~/.mpd/mpd.error" # quality "5.0" # bitrate "128" # format "44100:16:1" +# protocol "icecast2" # user "source" # optional # description "My Stream Description" # optional # genre "jazz" # optional 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)); |