[icecast-dev] ices2: ice-url header patch
Moran,B
B.Moran at lse.ac.uk
Wed Feb 26 04:39:25 PST 2003
After reading this posting in the icecast archives (http://www.xiph.org/archives/icecast/3483.html) about setting the stream url in the metadata with ices2, I couldn't see that it actually was possible to set the ice-url anywhere.
Please let me know if the attached patch is any use, and if I'm sending it to the right place! (Unix linefeeds). I use it with Peercast. It means you can add a <url> tag to the stream metadata in ices.xml.
Ben
<p>
-------------- next part --------------
Index: src/config.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/config.c,v
retrieving revision 1.13
diff -u -r1.13 config.c
--- src/config.c 16 Aug 2002 14:23:43 -0000 1.13
+++ src/config.c 26 Feb 2003 12:15:13 -0000
@@ -33,6 +33,7 @@
#define DEFAULT_LOG_STDERR 1
#define DEFAULT_STREAM_NAME "unnamed ices stream"
#define DEFAULT_STREAM_GENRE "ices unset"
+#define DEFAULT_STREAM_URL NULL
#define DEFAULT_STREAM_DESCRIPTION "no description set"
#define DEFAULT_PLAYLIST_MODULE "playlist"
#define DEFAULT_HOSTNAME "localhost"
@@ -208,6 +209,13 @@
else
SET_STRING(config->stream_description);
}
+ else if (strcmp(node->name, "url") == 0) {
+ if(instance)
+ SET_STRING(instance->stream_url);
+ else
+ SET_STRING(config->stream_url);
+ }
+
} while ((node = node->next));
}
@@ -354,7 +362,7 @@
c->stream_name = strdup(DEFAULT_STREAM_NAME);
c->stream_genre = strdup(DEFAULT_STREAM_GENRE);
c->stream_description = strdup(DEFAULT_STREAM_DESCRIPTION);
-
+ c->stream_url = DEFAULT_STREAM_URL;
c->playlist_module = strdup(DEFAULT_PLAYLIST_MODULE);
c->module_params = NULL;
@@ -447,6 +455,7 @@
fprintf(stderr, "stream_name = %s\n", c->stream_name);
fprintf(stderr, "stream_genre = %s\n", c->stream_genre);
fprintf(stderr, "stream_description = %s\n", c->stream_description);
+ fprintf(stderr, "stream_url = %s\n", c->stream_url);
fprintf(stderr, "\n");
fprintf(stderr, "playlist_module = %s\n", c->playlist_module);
param = c->module_params;
Index: src/config.h
===================================================================
RCS file: /usr/local/cvsroot/ices/src/config.h,v
retrieving revision 1.15
diff -u -r1.15 config.h
--- src/config.h 16 Aug 2002 15:47:36 -0000 1.15
+++ src/config.h 26 Feb 2003 12:15:13 -0000
@@ -50,6 +50,7 @@
char *stream_name;
char *stream_genre;
char *stream_description;
+ char *stream_url;
/* Parameters for re-encoding */
int managed;
@@ -87,6 +88,7 @@
char *stream_name;
char *stream_genre;
char *stream_description;
+ char *stream_url;
/* <playlist> */
Index: src/stream.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/stream.c,v
retrieving revision 1.23
diff -u -r1.23 stream.c
--- src/stream.c 22 Nov 2002 13:01:34 -0000 1.23
+++ src/stream.c 26 Feb 2003 12:15:14 -0000
@@ -53,7 +53,8 @@
input_module_t *inmod = sdsc->input;
int reencoding = (inmod->type == ICES_INPUT_VORBIS) && stream->encode;
int encoding = (inmod->type == ICES_INPUT_PCM) && stream->encode;
- char *stream_name = NULL, *stream_genre = NULL, *stream_description = NULL;
+ char *stream_name = NULL, *stream_genre = NULL, *stream_description = NULL,
+ *stream_url = NULL;
char *user = NULL;
vorbis_comment_init(&sdsc->vc);
@@ -117,6 +118,11 @@
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_name(sdsc->shout, stream_name)) == SHOUTERR_SUCCESS) {
@@ -132,6 +138,12 @@
}
if (stream_description)
if (!(shout_set_description(sdsc->shout, 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_url(sdsc->shout, stream_url)) == SHOUTERR_SUCCESS) {
LOG_ERROR1("libshout error: %s\n", shout_get_error(sdsc->shout));
stream->died = 1;
return NULL;
𸬵ªÜ+Þ²m§ÿðÃb¦+ö«r¯zÏâqç²Úk¢7¶&z zm§ÿðÃyƬ¶àý:.˱Êâmçë¢kaÉb²ÛÖ¦zËëhÇjË]zúު笷©àríj)â
'+a{
+véì¹»®&Þ{ayºÈÚ,¹¸ÞrجçyÕ'²æìr¸zg¬±¨²Ç§¶Ú-
éb²Ü"VÞ èç~)mz·
More information about the Icecast-dev
mailing list