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.
This commit is contained in:
parent
ff69f12259
commit
2139d8bba8
@ -382,8 +382,12 @@ for encoding.
|
|||||||
.TP
|
.TP
|
||||||
.B encoding <encoding>
|
.B encoding <encoding>
|
||||||
This specifies which output encoding to use. Should be either "ogg"
|
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
|
.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>
|
.B user <username>
|
||||||
This specifies the username to use when logging in to the icecast server. The
|
This specifies the username to use when logging in to the icecast server. The
|
||||||
default is "source".
|
default is "source".
|
||||||
|
@ -121,6 +121,7 @@ error_file "~/.mpd/mpd.error"
|
|||||||
# quality "5.0"
|
# quality "5.0"
|
||||||
# bitrate "128"
|
# bitrate "128"
|
||||||
# format "44100:16:1"
|
# format "44100:16:1"
|
||||||
|
# protocol "icecast2"
|
||||||
# user "source" # optional
|
# user "source" # optional
|
||||||
# description "My Stream Description" # optional
|
# description "My Stream Description" # optional
|
||||||
# genre "jazz" # optional
|
# genre "jazz" # optional
|
||||||
|
@ -104,6 +104,7 @@ static void *my_shout_init_driver(struct audio_output *audio_output,
|
|||||||
char *mount;
|
char *mount;
|
||||||
char *passwd;
|
char *passwd;
|
||||||
const char *encoding;
|
const char *encoding;
|
||||||
|
unsigned protocol;
|
||||||
const char *user;
|
const char *user;
|
||||||
char *name;
|
char *name;
|
||||||
BlockParam *block_param;
|
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\" "
|
FATAL("couldn't find shout encoder plugin for \"%s\" "
|
||||||
"at line %i\n", encoding, block_param->line);
|
"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 ||
|
if (shout_set_host(sd->shout_conn, host) != SHOUTERR_SUCCESS ||
|
||||||
shout_set_port(sd->shout_conn, port) != SHOUTERR_SUCCESS ||
|
shout_set_port(sd->shout_conn, port) != SHOUTERR_SUCCESS ||
|
||||||
shout_set_password(sd->shout_conn, passwd) != 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_nonblocking(sd->shout_conn, 1) != SHOUTERR_SUCCESS ||
|
||||||
shout_set_format(sd->shout_conn, sd->encoder->shout_format)
|
shout_set_format(sd->shout_conn, sd->encoder->shout_format)
|
||||||
!= SHOUTERR_SUCCESS ||
|
!= SHOUTERR_SUCCESS ||
|
||||||
shout_set_protocol(sd->shout_conn, SHOUT_PROTOCOL_HTTP)
|
shout_set_protocol(sd->shout_conn, protocol) != SHOUTERR_SUCCESS ||
|
||||||
!= SHOUTERR_SUCCESS ||
|
|
||||||
shout_set_agent(sd->shout_conn, "MPD") != SHOUTERR_SUCCESS) {
|
shout_set_agent(sd->shout_conn, "MPD") != SHOUTERR_SUCCESS) {
|
||||||
FATAL("error configuring shout defined at line %i: %s\n",
|
FATAL("error configuring shout defined at line %i: %s\n",
|
||||||
param->line, shout_get_error(sd->shout_conn));
|
param->line, shout_get_error(sd->shout_conn));
|
||||||
|
Loading…
Reference in New Issue
Block a user