From 1dc000c06aa9c063abdd1c77b96e4510428f54d5 Mon Sep 17 00:00:00 2001
From: Avuton Olrich <avuton@gmail.com>
Date: Thu, 1 Dec 2011 05:44:53 -0800
Subject: [PATCH 01/10] mpd version 0.16.6

---
 NEWS         | 4 ++--
 configure.ac | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index b078b8213..eb989e28d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-ver 0.16.6 (2010/??/??)
+ver 0.16.6 (2011/12/01)
 * decoder:
   - fix assertion failure when resuming streams
   - ffmpeg: work around bogus channel count
@@ -13,7 +13,7 @@ ver 0.16.6 (2010/??/??)
 * WIN32: autodetect filesystem encoding
 
 
-ver 0.16.5 (2010/10/09)
+ver 0.16.5 (2011/10/09)
 * configure.ac
   - disable assertions in the non-debugging build
   - show solaris plugin result correctly
diff --git a/configure.ac b/configure.ac
index 478639e7b..604b5b846 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ(2.60)
-AC_INIT(mpd, 0.16.6~git, musicpd-dev-team@lists.sourceforge.net)
+AC_INIT(mpd, 0.16.6, musicpd-dev-team@lists.sourceforge.net)
 AC_CONFIG_SRCDIR([src/main.c])
 AM_INIT_AUTOMAKE([foreign 1.10 dist-bzip2 subdir-objects])
 AM_CONFIG_HEADER(config.h)

From 8ca3642429cb64bd0668325d95815637b1c1228a Mon Sep 17 00:00:00 2001
From: Avuton Olrich <avuton@gmail.com>
Date: Thu, 1 Dec 2011 05:44:53 -0800
Subject: [PATCH 02/10] Modify version string to post-release version
 0.16.7~git

---
 NEWS         | 3 +++
 configure.ac | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index eb989e28d..126d52e1d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+ver 0.16.7 (2011/??/??)
+
+
 ver 0.16.6 (2011/12/01)
 * decoder:
   - fix assertion failure when resuming streams
diff --git a/configure.ac b/configure.ac
index 604b5b846..1b1aa88df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ(2.60)
-AC_INIT(mpd, 0.16.6, musicpd-dev-team@lists.sourceforge.net)
+AC_INIT(mpd, 0.16.7~git, musicpd-dev-team@lists.sourceforge.net)
 AC_CONFIG_SRCDIR([src/main.c])
 AM_INIT_AUTOMAKE([foreign 1.10 dist-bzip2 subdir-objects])
 AM_CONFIG_HEADER(config.h)

From 81e8c4bbffd95d9b5f8166970bd9470e8903d4e8 Mon Sep 17 00:00:00 2001
From: Avuton Olrich <avuton@gmail.com>
Date: Sat, 10 Dec 2011 08:28:49 -0800
Subject: [PATCH 03/10] gitignore: Add mpd.service

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 4c626dbf3..83a1bf623 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,7 @@ missing
 mkinstalldirs
 mpd
 mpd.exe
+mpd.service
 stamp-h1
 tags
 *~

From ef39da59731afd37f5e511caf1cf6ce71fd0d38b Mon Sep 17 00:00:00 2001
From: Avuton Olrich <avuton@gmail.com>
Date: Sat, 10 Dec 2011 18:37:45 -0800
Subject: [PATCH 04/10] configure/utils: Add ipv6 support for mingw build

---
 configure.ac | 4 ++++
 src/utils.c  | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 1b1aa88df..4d274bfa2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -446,7 +446,11 @@ if test x$enable_ipv6 = xyes; then
 	AC_EGREP_CPP([AP_maGiC_VALUE],
 	[
 #include <sys/types.h>
+#ifdef WIN32
+#include <winsock2.h>
+#else
 #include <sys/socket.h>
+#endif
 #include <netdb.h>
 #ifdef PF_INET6
 #ifdef AF_INET6
diff --git a/src/utils.c b/src/utils.c
index 53494cc5d..6e85dd5ff 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -33,7 +33,11 @@
 #include <pwd.h>
 #endif
 
-#ifdef HAVE_IPV6
+#if HAVE_IPV6 && WIN32
+#include <winsock2.h>
+#endif 
+
+#if HAVE_IPV6 && ! WIN32
 #include <sys/socket.h>
 #endif
 

From f5d3859238538dba15d8a972594ad0a5a5f7edda Mon Sep 17 00:00:00 2001
From: Avuton Olrich <avuton@gmail.com>
Date: Sat, 10 Dec 2011 18:43:36 -0800
Subject: [PATCH 05/10] cmdline: Remove duplicate g_free()s

---
 src/cmdline.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/cmdline.c b/src/cmdline.c
index 2c1db890b..d986c8eb8 100644
--- a/src/cmdline.c
+++ b/src/cmdline.c
@@ -194,8 +194,6 @@ parse_cmdline(int argc, char **argv, struct options *options,
 				if(g_file_test(system_path,
 						G_FILE_TEST_IS_REGULAR)) {
 					ret = config_read_file(system_path,error_r);
-					g_free(system_path);
-					g_free(&system_config_dirs);
 					break;
 				}
 				++i;;

From 533e4fcdadf70cc2899f8e93a1aadfb219693a9c Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Tue, 13 Dec 2011 20:08:31 +0100
Subject: [PATCH 06/10] decoder/mp4ff: work around assertion failure in read()
 callback

This workaround leads to an infinite loop instead of an assertion
failure, but hey, now it's libmp4ff's fault.
---
 src/decoder/mp4ff_decoder_plugin.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/decoder/mp4ff_decoder_plugin.c b/src/decoder/mp4ff_decoder_plugin.c
index 861b08194..cd85778f8 100644
--- a/src/decoder/mp4ff_decoder_plugin.c
+++ b/src/decoder/mp4ff_decoder_plugin.c
@@ -94,6 +94,12 @@ mp4_read(void *user_data, void *buffer, uint32_t length)
 {
 	struct mp4ff_input_stream *mis = user_data;
 
+	if (length == 0)
+		/* libmp4ff is known to attempt to read 0 bytes - make
+		   this a special case, because the input_stream API
+		   would not allow this */
+		return 0;
+
 	return decoder_read(mis->decoder, mis->input_stream, buffer, length);
 }
 

From 2685b53b30c165c31377277161f56b4c02dc0aa6 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Tue, 13 Dec 2011 20:12:49 +0100
Subject: [PATCH 07/10] configure.ac: suppress warnings in the GLib headers

Replace -I with -isystem in GLIB_CFLAGS.
---
 configure.ac | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configure.ac b/configure.ac
index 4d274bfa2..8d3f3c1e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -432,6 +432,11 @@ dnl ---------------------------------------------------------------------------
 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.12 gthread-2.0],,
 		[AC_MSG_ERROR([GLib 2.12 is required])])
 
+if test x$GCC = xyes; then
+	# suppress warnings in the GLib headers
+	GLIB_CFLAGS=`echo $GLIB_CFLAGS |sed -e 's,-I/,-isystem /,g'`
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl Protocol Options
 dnl ---------------------------------------------------------------------------

From 2ef7ee6ca7adcd66b00adf9e8de1c7adf29f371c Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Tue, 13 Dec 2011 20:26:24 +0100
Subject: [PATCH 08/10] update_walk: print debug message for song_file_load()

---
 src/update_walk.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/update_walk.c b/src/update_walk.c
index 426bd62ff..03fa78456 100644
--- a/src/update_walk.c
+++ b/src/update_walk.c
@@ -616,6 +616,8 @@ update_regular_file(struct directory *directory,
 		}
 
 		if (song == NULL) {
+			g_debug("reading %s/%s",
+				directory_get_path(directory), name);
 			song = song_file_load(name, directory);
 			if (song == NULL) {
 				g_debug("ignoring unrecognized file %s/%s",

From 097e5dfbdc2ec958045d5f4b5ec5e7cfa396360e Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Tue, 13 Dec 2011 21:02:33 +0100
Subject: [PATCH 09/10] timer: fix time unit mixup in timer_delay()

The local variable was already divided by 1000, and the return value
was being divided by 1000 again - doh!  This caused delays in the
httpd output plugin that were too small by three orders of magnitude,
and the buffer was filled too quickly.
---
 NEWS        | 2 ++
 src/timer.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 126d52e1d..d66ca1d4f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,6 @@
 ver 0.16.7 (2011/??/??)
+* output:
+  - httpd: fix excessive buffering
 
 
 ver 0.16.6 (2011/12/01)
diff --git a/src/timer.c b/src/timer.c
index 0b3b1198a..ba82fc522 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -81,7 +81,7 @@ timer_delay(const Timer *timer)
 	if (delay > G_MAXINT)
 		delay = G_MAXINT;
 
-	return delay / 1000;
+	return delay;
 }
 
 void timer_sync(Timer *timer)

From 96ad5b84446be0bf603895adaf0ec2e97bee11aa Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Tue, 13 Dec 2011 21:32:19 +0100
Subject: [PATCH 10/10] output/openal: force 16 bit playback, as 8 bit doesn't
 work

The OpenAL specification says that AL_FORMAT_MONO8 and
AL_FORMAT_STEREO8 expect unsigned 8 bit samples, but MPD uses unsigned
samples.
---
 NEWS                       |  1 +
 src/output/openal_plugin.c | 14 ++++----------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/NEWS b/NEWS
index d66ca1d4f..bc229304a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 ver 0.16.7 (2011/??/??)
 * output:
   - httpd: fix excessive buffering
+  - openal: force 16 bit playback, as 8 bit doesn't work
 
 
 ver 0.16.6 (2011/12/01)
diff --git a/src/output/openal_plugin.c b/src/output/openal_plugin.c
index 0a8f253b2..e5db8ac34 100644
--- a/src/output/openal_plugin.c
+++ b/src/output/openal_plugin.c
@@ -58,6 +58,10 @@ openal_output_quark(void)
 static ALenum
 openal_audio_format(struct audio_format *audio_format)
 {
+	/* note: cannot map SAMPLE_FORMAT_S8 to AL_FORMAT_STEREO8 or
+	   AL_FORMAT_MONO8 since OpenAL expects unsigned 8 bit
+	   samples, while MPD uses signed samples */
+
 	switch (audio_format->format) {
 	case SAMPLE_FORMAT_S16:
 		if (audio_format->channels == 2)
@@ -69,16 +73,6 @@ openal_audio_format(struct audio_format *audio_format)
 		audio_format->channels = 1;
 		return openal_audio_format(audio_format);
 
-	case SAMPLE_FORMAT_S8:
-		if (audio_format->channels == 2)
-			return AL_FORMAT_STEREO8;
-		if (audio_format->channels == 1)
-			return AL_FORMAT_MONO8;
-
-		/* fall back to mono */
-		audio_format->channels = 1;
-		return openal_audio_format(audio_format);
-
 	default:
 		/* fall back to 16 bit */
 		audio_format->format = SAMPLE_FORMAT_S16;