[xiph-commits] r7375 - icecast/trunk/ices0/src

brendan at dactyl.lonelymoon.com brendan
Tue Jul 27 12:36:19 PDT 2004


Author: brendan
Date: Tue Jul 27 12:36:19 2004
New Revision: 7375

Modified:
icecast/trunk/ices0/src/crossfade.c
icecast/trunk/ices0/src/plugin.h
icecast/trunk/ices0/src/stream.c
Log:
Support stackable plugins. I dunno why - the crossfader is probably
always going to be the only one.


Modified: icecast/trunk/ices0/src/crossfade.c
===================================================================
--- icecast/trunk/ices0/src/crossfade.c	2004-07-27 19:21:09 UTC (rev 7374)
+++ icecast/trunk/ices0/src/crossfade.c	2004-07-27 19:36:18 UTC (rev 7375)
@@ -27,8 +27,11 @@

static ices_plugin_t Crossfader = {
"crossfade",
+
cf_new_track,
-  cf_process
+  cf_process,
+
+  NULL
};

static int NewTrack = 0;

Modified: icecast/trunk/ices0/src/plugin.h
===================================================================
--- icecast/trunk/ices0/src/plugin.h	2004-07-27 19:21:09 UTC (rev 7374)
+++ icecast/trunk/ices0/src/plugin.h	2004-07-27 19:36:18 UTC (rev 7375)
@@ -16,15 +16,19 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*
+ * $Id$
*/

#ifndef _ICES_PLUGIN_H_
#define _ICES_PLUGIN_H_ 1

-typedef struct {
+typedef struct _ices_plugin {
const char *name;
+
void (*new_track)(void);
int (*process)(int ilen, int16_t *il, int16_t *ir);
+
+  struct _ices_plugin *next;
} ices_plugin_t;

ices_plugin_t *crossfade_plugin(void);

Modified: icecast/trunk/ices0/src/stream.c
===================================================================
--- icecast/trunk/ices0/src/stream.c	2004-07-27 19:21:09 UTC (rev 7374)
+++ icecast/trunk/ices0/src/stream.c	2004-07-27 19:36:18 UTC (rev 7375)
@@ -150,6 +150,7 @@
#ifdef HAVE_LIBLAME
int decode = 0;
buffer_t obuf;
+  ices_plugin_t *plugin;
/* worst case decode: 22050 Hz at 8kbs = 44.1 samples/byte */
static int16_t left[INPUT_BUFSIZ * 45];
static int16_t right[INPUT_BUFSIZ * 45];
@@ -164,7 +165,8 @@
ices_reencode_reset (source);
if (config->plugin) {
decode = 1;
-      config->plugin->new_track();
+      for (plugin = config->plugin; plugin; plugin = plugin->next)
+	config->plugin->new_track();
} else
for (stream = config->streams; stream; stream = stream->next)
if (stream->reencode && stream_needs_reencoding (source, stream)) {
@@ -205,9 +207,9 @@

#ifdef HAVE_LIBLAME
/* run output through plugin */
-    if (samples && config->plugin) {
-      samples = config->plugin->process(samples, left, right);
-    }
+    for (plugin = config->plugin; plugin; plugin = plugin->next)
+      if (samples)
+	samples = plugin->process(samples, left, right);
#endif

if (len == 0) {



More information about the commits mailing list