From 676739c426fc4a09f2654e64e4799dfe3c88dae3 Mon Sep 17 00:00:00 2001
From: Avuton Olrich <avuton@gmail.com>
Date: Tue, 20 Jul 2010 20:19:22 -0700
Subject: [PATCH 1/9] Modify version string to post-release version 0.15.13~git

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

diff --git a/NEWS b/NEWS
index f22a18ac8..c8f63f4de 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+ver 0.15.13 (2010/??/??)
+
+
 ver 0.15.12 (2010/07/20)
 * input:
   - curl: remove assertion after curl_multi_fdset()
diff --git a/configure.ac b/configure.ac
index b58508efc..7008451b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ(2.60)
-AC_INIT(mpd, 0.15.12, musicpd-dev-team@lists.sourceforge.net)
+AC_INIT(mpd, 0.15.13~git, musicpd-dev-team@lists.sourceforge.net)
 AC_CONFIG_SRCDIR([src/main.c])
 AM_INIT_AUTOMAKE([foreign 1.9 dist-bzip2])
 AM_CONFIG_HEADER(config.h)

From 625e4755d1c59e537dc122a540d3c21de962c3d1 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Thu, 19 Aug 2010 11:03:53 +0200
Subject: [PATCH 2/9] notify: add function notify_clear()

---
 src/notify.c | 7 +++++++
 src/notify.h | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/src/notify.c b/src/notify.c
index 9168867d6..3b45c22b4 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -48,3 +48,10 @@ void notify_signal(struct notify *notify)
 	g_cond_signal(notify->cond);
 	g_mutex_unlock(notify->mutex);
 }
+
+void notify_clear(struct notify *notify)
+{
+	g_mutex_lock(notify->mutex);
+	notify->pending = false;
+	g_mutex_unlock(notify->mutex);
+}
diff --git a/src/notify.h b/src/notify.h
index c51d34f21..0655bc6b7 100644
--- a/src/notify.h
+++ b/src/notify.h
@@ -45,4 +45,9 @@ void notify_wait(struct notify *notify);
  */
 void notify_signal(struct notify *notify);
 
+/**
+ * Clears a pending notification.
+ */
+void notify_clear(struct notify *notify);
+
 #endif

From 64dacd175ac7279b4b019c2e653d85007d71efb0 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Thu, 19 Aug 2010 11:05:24 +0200
Subject: [PATCH 3/9] output_thread: fix race condition after CANCEL command

Clear the notification before finishing the CANCEL command, so the
notify_wait() after that will always wait for the right notification,
sent by audio_output_all_cancel().
---
 NEWS                |  1 +
 src/output_thread.c | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/NEWS b/NEWS
index c8f63f4de..566422cfe 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
 ver 0.15.13 (2010/??/??)
+* output_thread: fix race condition after CANCEL command
 
 
 ver 0.15.12 (2010/07/20)
diff --git a/src/output_thread.c b/src/output_thread.c
index 770b377e8..e652eae57 100644
--- a/src/output_thread.c
+++ b/src/output_thread.c
@@ -268,6 +268,16 @@ static gpointer audio_output_task(gpointer arg)
 			ao->chunk = NULL;
 			if (ao->open)
 				ao_plugin_cancel(ao->plugin, ao->data);
+
+			/* we must clear the notification now, because
+			   the notify_wait() call below must wait
+			   until audio_output_all_cancel() has cleared
+			   the pipe; if another notification happens
+			   to be still pending, we get a race
+			   condition with a crash or an assertion
+			   failure */
+			notify_clear(&ao->notify);
+
 			ao_command_finished(ao);
 
 			/* the player thread will now clear our music

From 589bb541111e97610308fae1269a549d51c9ea6c Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Tue, 7 Sep 2010 21:40:30 +0200
Subject: [PATCH 4/9] input/curl: fix version check for curl_multi_timeout()

According to the CURL web site, curl_multi_timeout() was added in
version 7.15.4:

 http://curl.haxx.se/libcurl/c/curl_multi_timeout.html
---
 src/input/curl_input_plugin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c
index c176f20dc..3893aef1c 100644
--- a/src/input/curl_input_plugin.c
+++ b/src/input/curl_input_plugin.c
@@ -259,7 +259,7 @@ input_curl_select(struct input_curl *c)
 		return -1;
 	}
 
-#if LIBCURL_VERSION_NUM >= 0x070f00
+#if LIBCURL_VERSION_NUM >= 0x070f04
 	long timeout2;
 	mcode = curl_multi_timeout(c->multi, &timeout2);
 	if (mcode != CURLM_OK) {

From 4a7abc9d44206296587a9e4302e0e1a273aef6e9 Mon Sep 17 00:00:00 2001
From: Qball Cow <qball@sarine.nl>
Date: Wed, 8 Sep 2010 13:19:59 +0200
Subject: [PATCH 5/9] Correctly terminate stream_title.

This caused random data to be send via icy-server if the played
song had no tags.
---
 NEWS             | 2 ++
 src/icy_server.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/NEWS b/NEWS
index 566422cfe..310174a1c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
 ver 0.15.13 (2010/??/??)
 * output_thread: fix race condition after CANCEL command
+* output:
+  - httpd: fix random data in stream title
 
 
 ver 0.15.12 (2010/07/20)
diff --git a/src/icy_server.c b/src/icy_server.c
index 486c62c36..50b10c6ca 100644
--- a/src/icy_server.c
+++ b/src/icy_server.c
@@ -95,6 +95,7 @@ icy_server_metadata_page(const struct tag *tag, ...)
 	gchar stream_title[(1 + 255 - 28) * 16]; // Length + Metadata -
 						 // "StreamTitle='';StreamUrl='';"
 						 // = 4081 - 28
+	stream_title[0] =  '\0';
 
 	last_item = -1;
 

From 54294366d5fe47aba687fc791967596e31a26864 Mon Sep 17 00:00:00 2001
From: Thomas Jansen <mithi@mithi.net>
Date: Wed, 22 Sep 2010 22:20:50 +0200
Subject: [PATCH 6/9] rewind_input_plugin: Update MIME not only once

The assumption that MIME type is set only once is not valid with CURL,
as URL redirections may update the MIME type.

This fixes bug #3044.
---
 NEWS                            | 2 ++
 src/input/rewind_input_plugin.c | 7 ++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 310174a1c..2b6bb2eb3 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ ver 0.15.13 (2010/??/??)
 * output_thread: fix race condition after CANCEL command
 * output:
   - httpd: fix random data in stream title
+* input:
+  - rewind: update MIME not only once
 
 
 ver 0.15.12 (2010/07/20)
diff --git a/src/input/rewind_input_plugin.c b/src/input/rewind_input_plugin.c
index 0a874a29c..335ccf7e1 100644
--- a/src/input/rewind_input_plugin.c
+++ b/src/input/rewind_input_plugin.c
@@ -86,10 +86,11 @@ copy_attributes(struct input_stream *dest)
 	dest->size = src->size;
 	dest->offset = src->offset;
 
-	if (dest->mime == NULL && src->mime != NULL)
-		/* this is set only once, and the duplicated pointer
-		   is freed by input_stream_close() */
+	if (src->mime != NULL) {
+		if (dest->mime != NULL)
+			g_free(dest->mime);
 		dest->mime = g_strdup(src->mime);
+	}
 }
 
 static void

From e3f4c7b91cb25cc7d233b64de0e55ef2ab0d179b Mon Sep 17 00:00:00 2001
From: Thomas Jansen <mithi@mithi.net>
Date: Tue, 28 Sep 2010 12:56:47 +0200
Subject: [PATCH 7/9] input/rewind: enable for MMS

---
 NEWS                            |  1 +
 src/input/rewind_input_plugin.c | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 2b6bb2eb3..ff6716a0e 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ ver 0.15.13 (2010/??/??)
   - httpd: fix random data in stream title
 * input:
   - rewind: update MIME not only once
+  - rewind: enable for MMS
 
 
 ver 0.15.12 (2010/07/20)
diff --git a/src/input/rewind_input_plugin.c b/src/input/rewind_input_plugin.c
index 335ccf7e1..43f0254c9 100644
--- a/src/input/rewind_input_plugin.c
+++ b/src/input/rewind_input_plugin.c
@@ -20,6 +20,9 @@
 #include "config.h"
 #include "input/rewind_input_plugin.h"
 #include "input/curl_input_plugin.h"
+#ifdef ENABLE_MMS
+#include "input/mms_input_plugin.h"
+#endif
 #include "input_plugin.h"
 #include "tag.h"
 
@@ -220,7 +223,11 @@ input_rewind_open(struct input_stream *is)
 	assert(is != NULL);
 	assert(is->offset == 0);
 
-	if (is->plugin != &input_plugin_curl)
+	if (is->plugin != &input_plugin_curl
+#ifdef ENABLE_MMS
+	    && is->plugin != &input_plugin_mms
+#endif
+	   )
 		/* due to limitations in the input_plugin API, we only
 		   (explicitly) support the CURL input plugin */
 		return;
@@ -230,7 +237,8 @@ input_rewind_open(struct input_stream *is)
 
 	/* move the CURL input stream to c->input */
 	c->input = *is;
-	input_curl_reinit(&c->input);
+	if (is->plugin == &input_plugin_curl)
+		input_curl_reinit(&c->input);
 
 	/* convert the existing input_stream pointer to a "rewind"
 	   input stream */

From 5923cfcde357ca57547884819f508bff7a949620 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Sun, 3 Oct 2010 16:22:03 +0200
Subject: [PATCH 8/9] output/httpd: MIME type audio/ogg for Ogg Vorbis

RFC 5334 10.3 defines the MIME type "audio/ogg".  We could use
"application/ogg" as well, but we know for sure that we only emit
audio data.
---
 NEWS                             | 1 +
 src/output/httpd_output_plugin.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index ff6716a0e..a0babe955 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ ver 0.15.13 (2010/??/??)
 * output_thread: fix race condition after CANCEL command
 * output:
   - httpd: fix random data in stream title
+  - httpd: MIME type audio/ogg for Ogg Vorbis
 * input:
   - rewind: update MIME not only once
   - rewind: enable for MMS
diff --git a/src/output/httpd_output_plugin.c b/src/output/httpd_output_plugin.c
index 9fdf46456..026e8d9d8 100644
--- a/src/output/httpd_output_plugin.c
+++ b/src/output/httpd_output_plugin.c
@@ -70,7 +70,7 @@ httpd_output_init(G_GNUC_UNUSED const struct audio_format *audio_format,
 	}
 
 	if (strcmp(encoder_name, "vorbis") == 0)
-		httpd->content_type = "application/x-ogg";
+		httpd->content_type = "audio/ogg";
 	else if (strcmp(encoder_name, "lame") == 0)
 		httpd->content_type = "audio/mpeg";
 	else

From b552e9a12077dc73ba7d2aaad7c79a8201efff12 Mon Sep 17 00:00:00 2001
From: Avuton Olrich <avuton@gmail.com>
Date: Sun, 10 Oct 2010 09:57:52 -0700
Subject: [PATCH 9/9] mpd version 0.15.13

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

diff --git a/NEWS b/NEWS
index a0babe955..01fd82d13 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-ver 0.15.13 (2010/??/??)
+ver 0.15.13 (2010/10/10)
 * output_thread: fix race condition after CANCEL command
 * output:
   - httpd: fix random data in stream title
diff --git a/configure.ac b/configure.ac
index 7008451b0..69f195a0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ(2.60)
-AC_INIT(mpd, 0.15.13~git, musicpd-dev-team@lists.sourceforge.net)
+AC_INIT(mpd, 0.15.13, musicpd-dev-team@lists.sourceforge.net)
 AC_CONFIG_SRCDIR([src/main.c])
 AM_INIT_AUTOMAKE([foreign 1.9 dist-bzip2])
 AM_CONFIG_HEADER(config.h)