[xiph-cvs] cvs commit: libshout/src shout.c shout_private.h
Brendan
brendan at xiph.org
Thu Feb 6 07:57:54 PST 2003
brendan 03/02/06 10:57:54
Modified: include/shout shout.h
src shout.c shout_private.h
Log:
icecast 1.x dumpfile support, for completeness' sake.
Revision Changes Path
1.13 +3 -0 libshout/include/shout/shout.h
Index: shout.h
===================================================================
RCS file: /usr/local/cvsroot/libshout/include/shout/shout.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- shout.h 12 Jan 2003 09:02:14 -0000 1.12
+++ shout.h 6 Feb 2003 15:57:54 -0000 1.13
@@ -89,6 +89,9 @@
int shout_set_description(shout_t *self, const char *description);
const char *shout_get_description(shout_t *self);
+int shout_set_dumpfile(shout_t *self, const char *dumpfile);
+const char *shout_get_dumpfile(shout_t *self);
+
/* bitrate is in kbps */
int shout_set_bitrate(shout_t *self, unsigned int bitrate);
unsigned int shout_get_bitrate(shout_t *self);
<p><p>1.21 +40 -13 libshout/src/shout.c
Index: shout.c
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/shout.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- shout.c 4 Feb 2003 00:53:42 -0000 1.20
+++ shout.c 6 Feb 2003 15:57:54 -0000 1.21
@@ -169,26 +169,26 @@
ssize_t shout_send_raw(shout_t *self, const unsigned char *data, size_t len)
{
ssize_t ret;
- size_t remaining = len;
+ size_t remaining = len;
if (!self)
return -1;
- self->error = SHOUTERR_SUCCESS;
+ self->error = SHOUTERR_SUCCESS;
while(remaining) {
ret = sock_write_bytes(self->socket, data, remaining);
- if(ret == (ssize_t)remaining)
- return len;
- else if(ret < 0) {
- if(errno == EINTR)
- ret = 0;
- else {
- self->error = SHOUTERR_SOCKET;
- return -1;
- }
- }
- remaining -= ret;
+ if(ret == (ssize_t)remaining)
+ return len;
+ else if(ret < 0) {
+ if(errno == EINTR)
+ ret = 0;
+ else {
+ self->error = SHOUTERR_SOCKET;
+ return -1;
+ }
+ }
+ remaining -= ret;
}
return len;
@@ -642,6 +642,31 @@
return self->description;
}
+int shout_set_dumpfile(shout_t *self, const char *dumpfile)
+{
+ if (!self)
+ return SHOUTERR_INSANE;
+
+ if (self->connected)
+ return SHOUTERR_CONNECTED;
+
+ if (self->dumpfile)
+ free(self->dumpfile);
+
+ if (! (self->dumpfile = util_strdup (dumpfile)))
+ return self->error = SHOUTERR_MALLOC;
+
+ return self->error = SHOUTERR_SUCCESS;
+}
+
+const char *shout_get_dumpfile(shout_t *self)
+{
+ if (!self)
+ return NULL;
+
+ return self->dumpfile;
+}
+
int shout_set_bitrate(shout_t *self, unsigned int bitrate)
{
if (!self)
@@ -951,6 +976,8 @@
if (!sock_write(self->socket, "x-audiocast-public: %i\n", self->public))
return SHOUTERR_SOCKET;
if (!sock_write(self->socket, "x-audiocast-description: %s\n", self->description != NULL ? self->description : "Broadcasting with the icecast streaming media server!"))
+ return SHOUTERR_SOCKET;
+ if (self->dumpfile && !sock_write(self->socket, "x-audiocast-dumpfile: %s\n", self->dumpfile))
return SHOUTERR_SOCKET;
if (!sock_write(self->socket, "\n"))
<p><p>1.7 +2 -0 libshout/src/shout_private.h
Index: shout_private.h
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/shout_private.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- shout_private.h 15 Jan 2003 08:20:15 -0000 1.6
+++ shout_private.h 6 Feb 2003 15:57:54 -0000 1.7
@@ -62,6 +62,8 @@
char *genre;
/* description of the stream */
char *description;
+ /* icecast 1.x dumpfile */
+ char *dumpfile;
/* username to use for HTTP auth. */
char *user;
/* bitrate of this stream */
<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