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

Michael Smith msmith at xiph.org
Fri Aug 16 07:23:43 PDT 2002



msmith      02/08/16 10:23:43

  Modified:    src      config.c config.h stream.c
  Log:
  Set libshout to use HTTP login by default

Revision  Changes    Path
1.13      +6 -1      ices/src/config.c

Index: config.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/config.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- config.c	11 Aug 2002 13:09:59 -0000	1.12
+++ config.c	16 Aug 2002 14:23:43 -0000	1.13
@@ -1,7 +1,7 @@
 /* config.c
  * - config file reading code, plus default settings.
  *
- * $Id: config.c,v 1.12 2002/08/11 13:09:59 msmith Exp $
+ * $Id: config.c,v 1.13 2002/08/16 14:23:43 msmith Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -38,6 +38,7 @@
 #define DEFAULT_HOSTNAME "localhost"
 #define DEFAULT_PORT 8000
 #define DEFAULT_PASSWORD "password"
+#define DEFAULT_USERNAME NULL
 #define DEFAULT_MOUNT "/stream.ogg"
 #define DEFAULT_MANAGED 0
 #define DEFAULT_MIN_BITRATE -1
@@ -106,6 +107,7 @@
 {
         if (instance->hostname) free(instance->hostname);
         if (instance->password) free(instance->password);
+	if (instance->user) free(instance->user);
         if (instance->mount) free(instance->mount);
         if (instance->queue) 
         {
@@ -119,6 +121,7 @@
         instance->hostname = strdup(DEFAULT_HOSTNAME);
         instance->port = DEFAULT_PORT;
         instance->password = strdup(DEFAULT_PASSWORD);
+	instance->user = DEFAULT_USERNAME;
         instance->mount = strdup(DEFAULT_MOUNT);
     instance->managed = DEFAULT_MANAGED;
         instance->min_br = DEFAULT_MIN_BITRATE;
@@ -226,6 +229,8 @@
                         SET_INT(instance->port);
                 else if (strcmp(node->name, "password") == 0)
                         SET_STRING(instance->password);
+		else if (strcmp(node->name, "username") == 0)
+			SET_STRING(instance->user);
                 else if (strcmp(node->name, "savefile") == 0)
                         SET_STRING(instance->savefilename);
                 else if (strcmp(node->name, "mount") == 0)

<p><p>1.14      +2 -1      ices/src/config.h

Index: config.h
===================================================================
RCS file: /usr/local/cvsroot/ices/src/config.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- config.h	11 Aug 2002 13:09:59 -0000	1.13
+++ config.h	16 Aug 2002 14:23:43 -0000	1.14
@@ -1,7 +1,7 @@
 /* config.h
  * - configuration, and global structures built from config
  *
- * $Id: config.h,v 1.13 2002/08/11 13:09:59 msmith Exp $
+ * $Id: config.h,v 1.14 2002/08/16 14:23:43 msmith Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -33,6 +33,7 @@
         char *hostname;
         int port;
         char *password;
+    char *user;
         char *mount;
         int reconnect_delay;
         int reconnect_attempts;

<p><p>1.20      +16 -2     ices/src/stream.c

Index: stream.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/stream.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- stream.c	11 Aug 2002 13:09:59 -0000	1.19
+++ stream.c	16 Aug 2002 14:23:43 -0000	1.20
@@ -1,7 +1,7 @@
 /* stream.c
  * - Core streaming functions/main loop.
  *
- * $Id: stream.c,v 1.19 2002/08/11 13:09:59 msmith Exp $
+ * $Id: stream.c,v 1.20 2002/08/16 14:23:43 msmith Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -56,6 +56,7 @@
         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;
         
         vorbis_comment_init(&sdsc->vc);
 
@@ -63,7 +64,8 @@
 
         /* we only support the ice protocol and vorbis streams currently */
         shout_set_format(sdsc->shout, SHOUT_FORMAT_VORBIS);
-	shout_set_protocol(sdsc->shout, SHOUT_PROTOCOL_ICE);
+	//shout_set_protocol(sdsc->shout, SHOUT_PROTOCOL_ICE);
+	shout_set_protocol(sdsc->shout, SHOUT_PROTOCOL_HTTP);
 
     signal(SIGPIPE, signal_hup_handler);
 
@@ -90,6 +92,18 @@
                 stream->died = 1;
                 return NULL;
         }
+    if (stream->user)
+        user = stream->user;
+    else
+        user = "source";
+
+    if(shout_set_user(sdsc->shout, user) != SHOUTERR_SUCCESS) {
+		LOG_ERROR1("libshout error: %s\n", shout_get_error(sdsc->shout));
+		free(connip);
+		stream->died = 1;
+		return NULL;
+    }
+
         if (!(shout_set_mount(sdsc->shout, stream->mount)) == SHOUTERR_SUCCESS) {
                 LOG_ERROR1("libshout error: %s\n", shout_get_error(sdsc->shout));
                 free(connip);

<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