Index: roard/streams.c
===================================================================
--- roard/streams.c	(revision 2459)
+++ roard/streams.c	(revision 2491)
@@ -716,233 +716,4 @@
 }
 
-int streams_fill_mixbuffer (int id, struct roar_audio_info * info) {
- // TODO: decide: is this the most complex, hacked, un-understadable,
- //               un-writeable and even worse: un-readable
- //               function in the whole project?
- size_t todo = ROAR_OUTPUT_CALC_OUTBUFSIZE(info);
- size_t needed = todo;
- size_t todo_in;
- size_t len, outlen;
- size_t mul = 1, div = 1;
- void * rest = NULL;
- void * in   = NULL;
- struct roar_buffer     * buf;
- struct roar_audio_info * stream_info;
- struct roar_stream_server * stream = g_streams[id];
- int is_the_same = 0;
-
- if ( g_streams[id] == NULL )
-  return -1;
-
- if ( streams_get_outputbuffer(id, &rest, todo) == -1 ) {
-  return -1;
- }
-
- if ( rest == NULL ) {
-  return -1;
- }
-
- // set up stream_info
-
- stream_info = &(ROAR_STREAM(stream)->info);
-
- // calc todo_in
- todo_in = ROAR_OUTPUT_CALC_OUTBUFSIZE(stream_info);
-
- if ( todo_in == 0 ) {
-  ROAR_WARN("streams_fill_mixbuffer(id=%i, info=%p{...}): todo_in == 0, this should not happen!", id, info);
-  return -1;
- }
-
- // calc mul and div:
- mul = todo    / todo_in;
- div = todo_in / todo;
-
- if ( mul == 0 ) {
-  mul = 1;
- } else {
-  div = 1;
- }
-
- ROAR_DBG("streams_fill_mixbuffer(*): mul=%i, div=%i", mul, div);
-
- ROAR_DBG("streams_fill_mixbuffer(*): rest=%p, todo=%i->%i (in->out)", rest, todo_in, todo);
- // are both (input and output) of same format?
-
-
- ROAR_DBG("streams_fill_mixbuffer(*): stream_info:");
- roar_debug_audio_info_print(stream_info);
- ROAR_DBG("streams_fill_mixbuffer(*): info:");
- roar_debug_audio_info_print(info);
-
- is_the_same = stream_info->rate     == info->rate     && stream_info->bits  == info->bits &&
-               stream_info->channels == info->channels && stream_info->codec == info->codec;
-
- ROAR_DBG("streams_fill_mixbuffer(*): is_the_same=%i", is_the_same);
-
-/* How it works:
- *
- * set a counter to the number of samples we need.
- * loop until we have all samples done or no samples are
- * left in our input buffer.
- * If there a no samples left in the input buffer: fill the rest
- * of the output buffer with zeros.
- *
- * The loop:
- * get a buffer from the input.
- * if it's bigger than needed, set an offset.
- * The rest of the data:
- * 0) convert endianness (codec) from remote to local...
- * 1) change bits in of the samples
- * 2) change sample rate
- * 3) change the nummber of channels
- * 4) insert into output buffer
- */
-
-/*
- // get our first buffer:
-
- if ( stream_shift_buffer(id, &buf) == -1 ) {
-  return -1;
- }
-
- // first test for some basic simple cases...
-
- if ( buf == NULL ) { // we habe nothing in input queue
-                      // we may memset() our output buffer OR
-                      // just return with -1 so we are going to
-                      // be ignored.
-  return -1;
- }
-*/
-
- while (todo) { // main loop
-  ROAR_DBG("streams_fill_mixbuffer(*): looping...");
-  // exit loop if nothing is left, even if we need more data..
-  if ( stream_shift_buffer(id, &buf) == -1 )
-   break;
-  if ( buf == NULL )
-   break;
-
-  // read the data for this loop...
-  roar_buffer_get_data(buf, &in);
-  roar_buffer_get_len(buf, &len);
-
-  ROAR_DBG("streams_fill_mixbuffer(*): len = %i", len);
-
-  if ( len > todo_in ) {
-   roar_buffer_set_offset(buf, todo_in);
-   len = todo_in;
-  } else {
-   roar_buffer_set_len(buf, 0); // queue for deletation
-  }
-
-  // we now have 'len' bytes in 'in'
-
-  // calc how much outlen this has...
-  outlen = (len * mul) / div;
-
-  ROAR_DBG("streams_fill_mixbuffer(*): outlen = %i, buf = %p, len = %i", outlen, in, len);
-
-  if ( is_the_same ) {
-/*
- * 0) convert endianness (codec) from remote to local...
- * 1) change bits in of the samples
- * 2) change sample rate
- * 3) change the nummber of channels
-   \\==> skiping,...
- */
-   // * 4) insert into output buffer
-   ROAR_DBG("streams_fill_mixbuffer(*): memcpy: in->rest: %p -> %p", in, rest);
-   if ( memcpy(rest, in, len) != rest ) {
-    ROAR_ERR("streams_fill_mixbuffer(*): memcpy returned invalid pointer.");
-   }
-
-  } else {
-
-/*
-   // * 0) convert endianness (codec) from remote to local...
-   if ( stream_info->codec != info->codec ) {
-    // we neet to convert...
-    return -1;
-   }
-
-   // * 1) change bits in of the samples
-   if ( stream_info->bits != info->bits ) {
-    return -1;
-   }
-
-   // * 2) change sample rate
-   if ( stream_info->rate != info->rate ) {
-    return -1;
-   }
-
-   // * 3) change the nummber of channels
-   if ( stream_info->channels != info->channels ) {
-    return -1;
-   }
-
-   // * 4) insert into output buffer
-*/
-  // hey! we have roar_conv() :)
-
-  if ( roar_conv(rest, in, 8*len / stream_info->bits, stream_info, info) == -1 )
-   return -1;
-  }
-
-  if ( !streams_get_flag(id, ROAR_FLAG_HWMIXER) ) {
-   if ( change_vol(rest, info->bits, rest, 8*outlen / info->bits, info->channels, &(stream->mixer)) == -1 )
-    return -1;
-  }
-
-  // we habe outlen bytes more...
-  todo    -= outlen;
-  rest    += outlen;
-  todo_in -= len;
-
-  roar_buffer_get_len(buf, &len);
-  ROAR_DBG("streams_fill_mixbuffer(*): New length of buffer %p is %i", buf, len);
-  if ( len == 0 ) {
-   roar_buffer_delete(buf, NULL);
-  } else {
-   stream_unshift_buffer(id, buf);
-  }
- }
-
-//len = 0;
-//roar_buffer_get_len(buf, &len);
-
-/*
- if ( len > 0 ) // we still have some data in this buffer, re-inserting it to the input buffers...
-  stream_unshift_buffer(id, buf);
- else
-  buffer_delete(buf, NULL);
-*/
-
- ROAR_STREAM(g_streams[id])->pos =
-      ROAR_MATH_OVERFLOW_ADD(ROAR_STREAM(g_streams[id])->pos,
-          ROAR_OUTPUT_CALC_OUTBUFSAMP(info, needed-todo));
- //ROAR_WARN("stream=%i, pos=%u", id, ((struct roar_stream*)g_streams[id])->pos);
-
- if ( todo > 0 ) { // zeroize the rest of the buffer
-  memset(rest, 0, todo);
-
-  if ( todo != ROAR_OUTPUT_CALC_OUTBUFSIZE(info) ) {
-   if ( g_streams[id]->is_new ) {
-    stream->pre_underruns++;
-   } else {
-    ROAR_WARN("streams_fill_mixbuffer(*): Underrun in stream: %u bytes missing, filling with zeros", (unsigned int)todo);
-    stream->post_underruns++;
-   }
-
-   stream->is_new = 0;
-  }
- } else {
-  stream->is_new = 0;
- }
-
- return 0;
-}
-
 int streams_fill_mixbuffer2 (int id, struct roar_audio_info * info) {
  size_t   outlen = ROAR_OUTPUT_CALC_OUTBUFSIZE(info);
