Commit d9b73a27 authored by Philipp Schafft's avatar Philipp Schafft 🦁
Browse files

Update: Simplified setting of stream metadata

parent e8cd4b71
......@@ -57,8 +57,7 @@ void *ices_instance_stream(void *arg)
input_module_t *inmod = sdsc->input;
int reencoding = 0;
int encoding = 0;
char *stream_name = NULL, *stream_genre = NULL, *stream_description = NULL;
char *stream_url = NULL, *user = NULL;
char *user = NULL;
char audio_info[11];
vorbis_comment_init(&sdsc->vc);
......@@ -171,50 +170,23 @@ void *ices_instance_stream(void *arg)
}
/* set the metadata for the stream */
if(stream->stream_name)
stream_name = stream->stream_name;
else if (ices_config->stream_name)
stream_name = ices_config->stream_name;
if(stream->stream_description)
stream_description = stream->stream_description;
else if (ices_config->stream_description)
stream_description = ices_config->stream_description;
if(stream->stream_genre)
stream_genre = stream->stream_genre;
else if (ices_config->stream_genre)
stream_genre = ices_config->stream_genre;
if(stream->stream_url)
stream_url = stream->stream_url;
else if (ices_config->stream_url)
stream_url = ices_config->stream_url;
if(stream_name)
if (shout_set_meta(sdsc->shout, SHOUT_META_NAME, stream_name) != SHOUTERR_SUCCESS) {
LOG_ERROR1("libshout error: %s\n", shout_get_error(sdsc->shout));
stream->died = 1;
return NULL;
}
if (stream_genre)
if (shout_set_meta(sdsc->shout, SHOUT_META_GENRE, stream_genre) != SHOUTERR_SUCCESS) {
LOG_ERROR1("libshout error: %s\n", shout_get_error(sdsc->shout));
stream->died = 1;
return NULL;
}
if (stream_description)
if (shout_set_meta(sdsc->shout, SHOUT_META_DESCRIPTION, stream_description) != SHOUTERR_SUCCESS) {
LOG_ERROR1("libshout error: %s\n", shout_get_error(sdsc->shout));
stream->died = 1;
return NULL;
}
if (stream_url)
if (shout_set_meta(sdsc->shout, SHOUT_META_URL, stream_url) != SHOUTERR_SUCCESS) {
LOG_ERROR1("libshout error: %s\n", shout_get_error(sdsc->shout));
stream->died = 1;
return NULL;
}
#define _set_meta(var,key) \
do { \
const char *tmp = (stream->var) ? (stream->var) : (ices_config->var); \
if (tmp) { \
if (shout_set_meta(sdsc->shout, (key), tmp) != SHOUTERR_SUCCESS) { \
LOG_ERROR1("libshout error: %s\n", shout_get_error(sdsc->shout)); \
stream->died = 1; \
return NULL; \
} \
} \
} while (0)
_set_meta(stream_name, SHOUT_META_NAME);
_set_meta(stream_url, SHOUT_META_URL);
_set_meta(stream_genre, SHOUT_META_GENRE);
_set_meta(stream_description, SHOUT_META_DESCRIPTION);
if(stream->downmix && encoding && stream->channels == 1) {
stream->channels = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment