[xiph-cvs] cvs commit: ices/src cfgparse.c cfgparse.h stream.c

Brendan brendan at xiph.org
Tue Jul 8 21:26:26 PDT 2003



brendan     03/07/09 00:26:26

  Modified:    src      cfgparse.c cfgparse.h stream.c
  Log:
  Stream URL support

Revision  Changes    Path
1.6       +9 -1      ices/src/cfgparse.c

Index: cfgparse.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/cfgparse.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -u -r1.5 -r1.6
--- cfgparse.c	2 Jul 2003 23:30:46 -0000	1.5
+++ cfgparse.c	9 Jul 2003 04:26:26 -0000	1.6
@@ -1,7 +1,7 @@
 /* cfgparse.c
  * - cfgparse file reading code, plus default settings.
  *
- * $Id: cfgparse.c,v 1.5 2003/07/02 23:30:46 karl Exp $
+ * $Id: cfgparse.c,v 1.6 2003/07/09 04:26:26 brendan Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -214,6 +214,12 @@ static void _parse_metadata(instance_t *
             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));
 }
 
@@ -362,6 +368,7 @@ static void _set_defaults(config_t *c)
     c->stream_name = strdup(DEFAULT_STREAM_NAME);
     c->stream_genre = strdup(DEFAULT_STREAM_GENRE);
     c->stream_description = strdup(DEFAULT_STREAM_DESCRIPTION);
+    c->stream_url = NULL;
 
     c->playlist_module = strdup(DEFAULT_PLAYLIST_MODULE);
     
@@ -455,6 +462,7 @@ void config_dump(void)
     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 ? c->stream_url : "");
     fprintf(stderr, "\n");
     fprintf(stderr, "playlist_module = %s\n", c->playlist_module);
     param = c->module_params;

<p><p>1.4       +3 -1      ices/src/cfgparse.h

Index: cfgparse.h
===================================================================
RCS file: /usr/local/cvsroot/ices/src/cfgparse.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -u -r1.3 -r1.4
--- cfgparse.h	2 Jul 2003 20:26:51 -0000	1.3
+++ cfgparse.h	9 Jul 2003 04:26:26 -0000	1.4
@@ -1,7 +1,7 @@
 /* config.h
  * - configuration, and global structures built from config
  *
- * $Id: cfgparse.h,v 1.3 2003/07/02 20:26:51 karl Exp $
+ * $Id: cfgparse.h,v 1.4 2003/07/09 04:26:26 brendan Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -48,6 +48,7 @@ typedef struct _instance_tag
     char *stream_name;
     char *stream_genre;
     char *stream_description;
+    char *stream_url;
 
     /* Parameters for re-encoding */
     int managed;
@@ -86,6 +87,7 @@ typedef struct _config_tag
     char *stream_name;
     char *stream_genre;
     char *stream_description;
+    char *stream_url;
     
     /* <playlist> */
     

<p><p>1.30      +13 -2     ices/src/stream.c

Index: stream.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/stream.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -p -u -r1.29 -r1.30
--- stream.c	2 Jul 2003 20:26:51 -0000	1.29
+++ stream.c	9 Jul 2003 04:26:26 -0000	1.30
@@ -1,7 +1,7 @@
 /* stream.c
  * - Core streaming functions/main loop.
  *
- * $Id: stream.c,v 1.29 2003/07/02 20:26:51 karl Exp $
+ * $Id: stream.c,v 1.30 2003/07/09 04:26:26 brendan Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -58,7 +58,7 @@ void *ices_instance_stream(void *arg)
     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 *user = NULL;
+    char *stream_url = NULL, *user = NULL;
     char audio_info[11];
     
     vorbis_comment_init(&sdsc->vc);
@@ -129,6 +129,11 @@ void *ices_instance_stream(void *arg)
     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) {
             LOG_ERROR1("libshout error: %s\n", shout_get_error(sdsc->shout));
@@ -143,6 +148,12 @@ void *ices_instance_stream(void *arg)
         }
     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;

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list