Index: roard/codecfilter.c
===================================================================
--- roard/codecfilter.c	(revision 2701)
+++ roard/codecfilter.c	(revision 2816)
@@ -36,4 +36,13 @@
  {-1,                     "null", "null codec filter", NULL, NULL, ROAR_CODECFILTER_NONE, ROAR_SUBSYS_NONE,
                                           NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+ {-1,                     "PCM", "Native PCM Support", NULL, NULL,
+                          ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, ROAR_SUBSYS_WAVEFORM,
+                                          NULL, NULL, NULL, NULL, NULL, NULL, cf_alaw_delay, NULL},
+ {ROAR_CODEC_MIDI,        "MIDI", "Native MIDI Support", NULL, NULL,
+                          ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, ROAR_SUBSYS_MIDI,
+                                          NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+ {ROAR_CODEC_DMX512,      "DMX512", "Native DMX512 Support", NULL, NULL,
+                          ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, ROAR_SUBSYS_LIGHT,
+                                          NULL, NULL, NULL, NULL, NULL, NULL, cf_alaw_delay, NULL},
 
 /*
@@ -45,5 +54,5 @@
 #ifndef ROAR_WITHOUT_CF_WAVE
  {ROAR_CODEC_RIFF_WAVE, "RIFF/WAVE", "RIFF/WAVE", NULL, NULL,
-  ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE, ROAR_SUBSYS_WAVEFORM,
+  ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU, ROAR_SUBSYS_WAVEFORM,
   cf_wave_open, cf_wave_close, NULL, cf_wave_write, cf_wave_read, NULL, NULL, cf_wave_ctl},
 #endif
@@ -56,10 +65,16 @@
 #endif
 
+#ifdef ROAR_HAVE_LIBOGG
+ {ROAR_CODEC_OGG, "Ogg", "Ogg Container Format", NULL, NULL, ROAR_CODECFILTER_NONE,
+  ROAR_SUBSYS_WAVEFORM|ROAR_SUBSYS_MIDI,
+  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+#endif
+
 #ifdef ROAR_SUPPORT_ALAW
  {ROAR_CODEC_ALAW, "alaw", "A-Law", NULL, NULL,
 #ifdef ROAR_SUPPORT_ALAW_RW
-  ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE,
-#else
-  ROAR_CODECFILTER_READ,
+  ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN,
+#else
+  ROAR_CODECFILTER_READ|ROAR_CODECFILTER_PRETHRU_NN,
 #endif
   ROAR_SUBSYS_WAVEFORM,
@@ -76,7 +91,7 @@
  {ROAR_CODEC_MULAW, "mulaw", "mu-Law", NULL, NULL,
 #ifdef ROAR_SUPPORT_MULAW_RW
-  ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE,
-#else
-  ROAR_CODECFILTER_READ,
+  ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN,
+#else
+  ROAR_CODECFILTER_READ|ROAR_CODECFILTER_PRETHRU_NN,
 #endif
   ROAR_SUBSYS_WAVEFORM,
@@ -101,5 +116,5 @@
  {ROAR_CODEC_OGG_VORBIS, "oggvorbis", "Ogg Vorbis decoder", NULL, NULL,
 #ifdef ROAR_HAVE_LIBVORBISENC
- ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE,
+ ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU,
 #else
  ROAR_CODECFILTER_READ,
@@ -136,5 +151,6 @@
 
 #ifdef ROAR_HAVE_LIBCELT
- {ROAR_CODEC_ROAR_CELT, "RoarCELT", "RoarAudio CELT", NULL, NULL, ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE,
+ {ROAR_CODEC_ROAR_CELT, "RoarCELT", "RoarAudio CELT", NULL, NULL,
+  ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU,
   ROAR_SUBSYS_WAVEFORM,
   cf_celt_open, cf_celt_close, NULL, cf_celt_write, cf_celt_read, NULL, cf_celt_delay, NULL},
@@ -142,5 +158,6 @@
 
 #ifdef ROAR_HAVE_LIBSPEEX
- {ROAR_CODEC_ROAR_SPEEX, "RoarSpeex", "RoarAudio Speex", NULL, NULL, ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE,
+ {ROAR_CODEC_ROAR_SPEEX, "RoarSpeex", "RoarAudio Speex", NULL, NULL,
+  ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU,
   ROAR_SUBSYS_WAVEFORM,
   cf_speex_open, cf_speex_close, NULL, cf_speex_write, cf_speex_read, NULL, NULL, NULL},
@@ -161,4 +178,8 @@
 #endif
 #endif
+
+ {ROAR_CODEC_ROARDMX, "RoarDMX", "Native RoarDMX Support", NULL, NULL,
+                          ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, ROAR_SUBSYS_LIGHT,
+                                          NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
  {-1, NULL, NULL, NULL, NULL, ROAR_CODECFILTER_NONE, ROAR_SUBSYS_NONE,
@@ -203,4 +224,8 @@
    if ( flags & ROAR_CODECFILTER_WRITE )
     mode[1] = 'w';
+   if ( flags & ROAR_CODECFILTER_PRETHRU )
+    mode[2] = 'P';
+   if ( flags & ROAR_CODECFILTER_PRETHRU_NN )
+    mode[2] = 'p';
   }
 
Index: roard/codecfilter_celt.c
===================================================================
--- roard/codecfilter_celt.c	(revision 2204)
+++ roard/codecfilter_celt.c	(revision 2816)
@@ -225,8 +225,22 @@
  int diff;
  int fs2 = self->frame_size * 2 * ROAR_STREAM(self->stream)->info.channels;
+ int sid;
  uint16_t pkglen_net, pkglen;
  unsigned char cbits[BS+2];
+ void * prethru;
 
  if ( !self->opened_encoder ) {
+  sid = ROAR_STREAM(self->stream)->id;
+
+  if ( stream_prethru_destroy(sid) == -1 ) {
+   return -1;
+  }
+
+  if ( stream_prethru_add_data(sid, &prethru, ROAR_CELT_MAGIC_LEN) == -1 ) {
+   return -1;
+  }
+
+  memcpy(prethru, ROAR_CELT_MAGIC, ROAR_CELT_MAGIC_LEN);
+
   if ( stream_vio_s_write(self->stream, ROAR_CELT_MAGIC, ROAR_CELT_MAGIC_LEN) != ROAR_CELT_MAGIC_LEN )
    return -1;
Index: roard/codecfilter_speex.c
===================================================================
--- roard/codecfilter_speex.c	(revision 2310)
+++ roard/codecfilter_speex.c	(revision 2816)
@@ -261,4 +261,6 @@
  int ret = 0;
  int need_extra;
+ int sid;
+ void * prethru;
 
 /*
@@ -271,4 +273,16 @@
 
  if ( ! self->encoder ) {
+  sid = ROAR_STREAM(self->stream)->id;
+
+  if ( stream_prethru_destroy(sid) == -1 ) {
+   return -1;
+  }
+
+  if ( stream_prethru_add_data(sid, &prethru, ROAR_SPEEX_MAGIC_LEN) == -1 ) {
+   return -1;
+  }
+
+  memcpy(prethru, ROAR_SPEEX_MAGIC, ROAR_SPEEX_MAGIC_LEN);
+
   if ( stream_vio_s_write(self->stream, ROAR_SPEEX_MAGIC, ROAR_SPEEX_MAGIC_LEN) != ROAR_SPEEX_MAGIC_LEN )
    return -1;
@@ -282,5 +296,12 @@
   }
 
+
   mode = ROAR_HOST2NET16(mode);
+
+  if ( stream_prethru_add_data(sid, &prethru, 2) == -1 ) {
+   return -1;
+  }
+
+  *(uint16_t*)prethru = mode;
 
   if ( stream_vio_s_write(self->stream, &mode, 2) != 2 )
Index: roard/codecfilter_vorbis.c
===================================================================
--- roard/codecfilter_vorbis.c	(revision 2107)
+++ roard/codecfilter_vorbis.c	(revision 2816)
@@ -144,4 +144,6 @@
  int chans;
  int end;
+ int sid;
+ void * prethrubuf;
 #if ROAR_VORBIS_BITS == 8
  int8_t  * data = (int8_t  *) buf;
@@ -161,4 +163,6 @@
   }
 
+  sid = ROAR_STREAM(self->stream)->id;
+
   vorbis_analysis_headerout(&(self->encoder.vd), &(self->encoder.vc), &header, &header_comm, &header_code);
 
@@ -166,4 +170,6 @@
   ogg_stream_packetin(&(self->encoder.os), &header_comm);
   ogg_stream_packetin(&(self->encoder.os), &header_code);
+
+  stream_prethru_destroy(sid);
 
   while (ogg_stream_flush(&(self->encoder.os), &(self->encoder.og))) {
@@ -174,4 +180,9 @@
     free(self); // TODO: do we need addional cleanup?
     return -1;
+   }
+   // we ignore errors at the moment...
+   if ( stream_prethru_add_data(sid, &prethrubuf, self->encoder.og.header_len + self->encoder.og.body_len) != -1 ) {
+    memcpy(prethrubuf,                               self->encoder.og.header, self->encoder.og.header_len);
+    memcpy(prethrubuf + self->encoder.og.header_len, self->encoder.og.body,   self->encoder.og.body_len  );
    }
   }
Index: roard/codecfilter_wave.c
===================================================================
--- roard/codecfilter_wave.c	(revision 2607)
+++ roard/codecfilter_wave.c	(revision 2816)
@@ -154,9 +154,10 @@
  struct codecfilter_wave_inst * self = (struct codecfilter_wave_inst *) inst;
  struct roar_stream           * s    = ROAR_STREAM(self->stream);
- char header[44];
+ void   * header;
  int32_t  tmp32;
  int16_t  tmp16;
  int16_t  bits;
  int16_t  codec;
+ int      sid;
 
  ROAR_DBG("cf_wave_write(inst=%p, buf=%p, len=%i) = ?", inst, buf, len);
@@ -169,4 +170,14 @@
   if ( s->fh == -1 ) {
    errno = EAGAIN;
+   return -1;
+  }
+
+  sid = ROAR_STREAM(self->stream)->id;
+
+  if ( stream_prethru_destroy(sid) == -1 ) {
+   return -1;
+  }
+
+  if ( stream_prethru_add_data(sid, &header, 44) == -1 ) {
    return -1;
   }
Index: roard/include/codecfilter.h
===================================================================
--- roard/include/codecfilter.h	(revision 2686)
+++ roard/include/codecfilter.h	(revision 2816)
@@ -32,7 +32,9 @@
 struct roar_stream_server;
 
-#define ROAR_CODECFILTER_NONE  0
-#define ROAR_CODECFILTER_READ  1
-#define ROAR_CODECFILTER_WRITE 2
+#define ROAR_CODECFILTER_NONE        0x00
+#define ROAR_CODECFILTER_READ        0x01
+#define ROAR_CODECFILTER_WRITE       0x02
+#define ROAR_CODECFILTER_PRETHRU     0x04 /* we have support for prethru */
+#define ROAR_CODECFILTER_PRETHRU_NN  0x08 /* prethru Not Needed          */
 
 
Index: roard/include/streams.h
===================================================================
--- roard/include/streams.h	(revision 2625)
+++ roard/include/streams.h	(revision 2816)
@@ -80,4 +80,5 @@
  struct roar_buffer * outputbuffer;
  int state;
+ struct roar_buffer * prethru;
 } * g_streams[ROAR_STREAMS_MAX];
 
@@ -135,4 +136,9 @@
 int stream_outputbuffer_destroy(int id);
 
+int stream_prethru_add(int id, struct roar_buffer * buf);
+int stream_prethru_add_data(int id, void ** buf, size_t len);
+int stream_prethru_destroy(int id);
+int stream_prethru_send(int dst, int src);
+
 int streams_check      (int id);
 int streams_send_mon   (int id);
Index: roard/streams.c
===================================================================
--- roard/streams.c	(revision 2766)
+++ roard/streams.c	(revision 2816)
@@ -104,4 +104,5 @@
    s->ready           =  0;
    s->outputbuffer    = NULL;
+   s->prethru         = NULL;
 
    s->mixer.scale     = 65535;
@@ -228,4 +229,5 @@
 
  stream_outputbuffer_destroy(id);
+ stream_prethru_destroy(id);
 
  if ( s->buffer != NULL )
@@ -421,4 +423,6 @@
   return -1;
 
+ dir = ROAR_STREAM(ss)->dir;
+
  ROAR_DBG("streams_set_fh(id=%i): g_streams[id]->id=%i", id, s->id);
 
@@ -435,8 +439,14 @@
  }
 
- if ( codecfilter_open(&(ss->codecfilter_inst), &(ss->codecfilter), NULL,
-                  s->info.codec, ss) == -1 ) {
-  return streams_delete(id); // TODO: FIXME: is this correct? shoudn't we return -1 in any case here?
- }
+ ROAR_DBG("streams_set_fh(id=%i, fh=%i) = ?", id, fh);
+
+ if ( dir != ROAR_DIR_THRU ) {
+  if ( codecfilter_open(&(ss->codecfilter_inst), &(ss->codecfilter), NULL,
+                   s->info.codec, ss) == -1 ) {
+   return streams_delete(id); // TODO: FIXME: is this correct? shoudn't we return -1 in any case here?
+  }
+ }
+
+ ROAR_DBG("streams_set_fh(id=%i, fh=%i) = ?", id, fh);
 
  if ( fh == -2 ) {
@@ -454,4 +464,6 @@
  }
 
+ ROAR_DBG("streams_set_fh(id=%i, fh=%i) = ?", id, fh);
+
  if ( fh == -1 || fh == -2 ) { // yes, this is valid, indecats full vio!
   ss->ready = 1;
@@ -460,7 +472,7 @@
  }
 
+ ROAR_DBG("streams_set_fh(id=%i, fh=%i) = ?", id, fh);
+
 // roar_socket_recvbuf(fh, ROAR_OUTPUT_CALC_OUTBUFSIZE( &(ROAR_STREAM(g_streams[id])->info) )); // set recv buffer to minimum
-
- dir = ROAR_STREAM(ss)->dir;
 
  switch (dir) {
@@ -493,4 +505,6 @@
   ss->ready = 1;
   ss->state = ROAR_STREAMSTATE_NEW;
+
+  ROAR_DBG("streams_set_fh(id=%i, fh=%i) = 0", id, fh);
   return 0;
  } else {
@@ -502,4 +516,6 @@
   ss->ready = 1;
   ss->state = ROAR_STREAMSTATE_NEW;
+
+  ROAR_DBG("streams_set_fh(id=%i, fh=%i) = 0", id, fh);
   return 0;
  }
@@ -1171,4 +1187,104 @@
  }
 
+ return 0;
+}
+
+int stream_prethru_add(int id, struct roar_buffer * buf) {
+ register struct roar_stream_server *  ss;
+
+ _CHECK_SID(id);
+
+ if ( (ss = g_streams[id]) == NULL )
+  return -1;
+
+ if ( ss->prethru == NULL ) {
+  ss->prethru = buf;
+  return 0;
+ }
+
+ if ( roar_buffer_add(ss->prethru, buf) == -1 ) {
+  return -1;
+ }
+
+ return 0;
+}
+
+int stream_prethru_add_data(int id, void ** buf, size_t len) {
+ struct roar_buffer * buffer;
+
+ _CHECK_SID(id);
+
+ if ( roar_buffer_new(&buffer, len) == -1 )
+  return -1;
+
+ if ( roar_buffer_get_data(buffer, buf) == -1 ) {
+  roar_buffer_free(buffer);
+  return -1;
+ }
+
+ if ( stream_prethru_add(id, buffer) == -1 ) {
+  roar_buffer_free(buffer);
+  return -1;
+ }
+
+ return 0;
+}
+
+int stream_prethru_destroy(int id) {
+ int ret;
+ register struct roar_stream_server *  ss;
+
+ _CHECK_SID(id);
+
+ if ( (ss = g_streams[id]) == NULL )
+  return -1;
+
+ if ( ss->prethru != NULL ) {
+  ret = roar_buffer_free(ss->prethru);
+  ss->prethru = NULL;
+  return ret;
+ }
+
+ return 0;
+}
+
+int stream_prethru_send(int dst, int src) {
+ struct roar_stream_server *  dst_ss, * src_ss;
+ struct roar_buffer * bufbuf;
+ void * bufdata;
+ size_t buflen;
+
+ ROAR_DBG("stream_prethru_send(dst=%i, src=%i) = ?", dst, src);
+
+ _CHECK_SID(dst);
+ _CHECK_SID(src);
+
+ if ( (dst_ss = g_streams[dst]) == NULL )
+  return -1;
+
+ if ( (src_ss = g_streams[src]) == NULL )
+  return -1;
+
+ bufbuf = src_ss->prethru;
+
+ ROAR_DBG("stream_prethru_send(dst=%i, src=%i): prethru buffer at %p", dst, src, bufbuf);
+
+ while (bufbuf != NULL) {
+  ROAR_DBG("stream_prethru_send(dst=%i, src=%i): looping with buffer at %p", dst, src, bufbuf);
+
+  if ( roar_buffer_get_data(bufbuf, &bufdata) == -1 )
+   return -1;
+
+  if ( roar_buffer_get_len(bufbuf, &buflen) == -1 )
+   return -1;
+
+  if ( stream_vio_s_write(dst_ss, bufdata, buflen) != buflen )
+   return -1;
+
+  if ( roar_buffer_get_next(bufbuf, &bufbuf) == -1 )
+   return -1;
+ }
+
+ ROAR_DBG("stream_prethru_send(dst=%i, src=%i) = 0", dst, src);
  return 0;
 }
@@ -1614,11 +1730,19 @@
   return -1;
 
- if ( streams_thru_num )
-  for (i = 0; i < ROAR_STREAMS_MAX; i++)
-   if ( g_streams[i] != NULL && ROAR_STREAM(g_streams[i])->pos_rel_id == ROAR_STREAM(stream)->id )
-    if ( ROAR_STREAM(g_streams[i])->dir == ROAR_DIR_THRU )
-     if ( g_streams[i]->ready )
+ if ( streams_thru_num ) {
+  for (i = 0; i < ROAR_STREAMS_MAX; i++) {
+   if ( g_streams[i] != NULL && ROAR_STREAM(g_streams[i])->pos_rel_id == ROAR_STREAM(stream)->id ) {
+    if ( ROAR_STREAM(g_streams[i])->dir == ROAR_DIR_THRU ) {
+     if ( g_streams[i]->ready ) {
       if ( stream_vio_write(i, orig_buf, len) != len )
        streams_delete(i);
+
+      if ( g_streams[i] != NULL )
+       g_streams[i]->state = ROAR_STREAMSTATE_OLD;
+     }
+    }
+   }
+  }
+ }
 
  return len;
@@ -1640,11 +1764,28 @@
 // ROAR_WARN("stream_vio_s_write(*): writing...");
 
- if ( streams_thru_num )
-  for (i = 0; i < ROAR_STREAMS_MAX; i++)
-   if ( g_streams[i] != NULL && ROAR_STREAM(g_streams[i])->pos_rel_id == ROAR_STREAM(stream)->id )
-    if ( ROAR_STREAM(g_streams[i])->dir == ROAR_DIR_THRU )
-     if ( g_streams[i]->ready )
-      if ( stream_vio_write(i, buf, count) != count )
+ if ( streams_thru_num ) {
+  for (i = 0; i < ROAR_STREAMS_MAX; i++) {
+   if ( g_streams[i] != NULL && ROAR_STREAM(g_streams[i])->pos_rel_id == ROAR_STREAM(stream)->id ) {
+    if ( ROAR_STREAM(g_streams[i])->dir == ROAR_DIR_THRU ) {
+     if ( g_streams[i]->ready ) {
+      if ( g_streams[i]->state == ROAR_STREAMSTATE_NEW ) {
+       if ( streams_get_flag(i, ROAR_FLAG_PRETHRU) == 1 ) {
+         if ( stream_prethru_send(i, ROAR_STREAM(stream)->id) == -1 ) {
+         streams_delete(i);
+        }
+       }
+      }
+
+      if ( stream_vio_write(i, buf, count) != count ) {
        streams_delete(i);
+      }
+
+      if ( g_streams[i] != NULL )
+       g_streams[i]->state = ROAR_STREAMSTATE_OLD;
+     }
+    }
+   }
+  }
+ }
 
  return roar_vio_write(&(stream->vio), buf, count);
