[xiph-commits] r18247 - icecast/trunk/ices/src

ph3-der-loewe at svn.xiph.org ph3-der-loewe at svn.xiph.org
Mon Apr 23 14:12:08 PDT 2012


Author: ph3-der-loewe
Date: 2012-04-23 14:12:08 -0700 (Mon, 23 Apr 2012)
New Revision: 18247

Modified:
   icecast/trunk/ices/src/im_roar.c
   icecast/trunk/ices/src/im_roar.h
Log:
cleanup of code:
 * Removed old unused parts,
 * Corrected useage of types and functions,
 * Corrected file headers.


Modified: icecast/trunk/ices/src/im_roar.c
===================================================================
--- icecast/trunk/ices/src/im_roar.c	2012-04-23 20:41:47 UTC (rev 18246)
+++ icecast/trunk/ices/src/im_roar.c	2012-04-23 21:12:08 UTC (rev 18247)
@@ -1,4 +1,4 @@
-/* im_oss.c
+/* im_roar.c
  * - Raw PCM/Ogg Vorbis input from RoarAudio
  *
  * Copyright (c) 2001      Michael Smith <msmith at labyrinth.net.au>
@@ -42,13 +42,6 @@
 
 #define BUFSIZE 2048
 
-/* Some platforms (freebsd) don't define this, so just define it to something
- * that should be treated the same
- */
-#ifndef ERESTART
-#define ERESTART EINTR
-#endif
-
 static void close_module(input_module_t *mod)
 {
     if(mod)
@@ -128,18 +121,18 @@
  */
 static int roar_read(void *self, ref_buffer *rb)
 {
-    int result;
+    ssize_t result;
     int err;
     im_roar_state *s = self;
 
-    rb->buf = malloc(BUFSIZE*2*s->info.channels);
+    rb->buf = malloc(BUFSIZE * roar_info2framesize(&s->info)/8);
     if(!rb->buf)
         return -1;
 
-    result = roar_vs_read(s->vss, rb->buf, BUFSIZE * 2 * s->info.channels, &err);
+    result = roar_vs_read(s->vss, rb->buf, BUFSIZE * roar_info2framesize(&s->info)/8, &err);
 
     rb->len = result;
-    rb->aux_data = s->info.rate * s->info.channels * 2;
+    rb->aux_data = roar_info2bitspersec(&s->info)/8;
 
     if(s->newtrack)
     {
@@ -158,6 +151,7 @@
         else
             LOG_ERROR1("Error reading from sound server: %s", roar_vs_strerr(err));
         free(rb->buf);
+        rb->buf = NULL;
         return -1;
     }
 
@@ -257,7 +251,7 @@
 
 
     /* Open the VS connection */
-    if ( (s->vss = roar_vs_new(server, "ices2", &err)) == NULL ) {
+    if ( (s->vss = roar_vs_new(server, IM_ROAR_PROGNAME, &err)) == NULL ) {
         LOG_ERROR2("Failed to open sound server %s: %s",
                 server, roar_vs_strerr(err));
         goto fail;

Modified: icecast/trunk/ices/src/im_roar.h
===================================================================
--- icecast/trunk/ices/src/im_roar.h	2012-04-23 20:41:47 UTC (rev 18246)
+++ icecast/trunk/ices/src/im_roar.h	2012-04-23 21:12:08 UTC (rev 18247)
@@ -1,4 +1,4 @@
-/* im_oss.h
+/* im_roar.h
  * - Raw PCM/Ogg Vorbis input from RoarAudio
  *
  * Copyright (c) 2001      Michael Smith <msmith at labyrinth.net.au>
@@ -17,6 +17,8 @@
 #include <roaraudio.h>
 #include "inputmodule.h"
 
+#define IM_ROAR_PROGNAME   "ices2"
+
 typedef struct
 {
     struct roar_audio_info info;



More information about the commits mailing list