Index: roard/Makefile
===================================================================
--- roard/Makefile	(revision 4980)
+++ roard/Makefile	(revision 5242)
@@ -3,5 +3,5 @@
 OBJ=roard.o driver.o mixer.o output.o signals.o loop.o clients.o streams.o network.o commands.o req.o sources.o sample.o meta.o codecfilter.o lib.o ssynth.o container_framework.o plugins.o memlock.o hwmixer.o auth.o caps.o rolestack.o
 SUBSYS=midi.o light.o raw.o rdtcs.o waveform.o beep.o
-DRV=driver_esd.o driver_ao.o driver_roar.o driver_raw.o driver_oss.o driver_shout.o driver_sndio.o driver_dmx.o driver_pwmled.o driver_sysclock.o driver_wmm.o driver_dstr.o driver_alsa.o driver_rsound.o driver_portaudio.o driver_pulsesimple.o driver_jack.o driver_artsc.o
+DRV=driver_esd.o driver_ao.o driver_roar.o driver_oss.o driver_shout.o driver_sndio.o driver_dmx.o driver_pwmled.o driver_sysclock.o driver_wmm.o driver_dstr.o driver_alsa.o driver_rsound.o driver_portaudio.o driver_pulsesimple.o driver_jack.o driver_artsc.o
 CF_CODEC=codecfilter_cmd.o codecfilter_vorbis.o codecfilter_celt.o codecfilter_speex.o codecfilter_alaw.o codecfilter_mulaw.o codecfilter_sndfile.o codecfilter_fishsound.o codecfilter_flac.o
 CF_CONTAINER=codecfilter_wave.o codecfilter_raum.o codecfilter_au.o
Index: roard/clients.c
===================================================================
--- roard/clients.c	(revision 5192)
+++ roard/clients.c	(revision 5242)
@@ -699,5 +699,8 @@
 
  if ( ret == len ) {
-  roar_buffer_next(&(cs->outbuf));
+  if ( roar_buffer_next(&(cs->outbuf)) == -1 ) {
+   clients_delete(id);
+   return -1;
+  }
  } else {
   if ( roar_buffer_set_offset(cs->outbuf, ret) == -1 ) {
Index: roard/codecfilter_fishsound.c
===================================================================
--- roard/codecfilter_fishsound.c	(revision 4957)
+++ roard/codecfilter_fishsound.c	(revision 5242)
@@ -84,7 +84,11 @@
   self->buffer = buf;
  } else {
-  roar_buffer_add(self->buffer, buf);
- }
-
+  if ( roar_buffer_add(self->buffer, buf) == -1 ) {
+   roar_buffer_free(buf);
+   return -1;
+  }
+ }
+
+ // shouldn't that be zero?
  return -1;
 }
Index: roard/codecfilter_flac.c
===================================================================
--- roard/codecfilter_flac.c	(revision 5162)
+++ roard/codecfilter_flac.c	(revision 5242)
@@ -101,5 +101,8 @@
   self->decoder.written = buf;
  } else {
-  roar_buffer_add(self->decoder.written, buf);
+  if ( roar_buffer_add(self->decoder.written, buf) == -1 ) {
+   roar_buffer_free(buf);
+   return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
+  }
  }
 
Index: roard/driver_dmx.c
===================================================================
--- roard/driver_dmx.c	(revision 4918)
+++ roard/driver_dmx.c	(revision 5242)
@@ -29,4 +29,8 @@
 
 int driver_dmx_open_vio  (struct roar_vio_calls * inst, char * device, struct roar_audio_info * info, int fh, struct roar_stream_server * sstream) {
+ struct roar_vio_defaults def;
+
+ if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_WRONLY, 0644) == -1 )
+  return -1;
 
  if ( fh == -1 ) {
@@ -37,5 +41,5 @@
    device = "/dev/dmx";
 
-  if ( roar_vio_open_file(inst, device, O_WRONLY, 0644) == -1 )
+  if ( roar_vio_open_dstr(inst, device, &def, 1) == -1 )
    return -1;
  } else {
Index: roard/include/sources.h
===================================================================
--- roard/include/sources.h	(revision 5194)
+++ roard/include/sources.h	(revision 5242)
@@ -39,6 +39,6 @@
  unsigned int flags;
  unsigned int subsystems;
- int (*old_open)(char * driver, char * device, char * container, char * options, int primary);
- int (*new_open)(int stream   , char * device, int fh, char * driver);
+ int (*old_open)(const char * driver, const char * device, const char * container, const char * options, int primary);
+ int (*new_open)(int stream   , const char * device, int fh, const char * driver);
 };
 
@@ -57,13 +57,12 @@
                      char * options, int primary);
 
-int sources_add_raw  (int stream   , char * device, int fh, char * driver);
-int sources_add_wav  (char * driver, char * device, char * container, char * options, int primary);
-int sources_add_cf   (char * driver, char * device, char * container, char * options, int primary);
+int sources_add_dstr (int stream   , const char * device, int fh, const char * driver);
+int sources_add_cf   (const char * driver, const char * device, const char * container, const char * options, int primary);
 
-int sources_add_roar (int stream, char * device, int fh, char * driver);
-int sources_add_radionoise (int stream, char * device, int fh, char * driver);
+int sources_add_roar (int stream, const char * device, int fh, const char * driver);
+int sources_add_radionoise (int stream, const char * device, int fh, const char * driver);
 
 #ifndef ROAR_WITHOUT_DCOMP_CDRIVER
-int sources_add_cdriver (int stream   , char * device, int fh, char * driver);
+int sources_add_cdriver (int stream   , const char * device, int fh, const char * driver);
 #endif
 #endif
Index: roard/output.c
===================================================================
--- roard/output.c	(revision 5210)
+++ roard/output.c	(revision 5242)
@@ -460,18 +460,36 @@
  _LIBROAR_IGNORE_RET(roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_SSTREAM,   s)); // ignore errors here
 
- if ( blocks != -1 )
-  roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DBLOCKS, &blocks);
-
- if ( blocksize != -1 )
-  roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DBLKSIZE, &blocksize);
+ if ( blocks != -1 ) {
+  if ( roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DBLOCKS, &blocks) == -1 ) {
+   ROAR_WARN("add_output(drv='%s', dev='%s', opts='%s'): can not set number of blocks.", drv, dev, opts);
+  }
+ }
+
+ if ( blocksize != -1 ) {
+  if ( roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DBLKSIZE, &blocksize) == -1 ) {
+   ROAR_WARN("add_output(drv='%s', dev='%s', opts='%s'): can not set blocksize.", drv, dev, opts);
+  }
+ }
 
  // TODO: we shoudld *really* check for errors here...
  if ( channel != -1 ) {
   tu16 = channel;
-  roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DMXSCHAN, &tu16);
+  if ( roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DMXSCHAN, &tu16) == -1 ) {
+   streams_delete(stream);
+   if ( prim ) alive = 0;
+   ROAR_ERR("add_output(drv='%s', dev='%s', opts='%s'): can not set DMX channel number.", drv, dev, opts);
+   ROAR_DBG("add_output(drv='%s', dev='%s', opts='%s') = -1", drv, dev, opts);
+   return -1;
+  }
  }
  if ( universe != -1 ) {
   tu16 = universe;
-  roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DMXUNIV, &tu16);
+  if ( roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DMXUNIV, &tu16) == -1 ) {
+   streams_delete(stream);
+   if ( prim ) alive = 0;
+   ROAR_ERR("add_output(drv='%s', dev='%s', opts='%s'): can not set DMX universe.", drv, dev, opts);
+   ROAR_DBG("add_output(drv='%s', dev='%s', opts='%s') = -1", drv, dev, opts);
+   return -1;
+  }
  }
 
Index: roard/sources.c
===================================================================
--- roard/sources.c	(revision 5210)
+++ roard/sources.c	(revision 5242)
@@ -33,8 +33,5 @@
 
 struct roar_source g_source[] = {
- {"raw",  "Raw source",                  "/some/file",     SRC_FLAG_FHSEC, ROAR_SUBSYS_WAVEFORM, NULL,  sources_add_raw},
-#ifdef ROAR_HAVE_IO_POSIX
- {"wav",  "Old RIFF/WAVE source",        "/some/file.wav", SRC_FLAG_NONE,  ROAR_SUBSYS_WAVEFORM, sources_add_wav,  NULL},
-#endif
+ {"raw",  "DSTR source",                 "/some/file",     SRC_FLAG_FHSEC, ROAR_SUBSYS_WAVEFORM, NULL,  sources_add_dstr},
  {"cf",   "Old CF source",               "/some/file.ext", SRC_FLAG_NONE,  ROAR_SUBSYS_WAVEFORM, sources_add_cf,   NULL},
  {"roar", "New simple RoarAudio source", "some.host",      SRC_FLAG_NONE,  ROAR_SUBSYS_WAVEFORM, NULL, sources_add_roar},
@@ -250,6 +247,10 @@
 }
 
-int sources_add_raw  (int stream   , char * device, int fh, char * driver) {
+int sources_add_dstr  (int stream   , const char * device, int fh, const char * driver) {
  struct roar_stream_server * ss;
+ struct roar_vio_defaults def;
+
+ if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_RDONLY, 0644) == -1 )
+  return -1;
 
  streams_get(stream, &ss);
@@ -259,5 +260,5 @@
    return -1;
  } else {
-  if ( roar_vio_open_file(&(ss->vio), device, O_RDONLY, 0644) == -1 )
+  if ( roar_vio_open_dstr(&(ss->vio), device, &def, 1) == -1 )
    return -1;
  }
@@ -266,54 +267,7 @@
 }
 
-#ifdef ROAR_HAVE_IO_POSIX
-int sources_add_wav (char * driver, char * device, char * container, char * options, int primary) {
- int stream;
- int fh;
- char buf[44];
- struct roar_stream * s;
-
- ROAR_WARN("sources_add_raw(*): The wav(e) source is obsolete, use source 'cf' (default)!");
-
- if ( (fh = open(device, O_RDONLY, 0644)) == -1 ) {
-  return -1;
- }
-
- if (read(fh, buf, 44) != 44) {
-  close(fh);
-  return -1;
- }
-
- if ( (stream = streams_new()) == -1 ) {
-  close(fh);
-  return -1;
- }
-
- streams_get_clientobj(stream, &s);
-
- memcpy(&(s->info), g_sa, sizeof(struct roar_audio_info));
-
- memcpy(&(s->info.rate    ), buf+24, 4);
- memcpy(&(s->info.channels), buf+22, 2);
- memcpy(&(s->info.bits    ), buf+34, 2);
-
- if ( streams_set_dir(stream, ROAR_DIR_PLAY, 1) == -1 ) {
-  streams_delete(stream);
-  close(fh);
-  return -1;
- }
- s->pos_rel_id = -1;
-
- streams_set_fh(stream, fh);
-
- streams_set_flag(stream, ROAR_FLAG_SOURCE);
- client_stream_add(g_source_client, stream);
-
- return 0;
-}
-#endif
-
 #define _ret(x) streams_delete(stream); return (x)
 
-int sources_add_cf (char * driver, char * device, char * container, char * options, int primary) {
+int sources_add_cf (const char * driver, const char * device, const char * container, const char * options, int primary) {
  int  stream;
  int  codec;
@@ -359,5 +313,5 @@
  ROAR_DBG("sources_add_cf(*) = ?");
 
- // TODO: finy out a better way of doing auto detetion without need for seek!
+ // TODO: find out a better way of doing auto detetion without need for seek!
  if ( options == NULL ) {
   if ( (len = roar_vio_read(vio, buf, 64)) < 1 ) {
@@ -402,5 +356,5 @@
 
 #ifndef ROAR_WITHOUT_DCOMP_CDRIVER
-int sources_add_cdriver (int stream   , char * device, int fh, char * driver) {
+int sources_add_cdriver (int stream   , const char * device, int fh, const char * driver) {
  struct roar_stream_server * ss;
 
@@ -460,5 +414,5 @@
 }
 
-int sources_add_radionoise (int stream, char * device, int fh, char * driver) {
+int sources_add_radionoise (int stream, const char * device, int fh, const char * driver) {
  struct roar_stream_server * ss;
  struct roar_audio_info    * info;
@@ -484,5 +438,5 @@
 }
 
-int sources_add_roar (int stream, char * device, int fh, char * driver) {
+int sources_add_roar (int stream, const char * device, int fh, const char * driver) {
  struct roar_stream_server * ss;
  struct roar_stream        * s;
Index: roard/streams.c
===================================================================
--- roard/streams.c	(revision 5192)
+++ roard/streams.c	(revision 5242)
@@ -2261,11 +2261,9 @@
  ROAR_DBG("streams_check(id=%i): asking for %i bytes", id, req);
 
- if ( roar_buffer_new(&b, req) == -1 ) {
+ if ( roar_buffer_new_data(&b, req, &buf) == -1 ) {
   ROAR_ERR("streams_check(*): Can not alloc buffer space!");
   ROAR_DBG("streams_check(*) = -1");
   return -1;
  }
-
- roar_buffer_get_data(b, &buf);
 
  ROAR_DBG("streams_check(id=%i): buffer is up and ready ;)", id);
