diff -Nru darkice-1.2/acinclude.m4 darkice-1.3/acinclude.m4
--- darkice-1.2/acinclude.m4	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/acinclude.m4	2015-05-18 19:38:07.000000000 +0200
@@ -99,7 +99,7 @@
 dnl macros posted by AFC to the autoconf macro repository.  We are also
 dnl grateful for the helpful feedback of numerous users.
 dnl
-dnl @version $Id: acinclude.m4 553 2013-07-15 05:50:56Z rafael@riseup.net $
+dnl @version $Id$
 dnl @author Steven G. Johnson <stevenj@alum.mit.edu> and Alejandro Forero Cuervo <bachue@bachue.com>
 
 AC_DEFUN([ACX_PTHREAD], [
diff -Nru darkice-1.2/ChangeLog darkice-1.3/ChangeLog
--- darkice-1.2/ChangeLog	2013-07-15 07:52:57.000000000 +0200
+++ darkice-1.3/ChangeLog	2016-08-04 15:40:12.000000000 +0200
@@ -1,3 +1,8 @@
+04-08-2016 Darkice 1.3 released
+    o Small bugs fixed by Nicolas Boulenguez <nicolas@debian.org>.
+    o Bugs related to streaming to remote servers fixed. Patch by Kalle Kulonen
+	<kulonenk@gmail.com> and Mark Turner <jmarkturner@gmail.com>.
+
 15-07-2013 Darkice 1.2 released
     o Issue #75: Added Ogg/Opus support. Patch by Doug Kelly
 	dougk.ff7@gmail.com
diff -Nru darkice-1.2/configure.in darkice-1.3/configure.in
--- darkice-1.2/configure.in	2013-07-15 07:50:01.000000000 +0200
+++ darkice-1.3/configure.in	2016-08-04 15:41:01.000000000 +0200
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(darkice, 1.2)
+AC_INIT(darkice, 1.3)
 AC_CONFIG_SRCDIR(src/DarkIce.cpp)
 AM_CONFIG_HEADER(src/config.h)
 
@@ -9,6 +9,8 @@
 AC_PROG_CXX
 AC_PROG_INSTALL
 
+PKG_PROG_PKG_CONFIG
+
 dnl AC_STDC_HEADERS
 AC_HAVE_HEADERS(errno.h fcntl.h stdio.h stdlib.h string.h unistd.h limits.h)
 AC_HAVE_HEADERS(signal.h time.h sys/time.h sys/types.h sys/wait.h math.h)
@@ -41,29 +43,32 @@
 dnl-----------------------------------------------------------------------------
 dnl link the lame library if requested
 dnl-----------------------------------------------------------------------------
-AC_SUBST(LAME_INCFLAGS)
-AC_SUBST(LAME_LDFLAGS)
+AC_SUBST(LAME_CFLAGS)
+AC_SUBST(LAME_LIBS)
 
 AC_ARG_WITH(lame,
-[  --with-lame             use lame for encoding mp3 streams [yes] ],
-    USE_LAME=${withval}, USE_LAME="yes" )
+    AS_HELP_STRING([--with-lame], [use lame for encoding mp3 streams @<:@check@:>@]),
+    [], with_lame=check)
 AC_ARG_WITH(lame-prefix,
-[  --with-lame-prefix=DIR  alternate location for lame [/usr]
-                              look for libraries in LAME-PREFIX/lib,
-                              for headers in LAME-PREFIX/include],
+    AS_HELP_STRING([--with-lame-prefix=DIR],
+        [alternate location for lame @<:@/usr@:>@.
+        Look for libraries in LAME-PREFIX/lib,
+        for headers in LAME-PREFIX/include]),
     CONFIG_LAME_PREFIX="${withval}", CONFIG_LAME_PREFIX="/usr")
 
-if test "x${USE_LAME}" = "xyes" ; then
+if test "x$with_lame" != xno ; then
     AC_MSG_CHECKING( [for lame library at ${CONFIG_LAME_PREFIX}] )
     LA_SEARCH_LIB( LAME_LIB_LOC, LAME_INC_LOC, libmp3lame.a libmp3lame.so, lame/lame.h,
                    ${CONFIG_LAME_PREFIX})
     if test "x${LAME_LIB_LOC}" != "x" ; then
         AC_DEFINE( HAVE_LAME_LIB, 1, [build with lame library] )
         if test "x${LAME_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then
-            LAME_INCFLAGS="-I${LAME_INC_LOC}"
+            LAME_CFLAGS="-I${LAME_INC_LOC}"
         fi
-        LAME_LDFLAGS="-L${LAME_LIB_LOC} -lmp3lame"
+        LAME_LIBS="-L${LAME_LIB_LOC} -lmp3lame"
         AC_MSG_RESULT( [found at ${CONFIG_LAME_PREFIX}] )
+    elif test "x$with_lame" = xyes ; then
+        AC_MSG_ERROR([unable to find lame library])
     else
         AC_MSG_WARN( [not found, building without lame])
     fi
@@ -75,110 +80,58 @@
 dnl-----------------------------------------------------------------------------
 dnl link the ogg vorbis libraries if requested
 dnl-----------------------------------------------------------------------------
-AC_SUBST(VORBIS_INCFLAGS)
-AC_SUBST(VORBIS_LDFLAGS)
-
 AC_ARG_WITH(vorbis,
-[  --with-vorbis           use Ogg Vorbis for encoding vorbis streams [yes] ],
-    USE_VORBIS=${withval}, USE_VORBIS="yes" )
-AC_ARG_WITH(vorbis-prefix,
-[  --with-vorbis-prefix=DIR    alternate location for vorbis [/usr]
-                              look for libraries in VORBIS-PREFIX/lib,
-                              for headers in VORBIS-PREFIX/include],
-    CONFIG_VORBIS_PREFIX="${withval}", CONFIG_VORBIS_PREFIX="/usr")
-
-if test "x${USE_VORBIS}" = "xyes" ; then
-    AC_MSG_CHECKING( [for vorbis libraries at ${CONFIG_VORBIS_PREFIX}] )
-    LA_SEARCH_LIB( OGG_LIB_LOC, OGG_INC_LOC, libogg.a libogg.so, ogg/ogg.h,
-                   ${CONFIG_VORBIS_PREFIX})
-    LA_SEARCH_LIB( VORBIS_LIB_LOC, VORBIS_INC_LOC, libvorbis.a libvorbis.so, vorbis/codec.h,
-                   ${CONFIG_VORBIS_PREFIX})
-    LA_SEARCH_LIB( VORBISENC_LIB_LOC, VORBISENC_INC_LOC,
-                   libvorbisenc.a libvorbisenc.so, vorbis/vorbisenc.h,
-                   ${CONFIG_VORBIS_PREFIX})
-
-    if test "x${OGG_LIB_LOC}" != "x" -a \
-            "x${VORBIS_LIB_LOC}" != "x" -a \
-            "x${VORBISENC_LIB_LOC}" != "x" ; then
-
-        AC_DEFINE( HAVE_VORBIS_LIB, 1, [build with Ogg Vorbis library] )
-        if test "x${OGG_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then
-            VORBIS_INCFLAGS="-I${OGG_INC_LOC}"
-        fi
-        VORBIS_LDFLAGS="-L${OGG_LIB_LOC} -logg -lvorbis -lvorbisenc"
-        AC_MSG_RESULT( [found at ${CONFIG_VORBIS_PREFIX}] )
-    else
-        AC_MSG_WARN( [not found, building without Ogg Vorbis])
-    fi
-else
-    AC_MSG_RESULT( [building without Ogg Vorbis] )
-fi
-
+    AS_HELP_STRING([--with-vorbis], [use Ogg Vorbis for encoding vorbis streams @<:@check@:>@]),
+    [], with_vorbis=check)
+AS_CASE([$with_vorbis],
+    check, [PKG_CHECK_MODULES(VORBIS, [ogg vorbis vorbisenc], [], true)],
+    yes,   [PKG_CHECK_MODULES(VORBIS, [ogg vorbis vorbisenc])],
+    AC_MSG_RESULT([building without Ogg Vorbis]))
+AS_IF(test -n "$VORBIS_LIBS",
+    AC_DEFINE(HAVE_VORBIS_LIB, 1, [build with Ogg Vorbis library]))
 
 dnl-----------------------------------------------------------------------------
 dnl link the ogg / opus libraries if requested
 dnl-----------------------------------------------------------------------------
-AC_SUBST(OPUS_INCFLAGS)
-AC_SUBST(OPUS_LDFLAGS)
-
 AC_ARG_WITH(opus,
-[  --with-opus           use Ogg Opus for encoding opus streams [yes] ],
-    USE_OPUS=${withval}, USE_OPUS="yes" )
-AC_ARG_WITH(opus-prefix,
-[  --with-opus-prefix=DIR    alternate location for opus [/usr]
-                              look for libraries in OPUS-PREFIX/lib,
-                              for headers in OPUS-PREFIX/include],
-    CONFIG_OPUS_PREFIX="${withval}", CONFIG_OPUS_PREFIX="/usr")
-
-if test "x${USE_OPUS}" = "xyes" ; then
-    AC_MSG_CHECKING( [for opus libraries at ${CONFIG_OPUS_PREFIX}] )
-    LA_SEARCH_LIB( OGG_LIB_LOC, OGG_INC_LOC, libogg.a libogg.so, ogg/ogg.h,
-                   ${CONFIG_OPUS_PREFIX})
-    LA_SEARCH_LIB( OPUS_LIB_LOC, OPUS_INC_LOC, libopus.a libopus.so, opus/opus.h,
-                   ${CONFIG_OPUS_PREFIX})
-
-    if test "x${OGG_LIB_LOC}" != "x" -a \
-            "x${OPUS_LIB_LOC}" != "x" ; then
-
-        AC_DEFINE( HAVE_OPUS_LIB, 1, [build with Ogg Opus library] )
-        if test "x${OGG_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then
-            OPUS_INCFLAGS="-I${OGG_INC_LOC}"
-        fi
-        OPUS_LDFLAGS="-L${OGG_LIB_LOC} -logg -lopus"
-        AC_MSG_RESULT( [found at ${CONFIG_OPUS_PREFIX}] )
-    else
-        AC_MSG_WARN( [not found, building without Ogg Opus])
-    fi
-else
-    AC_MSG_RESULT( [building without Ogg Opus] )
-fi
+    AS_HELP_STRING([--with-opus], [use Ogg Opus for encoding opus streams @<:@check@:>@]),
+    [], with_opus=check)
+AS_CASE([$with_opus],
+    check, [PKG_CHECK_MODULES(OPUS, [ogg opus], [], true)],
+    yes,   [PKG_CHECK_MODULES(OPUS, [ogg opus])],
+    AC_MSG_RESULT([building without Ogg Opus]))
+AS_IF(test -n "$OPUS_LIBS",
+    AC_DEFINE(HAVE_OPUS_LIB, 1, [build with Ogg Opus library]))
 
 dnl-----------------------------------------------------------------------------
 dnl link the faac library if requested
 dnl-----------------------------------------------------------------------------
-AC_SUBST(FAAC_INCFLAGS)
-AC_SUBST(FAAC_LDFLAGS)
+AC_SUBST(FAAC_CFLAGS)
+AC_SUBST(FAAC_LIBS)
 
 AC_ARG_WITH(faac,
-[  --with-faac             use faac for encoding AAC streams [yes] ],
-    USE_FAAC=${withval}, USE_FAAC="yes" )
+    AS_HELP_STRING([--with-faac], [use faac for encoding AAC streams @<:@check@:>@]),
+    [], with_faac=check)
 AC_ARG_WITH(faac-prefix,
-[  --with-faac-prefix=DIR  alternate location for faac [/usr]
-                              look for libraries in FAAC-PREFIX/lib,
-                              for headers in FAAC-PREFIX/include],
+    AS_HELP_STRING([--with-faac-prefix=DIR],
+        [alternate location for faac @<:@/usr@:>@.
+        Look for libraries in FAAC-PREFIX/lib,
+        for headers in FAAC-PREFIX/include]),
     CONFIG_FAAC_PREFIX="${withval}", CONFIG_FAAC_PREFIX="/usr")
 
-if test "x${USE_FAAC}" = "xyes" ; then
+if test "x$with_faac" != xno ; then
     AC_MSG_CHECKING( [for faac library at ${CONFIG_FAAC_PREFIX}] )
     LA_SEARCH_LIB( FAAC_LIB_LOC, FAAC_INC_LOC, libfaac.a libfaac.so, faac.h,
                    ${CONFIG_FAAC_PREFIX})
     if test "x${FAAC_LIB_LOC}" != "x" ; then
         AC_DEFINE( HAVE_FAAC_LIB, 1, [build with faac library] )
         if test "x${FAAC_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then
-            FAAC_INCFLAGS="-I${FAAC_INC_LOC}"
+            FAAC_CFLAGS="-I${FAAC_INC_LOC}"
         fi
-        FAAC_LDFLAGS="-L${FAAC_LIB_LOC} -lfaac"
+        FAAC_LIBS="-L${FAAC_LIB_LOC} -lfaac"
         AC_MSG_RESULT( [found at ${CONFIG_FAAC_PREFIX}] )
+    elif test "x$with_faac" = yes ; then
+        AC_MSG_ERROR([unable to find faac library])
     else
         AC_MSG_WARN( [not found, building without faac])
     fi
@@ -190,229 +143,95 @@
 dnl-----------------------------------------------------------------------------
 dnl link the aacplus library if requested
 dnl-----------------------------------------------------------------------------
-AC_SUBST(AACPLUS_INCFLAGS)
-AC_SUBST(AACPLUS_LDFLAGS)
-
 AC_ARG_WITH(aacplus,
-[  --with-aacplus             use aacplus for encoding AAC HEv2 streams [yes] ],
-    USE_AACPLUS=${withval}, USE_AACPLUS="yes" )
-AC_ARG_WITH(aacplus-prefix,
-[  --with-aacplus-prefix=DIR  alternate location for aacplus [/usr]
-                              look for libraries in AACPLUS-PREFIX/lib,
-                              for headers in AACPLUS-PREFIX/include],
-    CONFIG_AACPLUS_PREFIX="${withval}", CONFIG_AACPLUS_PREFIX="/usr")
-
-if test "x${USE_AACPLUS}" = "xyes" ; then
-    AC_MSG_CHECKING( [for aacplus library at ${CONFIG_AACPLUS_PREFIX}] )
-    LA_SEARCH_LIB( AACPLUS_LIB_LOC, AACPLUS_INC_LOC, libaacplus.a libaacplus.so, aacplus.h,
-                   ${CONFIG_AACPLUS_PREFIX})
-    if test "x${AACPLUS_LIB_LOC}" != "x" ; then
-        AC_DEFINE( HAVE_AACPLUS_LIB, 1, [build with aacplus library] )
-        if test "x${AACPLUS_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then
-            AACPLUS_INCFLAGS="-I${AACPLUS_INC_LOC}"
-        fi
-        AACPLUS_LDFLAGS="-L${AACPLUS_LIB_LOC} -laacplus"
-        AC_MSG_RESULT( [found at ${CONFIG_AACPLUS_PREFIX}] )
-    else
-        AC_MSG_WARN( [not found, building without aacplus])
-    fi
-else
-    AC_MSG_RESULT( [building without aacplus] )
-fi
-
+    AS_HELP_STRING([--with-aacplus], [use aacplus for encoding AAC HEv2 streams @<:@check@:>@]),
+    [], with_aacplus=check)
+AS_CASE([$with_aacplus],
+    check, [PKG_CHECK_MODULES(AACPLUS, aacplus, [], true)],
+    yes,   [PKG_CHECK_MODULES(AACPLUS, aacplus)],
+    AC_MSG_RESULT([building without aacplus]))
+AS_IF(test -n "$AACPLUS_LIBS",
+    AC_DEFINE(HAVE_AACPLUS_LIB, 1, [build with aacplus library]))
 
 dnl-----------------------------------------------------------------------------
 dnl link the twolame library if requested
 dnl-----------------------------------------------------------------------------
-AC_SUBST(TWOLAME_INCFLAGS)
-AC_SUBST(TWOLAME_LDFLAGS)
-
 AC_ARG_WITH(twolame,
-[  --with-twolame             use twolame for encoding MP2 streams [yes] ],
-    USE_TWOLAME=${withval}, USE_TWOLAME="yes" )
-AC_ARG_WITH(twolame-prefix,
-[  --with-twolame-prefix=DIR  alternate location for twolame [/usr]
-                              look for libraries in TWOLAME-PREFIX/lib,
-                              for headers in TWOLAME-PREFIX/include],
-    CONFIG_TWOLAME_PREFIX="${withval}", CONFIG_TWOLAME_PREFIX="/usr")
-
-if test "x${USE_TWOLAME}" = "xyes" ; then
-    AC_MSG_CHECKING( [for twolame library at ${CONFIG_TWOLAME_PREFIX}] )
-    LA_SEARCH_LIB( TWOLAME_LIB_LOC, TWOLAME_INC_LOC, libtwolame.a libtwolame.so, twolame.h,
-                   ${CONFIG_TWOLAME_PREFIX})
-    if test "x${TWOLAME_LIB_LOC}" != "x" ; then
-        AC_DEFINE( HAVE_TWOLAME_LIB, 1, [build with twolame library] )
-        if test "x${TWOLAME_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then
-            TWOLAME_INCFLAGS="-I${TWOLAME_INC_LOC}"
-        fi
-        TWOLAME_LDFLAGS="-L${TWOLAME_LIB_LOC} -ltwolame"
-        AC_MSG_RESULT( [found at ${CONFIG_TWOLAME_PREFIX}] )
-    else
-        AC_MSG_WARN( [not found, building without twolame])
-    fi
-else
-    AC_MSG_RESULT( [building without twolame] )
-fi
-
+    AS_HELP_STRING([--with-twolame], [use twolame for encoding MP2 streams @<:@check@:>@]),
+    [], with_twolame=check)
+AS_CASE([$with_twolame],
+    check, [PKG_CHECK_MODULES(TWOLAME, twolame, [], true)],
+    yes,   [PKG_CHECK_MODULES(TWOLAME, twolame)],
+    AC_MSG_RESULT([building without twolame]))
+AS_IF(test -n "$TWOLAME_LIBS",
+    AC_DEFINE(HAVE_TWOLAME_LIB, 1, [build with twolame library]))
 
 dnl-----------------------------------------------------------------------------
 dnl make sure at least one of lame and vorbis present
 dnl-----------------------------------------------------------------------------
-if test "x${LAME_LDFLAGS}" = "x" \
-     -a "x${VORBIS_LDFLAGS}" = "x" \
-     -a "x${FAAC_LDFLAGS}" = "x" \
-     -a "x${AACPLUS_LDFLAGS}" = "x" \
-     -a "x${TWOLAME_LDFLAGS}" = "x"; then
-    AC_MSG_ERROR([neither lame, Ogg Vorbis, faac, aac+ nor twolame configured])
+if test -z "x${LAME_LIBS}" \
+     -a -z "${VORBIS_LIBS}" \
+     -a -z "${OPUS_LIBS}" \
+     -a -z "${FAAC_LIBS}" \
+     -a -z "${AACPLUS_LIBS}" \
+     -a -z "${TWOLAME_LIBS}" ; then
+    AC_MSG_ERROR([neither lame, Ogg Vorbis, opus, faac, aac+ nor twolame configured])
 fi
 
 
 dnl-----------------------------------------------------------------------------
 dnl link ALSA sound system if requested 
 dnl-----------------------------------------------------------------------------
-AC_SUBST(ALSA_INCFLAGS)
-AC_SUBST(ALSA_LDFLAGS)
-
 AC_ARG_WITH(alsa,
-[  --with-alsa             use ALSA sound system [yes] ],
-    USE_ALSA=${withval}, USE_ALSA="yes" )
-AC_ARG_WITH(alsa-prefix,
-[  --with-alsa-prefix=DIR      alternate location for ALSA [/usr]
-                              look for libraries in ALSA-PREFIX/lib,
-                              for headers in ALSA-PREFIX/include],
-    CONFIG_ALSA_PREFIX="${withval}", CONFIG_ALSA_PREFIX="/usr")
-
-if test "x${USE_ALSA}" = "xyes" ; then
-    AC_MSG_CHECKING( [for alsa libraries at ${CONFIG_ALSA_PREFIX}] )
-    LA_SEARCH_LIB( ALSA_LIB_LOC, ALSA_INC_LOC, libasound.so, alsa/asoundlib.h,
-                   ${CONFIG_ALSA_PREFIX})
-
-    if test "x${ALSA_LIB_LOC}" != "x" ; then
-
-        AC_DEFINE( HAVE_ALSA_LIB, 1, [build with ALSA sound system] )
-        if test "x${ALSA_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then
-            ALSA_INCFLAGS="-I${ALSA_INC_LOC}"
-        fi
-        ALSA_LDFLAGS="-L${ALSA_LIB_LOC} -lasound"
-        AC_MSG_RESULT( [found at ${CONFIG_ALSA_PREFIX}] )
-    else
-        AC_MSG_WARN( [not found, building without ALSA support])
-    fi
-else
-    AC_MSG_RESULT( [building without ALSA support] )
-fi
-
+    AS_HELP_STRING([--with-alsa], [use ALSA sound system @<:@check@:>@]),
+    [], with_alsa=check)
+AS_CASE([$with_alsa],
+    check, [PKG_CHECK_MODULES(ALSA, alsa, [], true)],
+    yes,   [PKG_CHECK_MODULES(ALSA, alsa)],
+    AC_MSG_RESULT([building without ALSA support]))
+AS_IF(test -n "$ALSA_LIBS",
+    AC_DEFINE(HAVE_ALSA_LIB, 1, [build with ALSA sound system]))
 
 dnl-----------------------------------------------------------------------------
 dnl link PULSEAUDIO sound system if requested 
 dnl-----------------------------------------------------------------------------
-AC_SUBST(PULSEAUDIO_INCFLAGS)
-AC_SUBST(PULSEAUDIO_LDFLAGS)
-
 AC_ARG_WITH(pulseaudio,
-[  --with-pulseaudio             use PULSEAUDIO sound system [yes] ],
-    USE_PULSEAUDIO=${withval}, USE_PULSEAUDIO="yes" )
-AC_ARG_WITH(pulseaudio-prefix,
-[  --with-pulseaudio-prefix=DIR      alternate location for PULSEAUDIO [/usr]
-                              look for libraries in PULSEAUDIO-PREFIX/lib,
-                              for headers in PULSEAUDIO-PREFIX/include],
-    CONFIG_PULSEAUDIO_PREFIX="${withval}", CONFIG_PULSEAUDIO_PREFIX="/usr")
-
-if test "x${USE_PULSEAUDIO}" = "xyes" ; then
-    AC_MSG_CHECKING( [for pulseaudio libraries at ${CONFIG_PULSEAUDIO_PREFIX}] )
-    LA_SEARCH_LIB( PULSEAUDIO_LIB_LOC, PULSEAUDIO_INC_LOC, libpulse.so, pulse/pulseaudio.h,
-                   ${CONFIG_PULSEAUDIO_PREFIX})
-
-    if test "x${PULSEAUDIO_LIB_LOC}" != "x" ; then
-
-        AC_DEFINE( HAVE_PULSEAUDIO_LIB, 1, [build with PULSEAUDIO sound system] )
-        if test "x${PULSEAUDIO_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then
-            PULSEAUDIO_INCFLAGS="-I${PULSEAUDIO_INC_LOC}"
-        fi
-        PULSEAUDIO_LDFLAGS="-L${PULSEAUDIO_LIB_LOC} -lpulse-simple -L${PULSEAUDIO_LIB_LOC} -lpulse"
-        AC_MSG_RESULT( [found at ${CONFIG_PULSEAUDIO_PREFIX}] )
-    else
-        AC_MSG_WARN( [not found, building without PULSEAUDIO support])
-    fi
-else
-    AC_MSG_RESULT( [building without PULSEAUDIO support] )
-fi
-
+    AS_HELP_STRING([--with-pulseaudio], [use PULSEAUDIO sound system @<:@check@:>@]),
+    [], with_pulseaudio=check)
+AS_CASE([$with_pulseaudio],
+    check, [PKG_CHECK_MODULES(PULSEAUDIO, libpulse-simple libpulse, [], true)],
+    yes,   [PKG_CHECK_MODULES(PULSEAUDIO, libpulse-simple libpulse)],
+    AC_MSG_RESULT([building without PULSEAUDIO support]))
+AS_IF(test -n "$PULSEAUDIO_LIBS",
+    AC_DEFINE(HAVE_PULSEAUDIO_LIB, 1, [build with PULSEAUDIO sound system]))
 
 dnl-----------------------------------------------------------------------------
 dnl link JACK sound server if requested 
 dnl-----------------------------------------------------------------------------
-AC_SUBST(JACK_CFLAGS)
-AC_SUBST(JACK_LDFLAGS)
-AC_SUBST(JACK_INCFLAGS)
-
 AC_ARG_WITH(jack,
-[  --with-jack             use JACK sound system [yes] ],
-    USE_JACK=${withval}, USE_JACK="yes" )
-AC_ARG_WITH(jack-prefix,
-[  --with-jack-prefix=DIR      alternate location for JACK [/usr]
-                              look for libraries in JACK-PREFIX/lib,
-                              for headers in JACK-PREFIX/include],
-    CONFIG_JACK_PREFIX="${withval}", CONFIG_JACK_PREFIX="/usr")
-
-if test "x${USE_JACK}" = "xyes" ; then
-    AC_MSG_CHECKING( [for jack libraries at ${CONFIG_JACK_PREFIX}] )
-    LA_SEARCH_LIB( JACK_LIB_LOC, JACK_INC_LOC, libjack.la libjack.so libjack.dylib, jack/jack.h,
-                   ${CONFIG_JACK_PREFIX})
-
-    if test "x${JACK_LIB_LOC}" != "x" ; then
-
-        AC_DEFINE( HAVE_JACK_LIB, 1, [build with JACK audio server support] )
-        if test "x${JACK_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then
-            JACK_INCFLAGS="-I${JACK_INC_LOC}"
-        fi
-        JACK_LDFLAGS="-L${JACK_LIB_LOC} -ljack"
-        AC_MSG_RESULT( [found at ${CONFIG_JACK_PREFIX}] )
-    else
-        AC_MSG_WARN( [not found, building without JACK support])
-    fi
-else
-    AC_MSG_RESULT( [building without JACK support] )
-fi
-
+    AS_HELP_STRING([--with-jack], [use JACK sound system @<:@check@:>@]),
+    [], with_jack=check)
+AS_CASE([$with_jack],
+    check, [PKG_CHECK_MODULES(JACK, jack, [], true)],
+    yes,   [PKG_CHECK_MODULES(JACK, jack)],
+    AC_MSG_RESULT([building without JACK support]))
+AS_IF(test -n "$JACK_LIBS",
+    AC_DEFINE(HAVE_JACK_LIB, 1, [build with JACK audio server support]))
 
 dnl-----------------------------------------------------------------------------
 dnl link Secret Rabbit Code (aka libsamplerate) if requested 
 dnl-----------------------------------------------------------------------------
-AC_SUBST(SRC_CFLAGS)
-AC_SUBST(SRC_LDFLAGS)
-AC_SUBST(SRC_INCFLAGS)
-
 AC_ARG_WITH(samplerate,
-[  --with-samplerate             use Secret Rabbit Code (aka libsamplerate) for samplerate conversion [yes] ],
-    USE_SRC=${withval}, USE_SRC="yes" )
-AC_ARG_WITH(samplerate-prefix,
-[  --with-samplerate-prefix=DIR      alternate location for samplerate [/usr]
-                              look for libraries in SRC-PREFIX/lib,
-                              for headers in SRC-PREFIX/include],
-    CONFIG_SRC_PREFIX="${withval}", CONFIG_SRC_PREFIX="/usr")
-
-if test "x${USE_SRC}" = "xyes" ; then
-    AC_MSG_CHECKING( [for samplerate libraries at ${CONFIG_SRC_PREFIX}] )
-    LA_SEARCH_LIB( SRC_LIB_LOC, SRC_INC_LOC, libsamplerate.la libsamplerate.so libsamplerate.dylib, samplerate.h,
-                   ${CONFIG_SRC_PREFIX})
-
-    if test "x${SRC_LIB_LOC}" != "x" ; then
-
-        AC_DEFINE( HAVE_SRC_LIB, 1, [build with samplerate conversion through libsamplerate] )
-        if test "x${SRC_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then
-            SRC_INCFLAGS="-I${SRC_INC_LOC}"
-        fi
-        SRC_LDFLAGS="-L${SRC_LIB_LOC} -lsamplerate"
-        AC_MSG_RESULT( [found at ${CONFIG_SRC_PREFIX}] )
-    else
-        AC_MSG_WARN( [not found, building libsamplerate support])
-    fi
-else
-    AC_MSG_RESULT( [building without libsamplerate support] )
-fi
+    AS_HELP_STRING([--with-samplerate], [use Secret Rabbit Code (aka libsamplerate) for samplerate conversion @<:@check@:>@]),
+    [], with_samplerate=check)
+AS_CASE([$with_samplerate],
+    check, [PKG_CHECK_MODULES(SRC, samplerate, [], true)],
+    yes,   [PKG_CHECK_MODULES(SRC, samplerate)],
+    AC_MSG_RESULT([building without libsamplerate support]))
+AS_IF(test -n "$SRC_LIBS",
+    AC_DEFINE(HAVE_SRC_LIB, 1, [build with samplerate conversion through libsamplerate]))
 
-AM_CONDITIONAL(HAVE_SRC_LIB, test "x${SRC_LIB_LOC}" != "x")
+AM_CONDITIONAL(HAVE_SRC_LIB, test -n "${SRC_LIBS}")
 dnl-----------------------------------------------------------------------------
 dnl check for MSG_NOSIGNAL for the send() function in libsocket
 dnl-----------------------------------------------------------------------------
@@ -440,17 +259,13 @@
 dnl-----------------------------------------------------------------------------
 AC_SUBST(DEBUG_CXXFLAGS)
 
-AC_ARG_WITH(debug,
-[  --with-debug            enable debug mode [no] ],
-    USE_DEBUG=${withval}, USE_DEBUG="no" )
-    
-if test "x${USE_DEBUG}" == "xyes" ; then
-    DEBUG_CXXFLAGS="-g"
-    AC_MSG_RESULT([compiling in debug mode])
-else
-    AC_MSG_RESULT([not compiling in debug mode])
-fi
-
+AC_ARG_ENABLE(debug,
+  AS_HELP_STRING([--enable-debug], [enable debug mode @<:@no@:>@]),
+  [], enable_debug=no)
+AS_IF([test "x$enable_debug" = xyes],
+    [DEBUG_CXXFLAGS="-g"
+     AC_MSG_RESULT([compiling in debug mode])],
+    AC_MSG_RESULT([not compiling in debug mode]))
 
 AC_OUTPUT(Makefile src/Makefile man/Makefile)
 
diff -Nru darkice-1.2/debian/changelog darkice-1.3/debian/changelog
--- darkice-1.2/debian/changelog	2014-06-20 18:16:26.000000000 +0200
+++ darkice-1.3/debian/changelog	2016-08-05 21:58:30.000000000 +0200
@@ -1,3 +1,19 @@
+darkice (1.3-0.1) unstable; urgency=medium
+
+  * Non-maintainer upload. Closes: #833022.
+  * New upstream release. Build-Depend: pkg-config.
+  * Switch copyright file to 1.0 machine-readable format.
+    Fix GPL version: 3+ instead of 2+.
+  * Enable all hardening flags.  Link with --as-needed -z defs.
+  * Explicitly disable aacplus to ensure reproducible builds
+    even if the library is available on the build system.
+  * Standards-Versions: 3.9.8. Explain status of init script in description.
+  * Let architecture.mk from dpkg-dev>=1.16.1 set DEB_HOST_MULTIARCH.
+  * Update homepage, watch file and README.debian (mp3lame is now supported).
+  * Remove redundant files (clean dirs) and configure options (prefix).
+
+ -- Nicolas Boulenguez <nicolas@debian.org>  Fri, 05 Aug 2016 21:42:22 +0200
+
 darkice (1.2-0.2) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru darkice-1.2/debian/clean darkice-1.3/debian/clean
--- darkice-1.2/debian/clean	2009-12-08 12:23:21.000000000 +0100
+++ darkice-1.3/debian/clean	1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-config.guess
-config.sub
diff -Nru darkice-1.2/debian/control darkice-1.3/debian/control
--- darkice-1.2/debian/control	2014-06-19 15:48:45.000000000 +0200
+++ darkice-1.3/debian/control	2016-08-05 22:07:40.000000000 +0200
@@ -2,9 +2,13 @@
 Section: sound
 Priority: optional
 Maintainer: Jochen Friedrich <jochen@scram.de>
-Standards-Version: 3.9.2
+Standards-Version: 3.9.8
 Build-Depends: debhelper (>= 9~), libvorbis-dev, libasound2-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], libjack-dev, libtwolame-dev, dh-autoreconf, libpulse-dev, libsamplerate0-dev, libopus-dev, libmp3lame-dev
-Homepage: http://code.google.com/p/darkice/
+# dpgk-dev provides /usr/share/dpkg/default.mk.
+ ,dpkg-dev (>= 1.16.1),
+# Configure tests rely on pkg-config.
+ ,pkg-config
+Homepage: http://www.darkice.org/
 
 Package: darkice
 Architecture: any
@@ -17,3 +21,8 @@
  ShoutCast servers, the Ogg Vorbis stream to one or more IceCast2
  servers. DarkIce uses lame as a shared object as its mp3 encoder, and
  the Ogg Vorbis as its Ogg Vorbis encoder.
+ .
+ A legacy SYSV init script is provided for existing
+ configurations. You have to set RUN=yes in /etc/default/darkice to
+ run darkice as a daemon. With modern systems, this is not needed as
+ realtime scheduling is available to normal users.
diff -Nru darkice-1.2/debian/copyright darkice-1.3/debian/copyright
--- darkice-1.2/debian/copyright	2009-12-08 17:00:25.000000000 +0100
+++ darkice-1.3/debian/copyright	2016-08-05 21:47:05.000000000 +0200
@@ -1,35 +1,31 @@
-This package was debianized by Maitland Bottoms <bottoms@debian.org> on
-Fri,  2 Aug 2002 16:43:20 -0400.
-
-It is now being maintained by Jochen Friedrich <jochen@scram.de> on
-Wed, 20 Aug 2003 22:55:52 +0200
-
-It was downloaded from http://darkice.sourceforge.net/
- DarkIce is being written by Tyrell Hungary, Ákos Maróy, Rafael Diniz
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: DarkIce
+Upstream-Contact: http://www.freelists.org/list/darkice
+Source: http://www.darkice.org/
 
+Files: *
 Copyright:
-
    Copyright (c) 2000-2007, Tyrell Hungary, http://tyrell.hu/
    Copyright (c) 2008, Ákos Maróy, akos@maroy.hu
-   Copyright (c) 2009, Rafael Diniz, rafael@riseup.net
- 
-   Tyrell DarkIce
- 
-   Copyright notice:
- 
-    This program is free software; you can redistribute it and/or
+   Copyright (c) 2009-2016 Rafael Diniz, rafael@riseup.net
+License: GPL-3+
+
+Files: debian/*
+Copyright: 2001-2002 Maitland Bottoms <bottoms@debian.org>
+           2003-2011 Jochen Friedrich <jochen@scram.de>
+           2016      Nicolas Boulenguez <nicolas@debian.org>
+License: GPL-3+
+
+License: GPL-3+
+    This program is free software: you can redistribute it and/or
     modify it under the terms of the GNU General Public License
-    as published by the Free Software Foundation; either version 2
+    as published by the Free Software Foundation, either version 3
     of the License, or (at your option) any later version.
-    
+    .
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
-                                                                                
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
-    MA 02110-1301, USA.
-
-the GNU GPL may be viewed on Debian systems in /usr/share/common-licenses/GPL
+    .
+    On Debian systems, the full version of the GNU General Public
+    License can be found in /usr/share/common-licenses/GPL-3.
diff -Nru darkice-1.2/debian/dirs darkice-1.3/debian/dirs
--- darkice-1.2/debian/dirs	2009-12-08 12:23:21.000000000 +0100
+++ darkice-1.3/debian/dirs	1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-usr/bin
diff -Nru darkice-1.2/debian/patches/02_errno_range.diff darkice-1.3/debian/patches/02_errno_range.diff
--- darkice-1.2/debian/patches/02_errno_range.diff	2014-06-19 14:58:55.000000000 +0200
+++ darkice-1.3/debian/patches/02_errno_range.diff	1970-01-01 01:00:00.000000000 +0100
@@ -1,25 +0,0 @@
----
- src/Util.cpp |    5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
---- darkice-1.2.orig/src/Util.cpp
-+++ darkice-1.2/src/Util.cpp
-@@ -87,6 +87,9 @@
- #error need signal.h
- #endif
- 
-+#ifdef HAVE_ERRNO_H
-+#include <errno.h>
-+#endif
- 
- #include "Util.h"
- 
-@@ -286,7 +289,7 @@ Util :: strToD( const char    * str )
-     }
- 
-     val = strtod( str, &s);
--    if ( s == str || val == HUGE_VAL ) {
-+    if ( s == str || errno == ERANGE ) {
-         throw Exception( __FILE__, __LINE__, "number conversion error");
-     }
- 
diff -Nru darkice-1.2/debian/patches/03_gcc-43.diff darkice-1.3/debian/patches/03_gcc-43.diff
--- darkice-1.2/debian/patches/03_gcc-43.diff	2014-06-19 14:58:57.000000000 +0200
+++ darkice-1.3/debian/patches/03_gcc-43.diff	1970-01-01 01:00:00.000000000 +0100
@@ -1,15 +0,0 @@
----
- src/JackDspSource.cpp |    2 ++
- 1 file changed, 2 insertions(+)
-
---- darkice-1.2.orig/src/JackDspSource.cpp
-+++ darkice-1.2/src/JackDspSource.cpp
-@@ -82,6 +82,8 @@
- #error need limits.h
- #endif
- 
-+#include <climits>
-+
- #include "Util.h"
- #include "Exception.h"
- #include "JackDspSource.h"
diff -Nru darkice-1.2/debian/patches/04_gcc44.diff darkice-1.3/debian/patches/04_gcc44.diff
--- darkice-1.2/debian/patches/04_gcc44.diff	2014-06-19 14:58:59.000000000 +0200
+++ darkice-1.3/debian/patches/04_gcc44.diff	1970-01-01 01:00:00.000000000 +0100
@@ -1,31 +0,0 @@
----
- src/JackDspSource.cpp |    4 ++++
- src/SerialUlaw.cpp    |    4 ++++
- 2 files changed, 8 insertions(+)
-
---- darkice-1.2.orig/src/SerialUlaw.cpp
-+++ darkice-1.2/src/SerialUlaw.cpp
-@@ -94,6 +94,10 @@
- #error need termios.h
- #endif
- 
-+#ifdef HAVE_STDIO_H
-+#include <stdio.h>
-+#endif
-+
- 
- #include "Util.h"
- #include "Exception.h"
---- darkice-1.2.orig/src/JackDspSource.cpp
-+++ darkice-1.2/src/JackDspSource.cpp
-@@ -82,6 +82,10 @@
- #error need limits.h
- #endif
- 
-+#ifdef HAVE_STDIO_H
-+#include <stdio.h>
-+#endif
-+
- #include <climits>
- 
- #include "Util.h"
diff -Nru darkice-1.2/debian/patches/05_fix_crlf.diff darkice-1.3/debian/patches/05_fix_crlf.diff
--- darkice-1.2/debian/patches/05_fix_crlf.diff	2014-06-19 14:59:00.000000000 +0200
+++ darkice-1.3/debian/patches/05_fix_crlf.diff	1970-01-01 01:00:00.000000000 +0100
@@ -1,15 +0,0 @@
----
- src/IceCast2.cpp |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- darkice-1.2.orig/src/IceCast2.cpp
-+++ darkice-1.2/src/IceCast2.cpp
-@@ -233,7 +233,7 @@ IceCast2 :: sendLogin ( void )
-         sink->write( str, strlen( str));
-     }
- 
--    str = "\n\n";
-+    str = "\r\n\r\n";
-     sink->write( str, strlen( str));
-     sink->flush();
- 
diff -Nru darkice-1.2/debian/patches/06_ftbfs_kfreebsd.patch darkice-1.3/debian/patches/06_ftbfs_kfreebsd.patch
--- darkice-1.2/debian/patches/06_ftbfs_kfreebsd.patch	2014-06-20 18:15:51.000000000 +0200
+++ darkice-1.3/debian/patches/06_ftbfs_kfreebsd.patch	1970-01-01 01:00:00.000000000 +0100
@@ -1,41 +0,0 @@
-Description: Fix FTBFS on kfreebsd.
-Author: Alessio Treglia <alessio@debian.org>
-Forwarded: no
----
- src/OpusLibEncoder.cpp      |    2 ++
- src/OpusLibEncoder.h        |    2 ++
- src/PulseAudioDspSource.cpp |    1 +
- 3 files changed, 5 insertions(+)
-
---- darkice-1.2.orig/src/OpusLibEncoder.cpp
-+++ darkice-1.2/src/OpusLibEncoder.cpp
-@@ -41,6 +41,8 @@
- #include "Util.h"
- #include "OpusLibEncoder.h"
- #include "CastSink.h"
-+#include <cstring>
-+#include <cstdlib>
- 
- 
- /* ===================================================  local data structures */
---- darkice-1.2.orig/src/OpusLibEncoder.h
-+++ darkice-1.2/src/OpusLibEncoder.h
-@@ -59,6 +59,8 @@
- #include "aflibConverter.h"
- #endif
- 
-+#include <stdio.h>
-+#include <cstdlib>
- 
- /* ================================================================ constants */
- 
---- darkice-1.2.orig/src/PulseAudioDspSource.cpp
-+++ darkice-1.2/src/PulseAudioDspSource.cpp
-@@ -35,6 +35,7 @@
- /* ============================================================ include files */
- 
- #include "AudioSource.h"
-+#include <stdio.h>
- 
- // compile only if configured for PULSEAUDIO
- #ifdef SUPPORT_PULSEAUDIO_DSP
diff -Nru darkice-1.2/debian/patches/series darkice-1.3/debian/patches/series
--- darkice-1.2/debian/patches/series	2014-06-20 18:13:31.000000000 +0200
+++ darkice-1.3/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-02_errno_range.diff
-03_gcc-43.diff
-04_gcc44.diff
-05_fix_crlf.diff
-06_ftbfs_kfreebsd.patch
diff -Nru darkice-1.2/debian/README.debian darkice-1.3/debian/README.debian
--- darkice-1.2/debian/README.debian	2009-12-08 12:23:21.000000000 +0100
+++ darkice-1.3/debian/README.debian	2016-07-30 22:33:14.000000000 +0200
@@ -1,12 +1,9 @@
 DarkIce for Debian
 ----------------------
 
-This package was built with Ogg Vorbis support but without mp3 (lame)
-support for patent reasons.
-
 A sample configuration in installed into /usr/share/doc/darkice/examples.
 In order to use DarkIce, please copy this example to your preferred
 configuration directory, make any required changes for your site and reference
 it using darkice -c <config file>.
 
-Jochen Friedrich <jochen@scram.de>, Wed, 20 Aug 2003 21:02:26 +0200
+ -- Nicolas Boulenguez <nicolas@debian.org>, Fri,  1 Jul 2016 23:59:37 +0200
diff -Nru darkice-1.2/debian/rules darkice-1.3/debian/rules
--- darkice-1.2/debian/rules	2014-06-19 17:32:20.000000000 +0200
+++ darkice-1.3/debian/rules	2016-08-05 22:07:25.000000000 +0200
@@ -1,19 +1,30 @@
 #!/usr/bin/make -f
 
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+# Dependency on NSL is not really required on some architectures.
+DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed -Wl,-z,defs
+DEB_BUILD_MAINT_OPTIONS := hardening=+all
+include /usr/share/dpkg/default.mk
 
-%:
+POLICY_TARGETS := binary binary-arch binary-indep build build-arch	\
+build-indep clean
+.PHONY: $(POLICY_TARGETS)
+$(POLICY_TARGETS):
 	dh $@ --with autoreconf
 
+# lame lacks pkg-config support and requires an explicit option.
+
+# vorbis, opus, twolame, alsa, pulseaudio, jack, samplerate are listed
+# in Build-Depends and selected automatically if present.
+
+# faac, aacplus are not in Debian main. Explicitly disable them so
+# that the build does not change if they are installed or removed.
+
+# Trick sysconfdir to install the examples in the right place.
+.PHONY: override_dh_auto_configure
 override_dh_auto_configure:
 	dh_auto_configure -- \
+		$(foreach v,CFLAGS CPPFLAGS CXXFLAGS LDFLAGS,"$(v)=$($(v))") \
 		--with-lame-prefix=/usr/lib/$(DEB_HOST_MULTIARCH) \
-		--with-vorbis-prefix=/usr/lib/$(DEB_HOST_MULTIARCH) \
-		--with-opus-prefix=/usr/lib/$(DEB_HOST_MULTIARCH) \
-		--with-alsa-prefix=/usr/lib/$(DEB_HOST_MULTIARCH) \
-		--with-pulseaudio-prefix=/usr/lib/$(DEB_HOST_MULTIARCH) \
-		--with-samplerate-prefix=/usr/lib/$(DEB_HOST_MULTIARCH) \
-		--with-jack-prefix=/usr/lib/$(DEB_HOST_MULTIARCH) \
-		--prefix=/usr \
 		--sysconfdir=/usr/share/doc/darkice/examples \
+		--without-aacplus \
 		--without-faac
diff -Nru darkice-1.2/debian/watch darkice-1.3/debian/watch
--- darkice-1.2/debian/watch	2014-06-19 14:54:54.000000000 +0200
+++ darkice-1.3/debian/watch	2016-07-30 22:30:25.000000000 +0200
@@ -1,4 +1,6 @@
-version=3
-opts=uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|b|a)[\-\.]?\d*)$/$1~$2/,\
-downloadurlmangle=s%.*/([^/]*)/downloads/detail\?name=([^=&]*).*%http://$1.googlecode.com/files/$2%,filenamemangle=s/.*name=([^&]+).*/$1/ \
-http://code.google.com/p/darkice/downloads/list?can=1 .*=darkice-(\d.*)\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz)|zip).*
+version=4
+
+# qa.debian.org runs a redirector which allows a simpler form of URL
+# for SourceForge based projects. The format below will automatically
+# be rewritten to use the redirector.
+http://sf.net/darkice/darkice@ANY_VERSION@@ARCHIVE_EXT@
diff -Nru darkice-1.2/man/darkice.cfg.5 darkice-1.3/man/darkice.cfg.5
--- darkice-1.2/man/darkice.cfg.5	2013-07-15 07:50:01.000000000 +0200
+++ darkice-1.3/man/darkice.cfg.5	2016-08-03 22:18:36.000000000 +0200
@@ -175,7 +175,7 @@
 Genre of the stream
 .TP
 .I public
-"yes" or "no", wether the stream is public
+"yes" or "no", whether the stream is public
 .TP
 .I remoteDumpFile 
 The file the
@@ -189,7 +189,7 @@
 server to this local file.
 .TP
 .I fileAddDate
-"yes" or "no" if you want to automaticaly insert a date string in 
+"yes" or "no" if you want to automatically insert a date string in 
 the localDumpFile name before its extension or at the end of file name if
 no extension present
 .TP
@@ -302,7 +302,7 @@
 Genre of the stream
 .TP
 .I public
-"yes" or "no", wether the stream is public
+"yes" or "no", whether the stream is public
 .TP
 .I localDumpFile
 Dump the same Ogg Vorbis data sent to the
@@ -310,7 +310,7 @@
 server to this local file.
 .TP
 .I fileAddDate
-"yes" or "no" if you want to automaticaly insert a date string in 
+"yes" or "no" if you want to automatically insert a date string in 
 the localDumpFile name before its extension or at the end of file name if
 no extension present
 .TP
@@ -403,7 +403,7 @@
 Genre of the stream
 .TP
 .I public
-"yes" or "no", wether the stream is public
+"yes" or "no", whether the stream is public
 .TP
 .I irc
 IRC information related to the stream
@@ -432,7 +432,7 @@
 server to this local file.
 .TP
 .I fileAddDate
-"yes" or "no" if you want to automaticaly insert a date string in 
+"yes" or "no" if you want to automatically insert a date string in 
 the localDumpFile name before its extension or at the end of file name if
 no extension present
 .TP
diff -Nru darkice-1.2/README darkice-1.3/README
--- darkice-1.2/README	2013-07-15 07:50:01.000000000 +0200
+++ darkice-1.3/README	2015-05-18 19:39:08.000000000 +0200
@@ -1,4 +1,4 @@
-DarkIce live audio streamer, http://code.google.com/p/darkice/
+DarkIce live audio streamer, http://www.darkice.org/
 Copyright (c) 2000-2007, Tyrell Hungary, http://tyrell.hu/
 Copyright (c) 2008, Ákos Maróy, akos@maroy.hu
 Copyright (c) 2009, Rafael Diniz, rafael@riseup.net
@@ -20,7 +20,7 @@
 and sends the mp3 stream to one or more IceCast and/or ShoutCast servers,
 the Ogg Vorbis stream to one or more IceCast2 servers.
 
-DarkIce website: http://code.google.com/p/darkice/
+DarkIce website: http://www.darkice.org/
 
 
 2. Compiling and installing
@@ -48,7 +48,7 @@
 
 When DarkIce core dumps, please send the backtrace along with your error
 report to the darkice mailing list: http://www.freelists.org/list/darkice
-Alternatively you could file a bug report at http://code.google.com/p/darkice/issues/list
+Alternatively you could file a bug report at http://www.darkice.org/
 To get the backtrace information, you need gdb, the GNU debugger:
 
 1. configure and compile using the --with-debug option:
diff -Nru darkice-1.2/src/aacPlusEncoder.cpp darkice-1.3/src/aacPlusEncoder.cpp
--- darkice-1.2/src/aacPlusEncoder.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/aacPlusEncoder.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : aacPlusEncoder.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/aacPlusEncoder.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
 
    Copyright notice:
 
@@ -51,7 +51,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: aacPlusEncoder.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
@@ -114,7 +114,7 @@
 #else
         converter->initialize( resampleRatio, getInChannel());
         //needed 2x(converted input samples) to handle offsets
-	int outCount                 = 2 * getInChannel() * (inputSamples + 1);
+    int outCount                 = 2 * getInChannel() * (inputSamples + 1);
         if (resampleRatio > 1)
         outCount = (int) (outCount * resampleRatio);
         resampledOffset = new short int[outCount];
@@ -152,7 +152,6 @@
     int             processedSamples = 0;
 
 
-
     if ( converter ) {
         unsigned int         converted;
 #ifdef HAVE_SRC_LIB
@@ -178,25 +177,29 @@
 
         // encode samples (if enough)
         while(resampledOffsetSize - processedSamples >= inputSamples/channels) {
-            int outputBytes;
 #ifdef HAVE_SRC_LIB
             short *shortData = new short[inputSamples];
             src_float_to_short_array(resampledOffset + (processedSamples * channels),
                                      shortData, inputSamples) ;
-            outputBytes = aacplusEncEncode(encoderHandle,
+            int outputBytes = aacplusEncEncode(encoderHandle,
                                        (int32_t*) shortData,
                                         inputSamples,
                                         aacplusBuf,
                                         maxOutputBytes);
             delete [] shortData;
 #else
-            outputBytes = aacplusEncEncode(encoderHandle,
+            int outputBytes = aacplusEncEncode(encoderHandle,
                                        (int32_t*) &resampledOffset[processedSamples*channels],
                                         inputSamples,
                                         aacplusBuf,
                                         maxOutputBytes);
 #endif
-            getSink()->write(aacplusBuf, outputBytes);
+            unsigned int wrote = getSink()->write(aacplusBuf, outputBytes);
+            
+            if (wrote < outputBytes) {
+                reportEvent(3, "aacPlusEncoder :: write, couldn't write full data to underlying sink");
+            }
+
             processedSamples+=inputSamples/channels;
         }
 
@@ -214,18 +217,22 @@
         }
     } else {
         while (processedSamples < samples) {
-            int     outputBytes;
             int     inSamples = samples - processedSamples < (int) inputSamples
                               ? samples - processedSamples
                               : inputSamples;
 
-            outputBytes = aacplusEncEncode(encoderHandle,
+            int outputBytes = aacplusEncEncode(encoderHandle,
                                        (int32_t*) (b + processedSamples/sampleSize),
                                         inSamples,
                                         aacplusBuf,
                                         maxOutputBytes);
-            getSink()->write(aacplusBuf, outputBytes);
-
+            
+            unsigned int wrote = getSink()->write(aacplusBuf, outputBytes);
+            
+            if (wrote < outputBytes) {
+                reportEvent(3, "aacPlusEncoder :: write, couldn't write full data to underlying sink");
+            }
+            
             processedSamples += inSamples;
         }
     }
diff -Nru darkice-1.2/src/aacPlusEncoder.h darkice-1.3/src/aacPlusEncoder.h
--- darkice-1.2/src/aacPlusEncoder.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/aacPlusEncoder.h	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : aacPlusEncoder.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/aacPlusEncoder.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -72,8 +72,8 @@
 /**
  *  A class representing aacplus AAC+ encoder.
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 
 class aacPlusEncoder : public AudioEncoder, public virtual Reporter
@@ -401,7 +401,7 @@
         }
 
         /**
-         *  Check wether encoding is in progress.
+         *  Check whether encoding is in progress.
          *
          *  @return true if encoding is in progress, false otherwise.
          */
diff -Nru darkice-1.2/src/AlsaDspSource.cpp darkice-1.3/src/AlsaDspSource.cpp
--- darkice-1.2/src/AlsaDspSource.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/AlsaDspSource.cpp	2016-08-03 22:18:36.000000000 +0200
@@ -10,9 +10,9 @@
    Tyrell DarkIce
 
    File     : AlsaDspSource.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/AlsaDspSource.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -56,7 +56,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: AlsaDspSource.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
@@ -210,7 +210,7 @@
 
 
 /*------------------------------------------------------------------------------
- *  Check wether read() would return anything
+ *  Check whether read() would return anything
  *----------------------------------------------------------------------------*/
 bool
 AlsaDspSource :: canRead ( unsigned int    sec,
@@ -255,7 +255,7 @@
 
         // Check for buffer overrun
         if (ret == -EPIPE) {
-            reportEvent(1, "Buffer overrun!");
+            reportEvent(1, "AlsaDspSource :: Buffer overrun!");
             snd_pcm_prepare(captureHandle);
             ret = -EAGAIN;
         }
diff -Nru darkice-1.2/src/AlsaDspSource.h darkice-1.3/src/AlsaDspSource.h
--- darkice-1.2/src/AlsaDspSource.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/AlsaDspSource.h	2015-05-18 19:38:07.000000000 +0200
@@ -10,9 +10,9 @@
    Tyrell DarkIce
 
    File     : AlsaDspSource.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/AlsaDspSource.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -66,8 +66,8 @@
 /**
  *  An audio input based on the ALSA sound system 
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class AlsaDspSource : public AudioSource, public virtual Reporter
 {
diff -Nru darkice-1.2/src/AudioEncoder.h darkice-1.3/src/AudioEncoder.h
--- darkice-1.2/src/AudioEncoder.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/AudioEncoder.h	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : AudioEncoder.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/AudioEncoder.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -52,8 +52,8 @@
 /**
  *  An audio encoder
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class AudioEncoder : public Sink, public virtual Referable
 {
@@ -441,7 +441,7 @@
         }
 
         /**
-         *  Check wether encoding is in progress.
+         *  Check whether encoding is in progress.
          *
          *  @return true if encoding is in progress, false otherwise.
          */
diff -Nru darkice-1.2/src/AudioSource.cpp darkice-1.3/src/AudioSource.cpp
--- darkice-1.2/src/AudioSource.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/AudioSource.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : AudioSource.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/AudioSource.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -46,7 +46,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: AudioSource.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
diff -Nru darkice-1.2/src/AudioSource.h darkice-1.3/src/AudioSource.h
--- darkice-1.2/src/AudioSource.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/AudioSource.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : AudioSource.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/AudioSource.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -96,8 +96,8 @@
 /**
  *  Audio data input
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class AudioSource : public Source, public virtual Reporter
 {
diff -Nru darkice-1.2/src/BufferedSink.cpp darkice-1.3/src/BufferedSink.cpp
--- darkice-1.2/src/BufferedSink.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/BufferedSink.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : BufferedSink.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/BufferedSink.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
      the buffer is filled like this:
      
@@ -68,7 +68,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: BufferedSink.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
@@ -99,6 +99,8 @@
     this->bufferEnd    = buffer + bufferSize;
     this->inp          = buffer;
     this->outp         = buffer;
+    this->bOpen        = true;
+    this->openAttempts = 0; 
 }
 
 
@@ -112,6 +114,8 @@
 
     this->peak         = buffer.peak;
     this->misalignment = buffer.misalignment;
+    this->bOpen        = buffer.bOpen;
+    this->openAttempts = buffer.openAttempts; 
     memcpy( this->buffer, buffer.buffer, this->bufferSize);
 }
 
@@ -145,6 +149,8 @@
         
         this->peak         = buffer.peak;
         this->misalignment = buffer.misalignment;
+        this->bOpen        = buffer.bOpen;
+        this->openAttempts = buffer.openAttempts;
         memcpy( this->buffer, buffer.buffer, this->bufferSize);
     }
 
@@ -177,6 +183,16 @@
         return 0;
     }
 
+    unsigned int remaining = this->bufferSize - ( outp <= inp ? inp - outp : 
+                             (bufferEnd - outp) + (inp - this->buffer) );
+
+    // react only to the first overrun whenever there is a series of overruns
+    if ( remaining + chunkSize <= bufferSize && remaining > chunkSize  ) {
+        reportEvent(3,"BufferedSink :: store, buffer overrun");
+        throw Exception( __FILE__, __LINE__,
+                         "buffer overrun");
+    }
+
     oldInp = inp;
     buf    = (const unsigned char *) buffer;
     
@@ -257,8 +273,8 @@
 BufferedSink :: write (    const void    * buf,
                            unsigned int    len )       throw ( Exception )
 {
-    unsigned int    length;
-    unsigned int    soFar;
+    unsigned int    length = 0;
+    unsigned int    soFar = 0;
     unsigned char * b = (unsigned char *) buf;
 
     if ( !buf ) {
@@ -272,6 +288,28 @@
     if ( !align() ) {
         return 0;
     }
+    
+    if ( !sink->isOpen() && openAttempts < 10 ) {
+        // try to reopen underlying sink, because it has closed on its own
+        openAttempts++;
+        try {
+            if( sink->open() ) {
+                // if reopening succeeds, reset open attempts
+                openAttempts = 0;
+            }
+        } catch ( Exception &e ) {
+            reportEvent( 4,"BufferedSink :: write,",
+                         "couldn't reopen underlying sink, attempt",
+                         openAttempts, "/ 10" );
+        }
+        
+        if( openAttempts == 10 ) {
+            // all the attempts have been used, give up
+            close();
+            throw Exception( __FILE__, __LINE__,
+                             "reopen failed");
+        }
+    }
 
     // make it a multiple of chunkSize
     len -= len % chunkSize;
@@ -286,12 +324,24 @@
             // try to write the outp -> bufferEnd
             // the rest will be written in the next if
 
-            size    = bufferEnd - outp - 1;
+            size    = bufferEnd - outp;
             size   -= size % chunkSize;
+            if( size > len * 2 ) {
+                // do not try to send the content of the entire buffer at once,
+                // but limit sending to a multiple of len
+                // this prevents a surge of data to underlying buffer
+                // which is important especially during a lot of packet loss
+                size = len * 2;
+            }
             soFar   = 0;
 
             while ( outp > inp && soFar < size && sink->canWrite( 0, 0) ) {
-                length  = sink->write( outp + soFar, size - soFar);
+                try {
+                    length  = sink->write( outp + soFar, size - soFar);
+                } catch (Exception &e) {
+                    length = 0;
+                    reportEvent(3,"Exception caught in BufferedSink :: write1");
+                }
                 outp    = slidePointer( outp, length);
                 soFar  += length;
             }
@@ -305,10 +355,19 @@
             // this part will write the rest
 
             size    = inp - outp;
+            if( size > len * 2 ) {
+                // prevent a surge of data to underlying buffer
+                size = len * 2;
+            }
             soFar   = 0;
 
             while ( soFar < size && sink->canWrite( 0, 0) ) {
-                length  = sink->write( outp + soFar, size - soFar);
+                try {
+                    length  = sink->write( outp + soFar, size - soFar);
+                } catch (Exception &e) {
+                    length = 0;
+                    reportEvent(3,"Exception caught in BufferedSink :: write2" );
+                }
                 outp    = slidePointer( outp, length);
                 soFar  += length;
             }
@@ -332,13 +391,12 @@
     soFar = 0;
     if ( inp == outp ) { 
         while ( soFar < len && sink->canWrite( 0, 0) ) {
-	    try {
-	        soFar += sink->write( b + soFar, len - soFar);
-	    } catch (Exception &e) {
-	        reportEvent(3,"Exception caught in BufferedSink :: write3\n");
-		throw; /* up a level */
-	    }
-	}
+            try {
+                soFar += sink->write( b + soFar, len - soFar);
+            } catch (Exception &e) {
+                reportEvent(3,"Exception caught in BufferedSink :: write3");
+            }
+        }
     }
     length = soFar;
 
@@ -351,6 +409,8 @@
         store( b + length, len - length);
     }
 
+    updatePeak();
+
     // tell them we ate everything up to chunkSize alignment
     return len;
 }
@@ -369,5 +429,6 @@
     flush();
     sink->close();
     inp = outp = buffer;
+    bOpen = false;
 }
 
diff -Nru darkice-1.2/src/BufferedSink.h darkice-1.3/src/BufferedSink.h
--- darkice-1.2/src/BufferedSink.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/BufferedSink.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : BufferedSink.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/BufferedSink.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -55,8 +55,8 @@
  *  data contained if needed.
  *  The class is not thread-safe.
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class BufferedSink : public Sink, public virtual Reporter
 {
@@ -109,6 +109,17 @@
          *  The underlying Sink.
          */
         Ref<Sink>           sink;
+        
+        /**
+         *  Is BufferedSink open.
+         */
+        bool               bOpen;
+         
+         /**
+          * Number of attempts so far to open underlying sink after it has
+          * closed on its own.
+          */
+        unsigned int       openAttempts;  
 
         /**
          *  Initialize the object.
@@ -163,10 +174,17 @@
             unsigned int    u;
 
             u = outp <= inp ? inp - outp : (bufferEnd - outp) + (inp - buffer);
-            if ( peak < u ) {
+            
+            // report new peaks if it is either significantly more severe than
+            // the previously reported peak
+            if ( peak * 2 < u ) {
                 peak = u;
-                reportEvent( 4, "BufferedSink, new peak:", peak);
-                reportEvent( 4, "BufferedSink, remaining:", bufferSize - peak);
+                reportEvent( 4, "BufferedSink, new peak:", peak, " / ", bufferSize);
+            }
+            
+            if ( peak > 0 && u == 0 ) {
+                peak = 0;
+                reportEvent( 4, "BufferedSink, healed:", peak, " / ", bufferSize);
             }
         }
 
@@ -306,7 +324,9 @@
         inline virtual bool
         open ( void )                                   throw ( Exception )
         {
-            return sink->open();
+            bOpen = sink->open();
+            openAttempts = 0;
+            return bOpen;
         }
 
         /**
@@ -317,7 +337,7 @@
         inline virtual bool
         isOpen ( void ) const                           throw ()
         {
-            return sink->isOpen();
+            return bOpen;
         }
 
         /**
diff -Nru darkice-1.2/src/CastSink.cpp darkice-1.3/src/CastSink.cpp
--- darkice-1.2/src/CastSink.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/CastSink.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : CastSink.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/CastSink.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -42,7 +42,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: CastSink.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
diff -Nru darkice-1.2/src/CastSink.h darkice-1.3/src/CastSink.h
--- darkice-1.2/src/CastSink.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/CastSink.h	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : CastSink.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/CastSink.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -56,8 +56,8 @@
  *  This is an abstract class. A subclass should override at least
  *  the sendLogin() function.
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class CastSink : public Sink, public virtual Reporter
 {
@@ -431,7 +431,7 @@
         }
 
         /**
-         *  Get wether this stream is public.
+         *  Get whether this stream is public.
          *
          *  @return true if the stream is public, false otherwise.
          */
diff -Nru darkice-1.2/src/ConfigSection.cpp darkice-1.3/src/ConfigSection.cpp
--- darkice-1.2/src/ConfigSection.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/ConfigSection.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell ConfigSection
 
    File     : ConfigSection.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/ConfigSection.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -49,7 +49,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: ConfigSection.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /*------------------------------------------------------------------------------
diff -Nru darkice-1.2/src/ConfigSection.h darkice-1.3/src/ConfigSection.h
--- darkice-1.2/src/ConfigSection.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/ConfigSection.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell ConfigSection
 
    File     : ConfigSection.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/ConfigSection.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -64,8 +64,8 @@
  *
  *  Knwon problem: you can't use '#' in any part of a key / value pair
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class ConfigSection : public virtual Referable
 {
diff -Nru darkice-1.2/src/Connector.cpp darkice-1.3/src/Connector.cpp
--- darkice-1.2/src/Connector.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/Connector.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : Connector.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Connector.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -41,7 +41,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: Connector.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
diff -Nru darkice-1.2/src/Connector.h darkice-1.3/src/Connector.h
--- darkice-1.2/src/Connector.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/Connector.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : Connector.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Connector.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -54,8 +54,8 @@
 /**
  *  Connects a source to one or more sinks.
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class Connector : public virtual Referable, public virtual Reporter
 {
diff -Nru darkice-1.2/src/DarkIceConfig.cpp darkice-1.3/src/DarkIceConfig.cpp
--- darkice-1.2/src/DarkIceConfig.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/DarkIceConfig.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell Config
 
    File     : DarkIceConfig.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/DarkIceConfig.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -49,7 +49,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: DarkIceConfig.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /*------------------------------------------------------------------------------
diff -Nru darkice-1.2/src/DarkIceConfig.h darkice-1.3/src/DarkIceConfig.h
--- darkice-1.2/src/DarkIceConfig.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/DarkIceConfig.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell Config
 
    File     : DarkIceConfig.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/DarkIceConfig.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -73,8 +73,8 @@
  *
  *  Knwon problem: you can't use '#' in any part of a key / value pair
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class Config : public virtual Referable
 {
diff -Nru darkice-1.2/src/DarkIce.cpp darkice-1.3/src/DarkIce.cpp
--- darkice-1.2/src/DarkIce.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/DarkIce.cpp	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : DarkIce.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/DarkIce.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
 
    Copyright notice:
@@ -113,7 +113,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: DarkIce.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /*------------------------------------------------------------------------------
@@ -262,7 +262,7 @@
         FileSink                  * localDumpFile   = 0;
         bool                        fileAddDate     = false;
         const char                * fileDateFormat  = 0;
-        AudioEncoder              * encoder         = 0;
+        BufferedSink              * audioOut        = 0;
         int                         bufferSize      = 0;
 
         str         = cs->get( "sampleRate");
@@ -384,10 +384,14 @@
                              "unsupported stream format: ", str);
 
         }
+        
+        // augment audio outs with a buffer when used from encoder
+        audioOut = new BufferedSink( audioOuts[u].server.get(), 
+                                                  bufferSize, 1);
 
 #ifdef HAVE_LAME_LIB
         if ( Util::strEq( str, "mp3") ) {
-            encoder = new LameLibEncoder( audioOuts[u].server.get(),
+            audioOuts[u].encoder = new LameLibEncoder( audioOut,
                                           dsp.get(),
                                           bitrateMode,
                                           bitrate,
@@ -400,8 +404,8 @@
 #endif
 #ifdef HAVE_TWOLAME_LIB
         if ( Util::strEq( str, "mp2") ) {
-            encoder = new TwoLameLibEncoder(
-                                            audioOuts[u].server.get(),
+            audioOuts[u].encoder = new TwoLameLibEncoder(
+                                            audioOut,
                                             dsp.get(),
                                             bitrateMode,
                                             bitrate,
@@ -410,7 +414,6 @@
         }
 #endif
 
-        audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
         encConnector->attach( audioOuts[u].encoder.get());
 #endif // HAVE_LAME_LIB || HAVE_TWOLAME_LIB
     }
@@ -467,7 +470,7 @@
         FileSink                  * localDumpFile   = 0;
         bool                        fileAddDate     = false;
         const char                * fileDateFormat  = 0;
-        AudioEncoder              * encoder         = 0;
+        BufferedSink              * audioOut        = 0;
         int                         bufferSize      = 0;
 
         str         = cs->getForSure( "format", " missing in section ", stream);
@@ -597,6 +600,9 @@
                                             isPublic,
                                             localDumpFile);
 
+        audioOut = new BufferedSink( audioOuts[u].server.get(), 
+                                     bufferSize, 1);
+        
         switch ( format ) {
             case IceCast2::mp3:
 #ifndef HAVE_LAME_LIB
@@ -605,8 +611,8 @@
                                  "thus can't create mp3 stream: ",
                                  stream);
 #else
-                encoder = new LameLibEncoder(
-                                             audioOuts[u].server.get(),
+                audioOuts[u].encoder = new LameLibEncoder(
+                                             audioOut,
                                              dsp.get(),
                                              bitrateMode,
                                              bitrate,
@@ -616,8 +622,6 @@
                                              lowpass,
                                              highpass );
 
-                audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
-
 #endif // HAVE_LAME_LIB
                 break;
 
@@ -630,8 +634,8 @@
                                 stream);
 #else
 
-                encoder = new VorbisLibEncoder(
-                                               audioOuts[u].server.get(),
+                audioOuts[u].encoder = new VorbisLibEncoder(
+                                               audioOut,
                                                dsp.get(),
                                                bitrateMode,
                                                bitrate,
@@ -640,7 +644,6 @@
                                                dsp->getChannel(),
                                                maxBitrate);
 
-                audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
 #endif // HAVE_VORBIS_LIB
                 break;
 
@@ -652,8 +655,8 @@
                                 stream);
 #else
 
-                encoder = new OpusLibEncoder(
-                                               audioOuts[u].server.get(),
+                audioOuts[u].encoder = new OpusLibEncoder(
+                                               audioOut,
                                                dsp.get(),
                                                bitrateMode,
                                                bitrate,
@@ -662,7 +665,6 @@
                                                dsp->getChannel(),
                                                maxBitrate);
 
-                audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8);
 #endif // HAVE_OPUS_LIB
                 break;
 
@@ -673,15 +675,14 @@
                                  "thus can't create mp2 stream: ",
                                  stream);
 #else
-                encoder = new TwoLameLibEncoder(
-                                                audioOuts[u].server.get(),
+                audioOuts[u].encoder = new TwoLameLibEncoder(
+                                                audioOut,
                                                 dsp.get(),
                                                 bitrateMode,
                                                 bitrate,
                                                 sampleRate,
                                                 channel );
 
-                audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
 #endif // HAVE_TWOLAME_LIB
                 break;
 
@@ -693,8 +694,8 @@
                                 "thus can't aac stream: ",
                                 stream);
 #else
-                encoder = new FaacEncoder(
-                                          audioOuts[u].server.get(),
+                audioOuts[u].encoder = new FaacEncoder(
+                                          audioOut,
                                           dsp.get(),
                                           bitrateMode,
                                           bitrate,
@@ -702,7 +703,6 @@
                                           sampleRate,
                                           dsp->getChannel());
 
-                audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
 #endif // HAVE_FAAC_LIB
                 break;
 
@@ -713,8 +713,8 @@
                                 "thus can't aacp stream: ",
                                 stream);
 #else
-                encoder = new aacPlusEncoder(
-                                             audioOuts[u].server.get(),
+                audioOuts[u].encoder = new aacPlusEncoder(
+                                             audioOut,
                                              dsp.get(),
                                              bitrateMode,
                                              bitrate,
@@ -722,7 +722,6 @@
                                              sampleRate,
                                              channel );
 
-                audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
 #endif // HAVE_AACPLUS_LIB
                 break;
 
@@ -793,7 +792,7 @@
         FileSink                  * localDumpFile   = 0;
         bool                        fileAddDate     = false;
         const char                * fileDateFormat  = 0;
-        AudioEncoder              * encoder         = 0;
+        BufferedSink              * audioOut        = 0;
         int                         bufferSize      = 0;
 
         str         = cs->get( "sampleRate");
@@ -908,7 +907,9 @@
                                              localDumpFile);
 
 
-        encoder = new LameLibEncoder( audioOuts[u].server.get(),
+        audioOut = new BufferedSink(audioOuts[u].socket.get(), bufferSize, 1);
+        audioOuts[u].encoder = new LameLibEncoder( 
+                                      audioOut,
                                       dsp.get(),
                                       bitrateMode,
                                       bitrate,
@@ -917,7 +918,6 @@
                                       channel,
                                       lowpass,
                                       highpass );
-        audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
 
         encConnector->attach( audioOuts[u].encoder.get());
 #endif // HAVE_LAME_LIB
@@ -1277,7 +1277,7 @@
 
     len = encConnector->transfer( bytes, 4096, 1, 0 );
 
-    reportEvent( 1, len, "bytes transfered to the encoders");
+    reportEvent( 1, len, "bytes transferred to the encoders");
 
     encConnector->close();
 
diff -Nru darkice-1.2/src/DarkIce.h darkice-1.3/src/DarkIce.h
--- darkice-1.2/src/DarkIce.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/DarkIce.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : DarkIce.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/DarkIce.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -72,8 +72,8 @@
 /**
  *  Program main object.
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class DarkIce : public virtual Referable, public virtual Reporter
 {
diff -Nru darkice-1.2/src/Exception.cpp darkice-1.3/src/Exception.cpp
--- darkice-1.2/src/Exception.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/Exception.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : Exception.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Exception.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -51,7 +51,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: Exception.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
diff -Nru darkice-1.2/src/Exception.h darkice-1.3/src/Exception.h
--- darkice-1.2/src/Exception.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/Exception.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : Exception.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Exception.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -59,8 +59,8 @@
  *  throw Exception( __FILE__, __LINE__, "describe the exception", code);
  *  </pre>
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class Exception
 {
diff -Nru darkice-1.2/src/FaacEncoder.cpp darkice-1.3/src/FaacEncoder.cpp
--- darkice-1.2/src/FaacEncoder.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/FaacEncoder.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : FaacEncoder.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/FaacEncoder.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -51,7 +51,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: FaacEncoder.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
diff -Nru darkice-1.2/src/FaacEncoder.h darkice-1.3/src/FaacEncoder.h
--- darkice-1.2/src/FaacEncoder.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/FaacEncoder.h	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : FaacEncoder.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/FaacEncoder.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -70,8 +70,8 @@
 /**
  *  A class representing faac AAC encoder.
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class FaacEncoder : public AudioEncoder, public virtual Reporter
 {
@@ -399,7 +399,7 @@
         }
 
         /**
-         *  Check wether encoding is in progress.
+         *  Check whether encoding is in progress.
          *
          *  @return true if encoding is in progress, false otherwise.
          */
diff -Nru darkice-1.2/src/FileCast.cpp darkice-1.3/src/FileCast.cpp
--- darkice-1.2/src/FileCast.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/FileCast.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : FileCast.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/FileCast.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -61,7 +61,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: FileCast.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
diff -Nru darkice-1.2/src/FileCast.h darkice-1.3/src/FileCast.h
--- darkice-1.2/src/FileCast.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/FileCast.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : FileCast.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/FileCast.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -54,8 +54,8 @@
 /**
  *  Class representing output to a local file.
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class FileCast : public CastSink
 {
diff -Nru darkice-1.2/src/FileSink.cpp darkice-1.3/src/FileSink.cpp
--- darkice-1.2/src/FileSink.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/FileSink.cpp	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : FileSink.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/FileSink.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -106,7 +106,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: FileSink.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
@@ -191,7 +191,7 @@
 
 
 /*------------------------------------------------------------------------------
- *  Check wether a file exists and is regular file
+ *  Check whether a file exists and is regular file
  *----------------------------------------------------------------------------*/
 bool
 FileSink :: exists ( void ) const               throw ()
@@ -250,7 +250,7 @@
 
 
 /*------------------------------------------------------------------------------
- *  Check wether the file can be written to
+ *  Check whether the file can be written to
  *----------------------------------------------------------------------------*/
 bool
 FileSink :: canWrite (     unsigned int    sec,
diff -Nru darkice-1.2/src/FileSink.h darkice-1.3/src/FileSink.h
--- darkice-1.2/src/FileSink.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/FileSink.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : FileSink.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/FileSink.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -51,8 +51,8 @@
 /**
  *  File data output
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class FileSink : public Sink, public virtual Reporter
 {
diff -Nru darkice-1.2/src/IceCast2.cpp darkice-1.3/src/IceCast2.cpp
--- darkice-1.2/src/IceCast2.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/IceCast2.cpp	2016-08-03 22:18:18.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : IceCast2.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/IceCast2.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -67,7 +67,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: IceCast2.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /*------------------------------------------------------------------------------
@@ -233,7 +233,7 @@
         sink->write( str, strlen( str));
     }
 
-    str = "\n\n";
+    str = "\r\n\r\n";
     sink->write( str, strlen( str));
     sink->flush();
 
diff -Nru darkice-1.2/src/IceCast2.h darkice-1.3/src/IceCast2.h
--- darkice-1.2/src/IceCast2.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/IceCast2.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : IceCast2.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/IceCast2.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -53,8 +53,8 @@
  *  Class representing output to an IceCast2 server with
  *  ice login
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class IceCast2 : public CastSink
 {
diff -Nru darkice-1.2/src/IceCast.cpp darkice-1.3/src/IceCast.cpp
--- darkice-1.2/src/IceCast.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/IceCast.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : IceCast.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/IceCast.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -67,7 +67,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: IceCast.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /*------------------------------------------------------------------------------
diff -Nru darkice-1.2/src/IceCast.h darkice-1.3/src/IceCast.h
--- darkice-1.2/src/IceCast.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/IceCast.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : IceCast.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/IceCast.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -53,8 +53,8 @@
  *  Class representing output to an IceCast server with
  *  x-audiocast login
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class IceCast : public CastSink
 {
diff -Nru darkice-1.2/src/JackDspSource.cpp darkice-1.3/src/JackDspSource.cpp
--- darkice-1.2/src/JackDspSource.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/JackDspSource.cpp	2016-08-03 22:18:36.000000000 +0200
@@ -7,9 +7,9 @@
    Tyrell DarkIce
 
    File     : JackDspSource.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/JackDspSource.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -82,6 +82,12 @@
 #error need limits.h
 #endif
 
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+#include <climits>
+
 #include "Util.h"
 #include "Exception.h"
 #include "JackDspSource.h"
@@ -95,7 +101,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: JackDspSource.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
@@ -296,7 +302,7 @@
 
 
 /*------------------------------------------------------------------------------
- *  Check wether read() would return anything
+ *  Check whether read() would return anything
  *----------------------------------------------------------------------------*/
 bool
 JackDspSource :: canRead ( unsigned int   sec,
diff -Nru darkice-1.2/src/JackDspSource.h darkice-1.3/src/JackDspSource.h
--- darkice-1.2/src/JackDspSource.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/JackDspSource.h	2015-05-18 19:38:07.000000000 +0200
@@ -7,9 +7,9 @@
    Tyrell DarkIce
 
    File     : JackDspSource.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/JackDspSource.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -61,8 +61,8 @@
 /**
  *  An audio input based on JACK
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class JackDspSource : public AudioSource, public virtual Reporter
 {
diff -Nru darkice-1.2/src/LameLibEncoder.cpp darkice-1.3/src/LameLibEncoder.cpp
--- darkice-1.2/src/LameLibEncoder.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/LameLibEncoder.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : LameLibEncoder.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/LameLibEncoder.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -51,7 +51,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: LameLibEncoder.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
diff -Nru darkice-1.2/src/LameLibEncoder.h darkice-1.3/src/LameLibEncoder.h
--- darkice-1.2/src/LameLibEncoder.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/LameLibEncoder.h	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : LameLibEncoder.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/LameLibEncoder.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -66,8 +66,8 @@
  *  A class representing the lame encoder linked as a shared object or as
  *  a static library.
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class LameLibEncoder : public AudioEncoder, public virtual Reporter
 {
@@ -320,7 +320,7 @@
         }
 
         /**
-         *  Check wether encoding is in progress.
+         *  Check whether encoding is in progress.
          *
          *  @return true if encoding is in progress, false otherwise.
          */
diff -Nru darkice-1.2/src/main.cpp darkice-1.3/src/main.cpp
--- darkice-1.2/src/main.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/main.cpp	2015-05-18 19:38:08.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : main.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/main.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Abstract : 
 
@@ -71,7 +71,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: main.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 /*------------------------------------------------------------------------------
  *  Default config file name
diff -Nru darkice-1.2/src/Makefile.am darkice-1.3/src/Makefile.am
--- darkice-1.2/src/Makefile.am	2013-07-15 07:50:01.000000000 +0200
+++ darkice-1.3/src/Makefile.am	2016-08-04 15:31:18.000000000 +0200
@@ -1,10 +1,32 @@
 bin_PROGRAMS = darkice
-AM_CXXFLAGS = -O2 -pedantic -Wall @DEBUG_CXXFLAGS@ @PTHREAD_CFLAGS@
-			  @JACK_CFLAGS@ 
-INCLUDES = @LAME_INCFLAGS@ @VORBIS_INCFLAGS@ @OPUS_INCFLAGS@ @FAAC_INCFLAGS@ @AACPLUS_INCFLAGS@ @TWOLAME_INCFLAGS@ \
-		@ALSA_INCFLAGS@ @PULSEAUDIO_INCFLAGS@ @JACK_INCFLAGS@ @SRC_INCFLAGS@
-LDADD = @PTHREAD_LIBS@ @LAME_LDFLAGS@ @VORBIS_LDFLAGS@ @OPUS_LDFLAGS@ @FAAC_LDFLAGS@ @AACPLUS_LDFLAGS@ @TWOLAME_LDFLAGS@ \
-		@ALSA_LDFLAGS@ @PULSEAUDIO_LDFLAGS@ @JACK_LDFLAGS@ @SRC_LDFLAGS@
+
+darkice_CXXFLAGS = \
+ -O2 -pedantic -Wall \
+ $(DEBUG_CXXFLAGS) \
+ $(PTHREAD_CFLAGS) \
+ $(LAME_CFLAGS) \
+ $(VORBIS_CFLAGS) \
+ $(OPUS_CFLAGS) \
+ $(FAAC_CFLAGS) \
+ $(AACPLUS_CFLAGS) \
+ $(TWOLAME_CFLAGS) \
+ $(ALSA_CFLAGS) \
+ $(PULSEAUDIO_CFLAGS) \
+ $(JACK_CFLAGS) \
+ $(SRC_CFLAGS)
+
+darkice_LDADD = \
+ $(PTHREAD_LIBS) \
+ $(LAME_LIBS) \
+ $(VORBIS_LIBS) \
+ $(OPUS_LIBS) \
+ $(FAAC_LIBS) \
+ $(AACPLUS_LIBS) \
+ $(TWOLAME_LIBS) \
+ $(ALSA_LIBS) \
+ $(PULSEAUDIO_LIBS) \
+ $(JACK_LIBS) \
+ $(SRC_LIBS)
 
 if HAVE_SRC_LIB
 AFLIB_SOURCE = 
diff -Nru darkice-1.2/src/MultiThreadedConnector.cpp darkice-1.3/src/MultiThreadedConnector.cpp
--- darkice-1.2/src/MultiThreadedConnector.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/MultiThreadedConnector.cpp	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : MultiThreadedConnector.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/MultiThreadedConnector.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -53,7 +53,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: MultiThreadedConnector.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
@@ -229,7 +229,7 @@
     dataBuffer   = new unsigned char[bufSize];
     dataSize     = 0;
 
-    reportEvent( 6, "MultiThreadedConnector :: tranfer, bytes", bytes);
+    reportEvent( 6, "MultiThreadedConnector :: transfer, bytes", bytes);
 
     for ( b = 0; !bytes || b < bytes; ) {
         if ( source->canRead( sec, usec) ) {
diff -Nru darkice-1.2/src/MultiThreadedConnector.h darkice-1.3/src/MultiThreadedConnector.h
--- darkice-1.2/src/MultiThreadedConnector.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/MultiThreadedConnector.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : MultiThreadedConnector.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/MultiThreadedConnector.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -68,8 +68,8 @@
  *  Connects a source to one or more sinks, using a multi-threaded
  *  producer - consumer approach.
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class MultiThreadedConnector : public virtual Connector
 {
diff -Nru darkice-1.2/src/OpusLibEncoder.cpp darkice-1.3/src/OpusLibEncoder.cpp
--- darkice-1.2/src/OpusLibEncoder.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/OpusLibEncoder.cpp	2016-08-03 22:18:23.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : OpusLibEncoder.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/OpusLibEncoder.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
 
    Copyright notice:
 
@@ -36,11 +36,16 @@
 // compile only if configured for Ogg / Opus
 #ifdef HAVE_OPUS_LIB
 
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
 
 #include "Exception.h"
 #include "Util.h"
 #include "OpusLibEncoder.h"
 #include "CastSink.h"
+#include <cstring>
+#include <cstdlib>
 
 
 /* ===================================================  local data structures */
@@ -51,7 +56,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: OpusLibEncoder.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
@@ -474,10 +479,10 @@
 
     int opusBufferSize = (1275*3+7)*getOutChannel();
     unsigned char * opusBuffer = new unsigned char[opusBufferSize];
-    short int * shortBuffer = new short int[480];
+    short int * shortBuffer = new short int[480*getInChannel()];
 
     // Send an empty audio packet along to flush out the stream.
-    memset( shortBuffer, 0, 480);
+    memset( shortBuffer, 0, 480*getInChannel()*sizeof(*shortBuffer));
     memset( opusBuffer, 0, opusBufferSize);
     int encBytes = opus_encode( opusEncoder, shortBuffer, 480, opusBuffer, opusBufferSize);
     if( encBytes == -1 ) {
diff -Nru darkice-1.2/src/OpusLibEncoder.h darkice-1.3/src/OpusLibEncoder.h
--- darkice-1.2/src/OpusLibEncoder.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/OpusLibEncoder.h	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : OpusLibEncoder.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/OpusLibEncoder.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
 
    Copyright notice:
 
@@ -40,6 +40,8 @@
 #include "config.h"
 #endif
 
+#include <stdlib.h>
+
 #ifdef HAVE_OPUS_LIB
 #include <opus/opus.h>
 #include <ogg/ogg.h>
@@ -52,13 +54,15 @@
 #include "Exception.h"
 #include "Reporter.h"
 #include "AudioEncoder.h"
-#include "CastSink.h"
+#include "Sink.h"
 #ifdef HAVE_SRC_LIB
 #include <samplerate.h>
 #else
 #include "aflibConverter.h"
 #endif
 
+#include <stdio.h>
+#include <cstdlib>
 
 /* ================================================================ constants */
 
@@ -72,8 +76,8 @@
  *  A struct for containing the ogg opus header format, sent at the stream
  *  beginning.
  *
- *  @author $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author $Author$
+ *  @version $Revision$
  */
 struct OpusIdHeader {
     char magic[8];              /* "OpusHead" */
@@ -119,16 +123,16 @@
 /**
  *  A struct for containing the ogg opus comment header format
  *
- *  @author $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author $Author$
+ *  @version $Revision$
  */
 struct OpusCommentHeader {
     /**
      * Struct for each tag pair, in the form of a UTF-8
      * string, "TAG=value"
      *
-     * @author $Author: rafael@riseup.net $
-     * @version $Revision: 553 $
+     * @author $Author$
+     * @version $Revision$
      */
     struct Tags {
         unsigned int tag_len;   /* For each tag, how long the following tag is */
@@ -189,8 +193,8 @@
  *  A class representing the ogg opus encoder linked as a shared object or
  *  as a static library.
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class OpusLibEncoder : public AudioEncoder, public virtual Reporter
 {
@@ -311,7 +315,7 @@
          *  @exception Exception
          */
         inline
-        OpusLibEncoder (  CastSink      * sink,
+        OpusLibEncoder (  Sink      * sink,
                             unsigned int    inSampleRate,
                             unsigned int    inBitsPerSample,
                             unsigned int    inChannel,
@@ -356,7 +360,7 @@
          *  @exception Exception
          */
         inline
-        OpusLibEncoder (  CastSink              * sink,
+        OpusLibEncoder (    Sink                  * sink,
                             const AudioSource     * as,
                             BitrateMode             outBitrateMode,
                             unsigned int            outBitrate,
@@ -443,7 +447,7 @@
         }
 
         /**
-         *  Check wether encoding is in progress.
+         *  Check whether encoding is in progress.
          *
          *  @return true if encoding is in progress, false otherwise.
          */
diff -Nru darkice-1.2/src/OssDspSource.cpp darkice-1.3/src/OssDspSource.cpp
--- darkice-1.2/src/OssDspSource.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/OssDspSource.cpp	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : OssDspSource.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/OssDspSource.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -106,7 +106,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: OssDspSource.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 /*------------------------------------------------------------------------------
  *  Define the natural endiannes of 16 bit recording if not defined,
@@ -229,7 +229,7 @@
 
 
 /*------------------------------------------------------------------------------
- *  Check wether read() would return anything
+ *  Check whether read() would return anything
  *----------------------------------------------------------------------------*/
 bool
 OssDspSource :: canRead ( unsigned int    sec,
diff -Nru darkice-1.2/src/OssDspSource.h darkice-1.3/src/OssDspSource.h
--- darkice-1.2/src/OssDspSource.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/OssDspSource.h	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : OssDspSource.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/OssDspSource.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -51,8 +51,8 @@
 /**
  *  An audio input based on /dev/dsp-like raw devices
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class OssDspSource : public AudioSource, public virtual Reporter
 {
@@ -69,7 +69,7 @@
         int         fileDescriptor;
 
         /**
-         *  Indicates wether the low-level OSS DSP device is in a recording
+         *  Indicates whether the low-level OSS DSP device is in a recording
          *  state.
          */
         bool        running;
diff -Nru darkice-1.2/src/PulseAudioDspSource.cpp darkice-1.3/src/PulseAudioDspSource.cpp
--- darkice-1.2/src/PulseAudioDspSource.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/PulseAudioDspSource.cpp	2016-08-03 22:18:36.000000000 +0200
@@ -10,9 +10,9 @@
    Tyrell DarkIce
 
    File     : PulseAudioDspSource.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/PulseAudioDspSource.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -35,6 +35,7 @@
 /* ============================================================ include files */
 
 #include "AudioSource.h"
+#include <stdio.h>
 
 // compile only if configured for PULSEAUDIO
 #ifdef SUPPORT_PULSEAUDIO_DSP
@@ -56,7 +57,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: PulseAudioDspSource.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
@@ -172,7 +173,7 @@
 
 
 /*------------------------------------------------------------------------------
- *  Check wether read() would return anything
+ *  Check whether read() would return anything
  *----------------------------------------------------------------------------*/
 bool
 PulseAudioDspSource :: canRead ( unsigned int    sec,
diff -Nru darkice-1.2/src/PulseAudioDspSource.h darkice-1.3/src/PulseAudioDspSource.h
--- darkice-1.2/src/PulseAudioDspSource.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/PulseAudioDspSource.h	2015-05-18 19:38:07.000000000 +0200
@@ -10,9 +10,9 @@
    Tyrell DarkIce
 
    File     : PulseAudioDspSource.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/PulseAudioDspSource.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -65,8 +65,8 @@
 /**
  *  An audio input based on the PULSEAUDIO sound system 
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class PulseAudioDspSource : public AudioSource, public virtual Reporter
 {
@@ -258,9 +258,9 @@
    Tyrell DarkIce
 
    File     : PulseAudioDspSource.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/PulseAudioDspSource.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -313,8 +313,8 @@
 /**
  *  An audio input based on the PULSEAUDIO sound system 
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class PulseAudioDspSource : public AudioSource, public virtual Reporter
 {
diff -Nru darkice-1.2/src/Referable.h darkice-1.3/src/Referable.h
--- darkice-1.2/src/Referable.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/Referable.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : Referable.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Referable.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -62,8 +62,8 @@
  *  
  *  @ref Ref
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class Referable
 {
diff -Nru darkice-1.2/src/Ref.h darkice-1.3/src/Ref.h
--- darkice-1.2/src/Ref.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/Ref.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : Ref.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Ref.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -75,8 +75,8 @@
  *
  *  @ref Referable
  *  
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 template <class T>
 class Ref
diff -Nru darkice-1.2/src/Reporter.cpp darkice-1.3/src/Reporter.cpp
--- darkice-1.2/src/Reporter.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/Reporter.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell Reporter
 
    File     : Reporter.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Reporter.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -42,7 +42,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: Reporter.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /*------------------------------------------------------------------------------
diff -Nru darkice-1.2/src/Reporter.h darkice-1.3/src/Reporter.h
--- darkice-1.2/src/Reporter.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/Reporter.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell Reporter
 
    File     : Reporter.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Reporter.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -77,8 +77,8 @@
  * 
  *  Known problems: this class is not thread-safe.
  * 
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class Reporter
 {
diff -Nru darkice-1.2/src/SerialUlaw.cpp darkice-1.3/src/SerialUlaw.cpp
--- darkice-1.2/src/SerialUlaw.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/SerialUlaw.cpp	2016-08-03 22:18:15.000000000 +0200
@@ -6,8 +6,8 @@
    Tyrell DarkIce
 
    File     : SerialUlaw.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
+   Version  : $Revision$
+   Author   : $Author$
    Location : $Source: /cvsroot/darkice/darkice/src/SerialUlaw.cpp,v $
    
    Copyright notice:
@@ -94,6 +94,10 @@
 #error need termios.h
 #endif
 
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
 
 #include "Util.h"
 #include "Exception.h"
@@ -108,7 +112,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: SerialUlaw.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /*------------------------------------------------------------------------------
diff -Nru darkice-1.2/src/SerialUlaw.h darkice-1.3/src/SerialUlaw.h
--- darkice-1.2/src/SerialUlaw.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/SerialUlaw.h	2016-08-03 22:18:36.000000000 +0200
@@ -6,9 +6,9 @@
    Tyrell DarkIce
 
    File     : SerialUlaw.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/SerialUlaw.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -52,8 +52,8 @@
 /**
  *  An audio input based on /dev/dsp-like raw devices
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class SerialUlaw : public AudioSource, public virtual Reporter
 {
@@ -70,7 +70,7 @@
         int         fileDescriptor;
 
         /**
-         *  Indicates wether the low-level OSS DSP device is in a recording
+         *  Indicates whether the low-level OSS DSP device is in a recording
          *  state.
          */
         bool        running;
diff -Nru darkice-1.2/src/ShoutCast.cpp darkice-1.3/src/ShoutCast.cpp
--- darkice-1.2/src/ShoutCast.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/ShoutCast.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,8 +5,8 @@
    Tyrell DarkIce
 
    File     : ShoutCast.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
+   Version  : $Revision$
+   Author   : $Author$
    Location : $Source$
    
    Copyright notice:
@@ -69,7 +69,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: ShoutCast.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /*------------------------------------------------------------------------------
diff -Nru darkice-1.2/src/ShoutCast.h darkice-1.3/src/ShoutCast.h
--- darkice-1.2/src/ShoutCast.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/ShoutCast.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : ShoutCast.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/ShoutCast.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -53,8 +53,8 @@
  *  Class representing output to a ShoutCast server with
  *  icy login
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class ShoutCast : public CastSink
 {
diff -Nru darkice-1.2/src/Sink.h darkice-1.3/src/Sink.h
--- darkice-1.2/src/Sink.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/Sink.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : Sink.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Sink.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -51,8 +51,8 @@
 /**
  *  A general data sink
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class Sink : public virtual Referable
 {
diff -Nru darkice-1.2/src/SolarisDspSource.cpp darkice-1.3/src/SolarisDspSource.cpp
--- darkice-1.2/src/SolarisDspSource.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/SolarisDspSource.cpp	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : SolarisDspSource.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/SolarisDspSource.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -108,7 +108,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: SolarisDspSource.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
@@ -201,7 +201,7 @@
 
 
 /*------------------------------------------------------------------------------
- *  Check wether read() would return anything
+ *  Check whether read() would return anything
  *----------------------------------------------------------------------------*/
 bool
 SolarisDspSource :: canRead ( unsigned int    sec,
diff -Nru darkice-1.2/src/SolarisDspSource.h darkice-1.3/src/SolarisDspSource.h
--- darkice-1.2/src/SolarisDspSource.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/SolarisDspSource.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : SolarisDspSource.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/SolarisDspSource.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -51,8 +51,8 @@
 /**
  *  An audio input based on Solaris /dev/audio devices
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class SolarisDspSource : public AudioSource, public virtual Reporter
 {
diff -Nru darkice-1.2/src/Source.h darkice-1.3/src/Source.h
--- darkice-1.2/src/Source.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/Source.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : Source.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Source.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -51,8 +51,8 @@
 /**
  *  A general data source
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class Source : public virtual Referable
 {
diff -Nru darkice-1.2/src/TcpSocket.cpp darkice-1.3/src/TcpSocket.cpp
--- darkice-1.2/src/TcpSocket.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/TcpSocket.cpp	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : TcpSocket.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/TcpSocket.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -101,7 +101,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: TcpSocket.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
@@ -256,7 +256,7 @@
 
 
 /*------------------------------------------------------------------------------
- *  Check wether read() would return anything
+ *  Check whether read() would return anything
  *----------------------------------------------------------------------------*/
 bool
 TcpSocket :: canRead (      unsigned int    sec,
@@ -318,9 +318,9 @@
                 break;
 
             default:
-		::close( sockfd);
-		sockfd = 0;
-		throw Exception( __FILE__, __LINE__, "recv error", errno);
+                ::close( sockfd);
+                sockfd = 0;
+                throw Exception( __FILE__, __LINE__, "recv error", errno);
         }
     }
 
@@ -329,7 +329,7 @@
 
 
 /*------------------------------------------------------------------------------
- *  Check wether read() would return anything
+ *  Check whether write() would send anything
  *----------------------------------------------------------------------------*/
 bool
 TcpSocket :: canWrite (    unsigned int    sec,
@@ -357,11 +357,11 @@
     ret = pselect( sockfd + 1, NULL, &fdset, NULL, &timespec, &sigset);
     
     if ( ret == -1 ) {
-	::close( sockfd);
-	sockfd = 0;
-        throw Exception( __FILE__, __LINE__, "select error");
+        ::close( sockfd);
+        sockfd = 0;
+        reportEvent(4,"TcpSocket :: canWrite, connection lost", errno);
     }
-
+  
     return ret > 0;
 }
 
@@ -389,8 +389,9 @@
         if ( errno == EAGAIN ) {
             ret = 0;
         } else {
-	    ::close( sockfd);
-	    sockfd = 0;
+            ::close( sockfd);
+            sockfd = 0;
+            reportEvent(4,"TcpSocket :: write, send error", errno);
             throw Exception( __FILE__, __LINE__, "send error", errno);
         }
     }
diff -Nru darkice-1.2/src/TcpSocket.h darkice-1.3/src/TcpSocket.h
--- darkice-1.2/src/TcpSocket.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/TcpSocket.h	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : TcpSocket.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/TcpSocket.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -52,8 +52,8 @@
 /**
  *  A TCP network socket
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class TcpSocket : public Source, public Sink, public virtual Reporter
 {
diff -Nru darkice-1.2/src/TwoLameLibEncoder.cpp darkice-1.3/src/TwoLameLibEncoder.cpp
--- darkice-1.2/src/TwoLameLibEncoder.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/TwoLameLibEncoder.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : TwoLameLibEncoder.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/TwoLameLibEncoder.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -51,7 +51,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: TwoLameLibEncoder.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
diff -Nru darkice-1.2/src/TwoLameLibEncoder.h darkice-1.3/src/TwoLameLibEncoder.h
--- darkice-1.2/src/TwoLameLibEncoder.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/TwoLameLibEncoder.h	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : TwoLameLibEncoder.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/TwoLameLibEncoder.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -66,8 +66,8 @@
  *  A class representing the TwoLame encoder linked as a shared object or as
  *  a static library.
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class TwoLameLibEncoder : public AudioEncoder, public virtual Reporter
 {
@@ -249,7 +249,7 @@
         }
 
         /**
-         *  Check wether encoding is in progress.
+         *  Check whether encoding is in progress.
          *
          *  @return true if encoding is in progress, false otherwise.
          */
diff -Nru darkice-1.2/src/Util.cpp darkice-1.3/src/Util.cpp
--- darkice-1.2/src/Util.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/Util.cpp	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : Util.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Util.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -87,6 +87,9 @@
 #error need signal.h
 #endif
 
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include "Util.h"
 
@@ -99,7 +102,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: Util.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
@@ -232,7 +235,7 @@
 
 
 /*------------------------------------------------------------------------------
- *  Check wether two strings are equal
+ *  Check whether two strings are equal
  *----------------------------------------------------------------------------*/
 bool
 Util :: strEq( const char    * str1,
@@ -286,7 +289,7 @@
     }
 
     val = strtod( str, &s);
-    if ( s == str || val == HUGE_VAL ) {
+    if ( s == str || errno == ERANGE ) {
         throw Exception( __FILE__, __LINE__, "number conversion error");
     }
 
diff -Nru darkice-1.2/src/Util.h darkice-1.3/src/Util.h
--- darkice-1.2/src/Util.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/Util.h	2016-08-03 22:18:36.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : Util.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Util.h $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -60,8 +60,8 @@
  *  char  * str = Util::strDup( otherStr);
  *  </pre>
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class Util
 {
@@ -169,7 +169,7 @@
         strDup (        const char    * str )       throw ( Exception );
 
         /**
-         *  Determine wether two string are equal.
+         *  Determine whether two string are equal.
          *
          *  @param str1 one of the strings.
          *  @param str2 the other string.
diff -Nru darkice-1.2/src/VorbisLibEncoder.cpp darkice-1.3/src/VorbisLibEncoder.cpp
--- darkice-1.2/src/VorbisLibEncoder.cpp	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/VorbisLibEncoder.cpp	2015-05-18 19:38:07.000000000 +0200
@@ -5,9 +5,9 @@
    Tyrell DarkIce
 
    File     : VorbisLibEncoder.cpp
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/VorbisLibEncoder.cpp $
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
    
    Copyright notice:
 
@@ -40,7 +40,7 @@
 #include "Exception.h"
 #include "Util.h"
 #include "VorbisLibEncoder.h"
-
+#define VORBIS_MIN_BITRATE 45
 
 /* ===================================================  local data structures */
 
@@ -50,7 +50,7 @@
 /*------------------------------------------------------------------------------
  *  File identity
  *----------------------------------------------------------------------------*/
-static const char fileid[] = "$Id: VorbisLibEncoder.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $";
+static const char fileid[] = "$Id$";
 
 
 /* ===============================================  local function prototypes */
@@ -79,6 +79,15 @@
                          getInChannel() );
     }
 
+    if ( getOutBitrateMode() == abr || getOutBitrateMode() == cbr ) {
+        if ( getOutBitrate() < VORBIS_MIN_BITRATE ) {
+            throw Exception( __FILE__, __LINE__,
+                            "output bitrate is lower than libvorbis minimum",
+                            getOutBitrate() );
+        }
+        
+    }
+
     if ( getOutSampleRate() == getInSampleRate() ) {
         resampleRatio = 1;
         converter     = 0;
@@ -291,13 +300,13 @@
             if ( bitsPerSample == 8 ) {
                 char          * buf8 = (char *) buf;
                 unsigned int    ix   = sampleSize * i;
-		unsigned int    iix  = ix;
+                unsigned int    iix  = ix;
                 buf8[i] = (buf8[ix] + buf8[++iix]) / 2;
             }
             if ( bitsPerSample == 16 ) {
                 short         * buf16 = (short *) buf;
                 unsigned int    ix    = (bitsPerSample >> 3) * i;
-		unsigned int    iix   = ix;
+                unsigned int    iix   = ix;
                 buf16[i] = (buf16[ix] + buf16[++iix]) / 2;
             }
         }
@@ -361,6 +370,7 @@
     }
 
     delete[] shortBuffer;
+    
     vorbisBlocksOut();
 
     return processed;
@@ -402,7 +412,7 @@
             ogg_stream_packetin( &oggStreamState, &oggPacket);
 
             while ( ogg_stream_pageout( &oggStreamState, &oggPage) ) {
-                int    written;
+                int    written = 0;
                 
                 written  = getSink()->write(oggPage.header, oggPage.header_len);
                 written += getSink()->write( oggPage.body, oggPage.body_len);
diff -Nru darkice-1.2/src/VorbisLibEncoder.h darkice-1.3/src/VorbisLibEncoder.h
--- darkice-1.2/src/VorbisLibEncoder.h	2013-07-15 07:50:42.000000000 +0200
+++ darkice-1.3/src/VorbisLibEncoder.h	2016-08-03 22:18:36.000000000 +0200
@@ -5,22 +5,22 @@
    Tyrell DarkIce
 
    File     : VorbisLibEncoder.h
-   Version  : $Revision: 553 $
-   Author   : $Author: rafael@riseup.net $
-   Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/VorbisLibEncoder.h $
-   
+   Version  : $Revision$
+   Author   : $Author$
+   Location : $HeadURL$
+
    Copyright notice:
 
     This program is free software; you can redistribute it and/or
-    modify it under the terms of the GNU General Public License  
+    modify it under the terms of the GNU General Public License
     as published by the Free Software Foundation; either version 3
     of the License, or (at your option) any later version.
-   
+
     This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of 
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
-   
+
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -51,7 +51,7 @@
 #include "Exception.h"
 #include "Reporter.h"
 #include "AudioEncoder.h"
-#include "CastSink.h"
+#include "Sink.h"
 #ifdef HAVE_SRC_LIB
 #include <samplerate.h>
 #else
@@ -71,8 +71,8 @@
  *  A class representing the ogg vorbis encoder linked as a shared object or
  *  as a static library.
  *
- *  @author  $Author: rafael@riseup.net $
- *  @version $Revision: 553 $
+ *  @author  $Author$
+ *  @version $Revision$
  */
 class VorbisLibEncoder : public AudioEncoder, public virtual Reporter
 {
@@ -199,7 +199,7 @@
          *  @exception Exception
          */
         inline
-        VorbisLibEncoder (  CastSink      * sink,
+        VorbisLibEncoder (  Sink          * sink,
                             unsigned int    inSampleRate,
                             unsigned int    inBitsPerSample,
                             unsigned int    inChannel,
@@ -211,11 +211,11 @@
                             unsigned int    outChannel    = 0,
                             unsigned int    outMaxBitrate = 0 )
                                                         throw ( Exception )
-            
+
                     : AudioEncoder ( sink,
                                      inSampleRate,
                                      inBitsPerSample,
-                                     inChannel, 
+                                     inChannel,
                                      inBigEndian,
                                      outBitrateMode,
                                      outBitrate,
@@ -244,7 +244,7 @@
          *  @exception Exception
          */
         inline
-        VorbisLibEncoder (  CastSink              * sink,
+        VorbisLibEncoder (  Sink                  * sink,
                             const AudioSource     * as,
                             BitrateMode             outBitrateMode,
                             unsigned int            outBitrate,
@@ -253,7 +253,7 @@
                             unsigned int            outChannel    = 0,
                             unsigned int            outMaxBitrate = 0 )
                                                             throw ( Exception )
-            
+
                     : AudioEncoder ( sink,
                                      as,
                                      outBitrateMode,
@@ -331,7 +331,7 @@
         }
 
         /**
-         *  Check wether encoding is in progress.
+         *  Check whether encoding is in progress.
          *
          *  @return true if encoding is in progress, false otherwise.
          */
@@ -402,7 +402,11 @@
                 return false;
             }
 
-            return getSink()->canWrite(sec, usec);
+            if ( 1 == vorbis_analysis_blockout( &vorbisDspState, &vorbisBlock) ) {
+              return getSink()->canWrite(sec, usec);
+            } else {
+              return true;
+            }
         }
 
         /**
@@ -447,4 +451,3 @@
 
 
 #endif  /* VORBIS_LIB_ENCODER_H */
-
