Pizzocel | 15 Dec 00:14 2014
Picon

Tags from Input plugins

Hi,

I'm trying to write an input plugin. It determines the content of the
tag at the time the stream is opened. I thought, the tag should then be
delivered as the result of the first call to ReadTag. Subsequent calls
should return nullptr, as the tag would not change until the stream is
closed.
But I found, that this did not work as I expected.
The reason is, that when update_stream_tag in DecoderAPI.cxx gets
nullptr from the second call to ReadTag (via LockReadTag, it overwrites
the stream tag with song_tag.

My work around is to send nullptr from the first call to ReadTag.
This causes song_tag to be set to nullptr. Then the tag that I want
to be attached to the stream is sent in the next call to ReadTag.
This way it will no longer be overwritten.

For me a more intuitive behaviour would be to set the stream_tag to
song_tag before the first call to update_stream_tag, and only set
stream_tag to values != nullptr returned from ReadTag in update_stream_tag.

Regards,
 Pizzocel

_______________________________________________
mpd-devel mailing list
mpd-devel <at> musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel
Jörg Krause | 7 Dec 22:40 2014
Picon

[PATCH 1/2] thread/Id.hxx: fix musl build error

This patch fix a build error with the musl C library. The patch is originally
taken from Alpine Linux:
http://git.alpinelinux.org/cgit/aports/tree/main/mpd/fix-musl.patch.

musl declares pthread_equal both as a macro and as a function. Without the
parentheses the preprocessor expands pthread_equal to ::((id)==(other.id))
which obviously fails.

Using parentheses prevents the preprocessor from expansion and the compiler
looks up for the function declaration of pthread_equal in the global namespace.

Signed-off-by: Jörg Krause <jkrause <at> posteo.de>
---
 src/thread/Id.hxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/thread/Id.hxx b/src/thread/Id.hxx
index 7b10de0..c4e514e 100644
--- a/src/thread/Id.hxx
+++ b/src/thread/Id.hxx
 <at>  <at>  -84,7 +84,7  <at>  <at>  public:
 #ifdef WIN32
 		return id == other.id;
 #else
-		return ::pthread_equal(id, other.id);
+		return (::pthread_equal)(id, other.id);
 #endif
 	}

--

-- 
(Continue reading)

Andrej Falout | 6 Dec 06:29 2014

Inotify setup on startup

Hello,

on my system with large collection on a NAS, MPD takes a very long time to set up inotify :

Dec 06 18:12 : inotify: initializing inotify
Dec 06 18:18 : inotify: watching music directory


During all this time, MPD does not respond to any commands.

I am wondering, if there is anything I can do to speed this up, or if this setup function could be moved into a separate thread perhaps - so that it does not block startup?

Thanks,
Andrej Falout

_______________________________________________
mpd-devel mailing list
mpd-devel <at> musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel
Michal Nazarewicz | 3 Dec 21:13 2014
Picon

[PATCHv4 1/2] settings: support service names in MPD_PORT variable

From: Michal Nazarewicz <mina86 <at> mina86.com>

If $MPD_PORT is not a number, i.e. does not start with a digit,
attempt to resolve it using getservbyname, i.e. by reading the
/etc/services database.
---
 src/settings.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/src/settings.c b/src/settings.c
index f2799df..f153452 100644
--- a/src/settings.c
+++ b/src/settings.c
 <at>  <at>  -30,9 +30,20  <at>  <at> 
 #include "config.h"

 #include <assert.h>
+#include <ctype.h>
 #include <string.h>
 #include <stdlib.h>

+#ifdef ENABLE_TCP
+#  ifdef WIN32
+#    include <winsock2.h>
+#  else
+#    include <arpa/inet.h>
+#    include <netdb.h>
+#    include <netinet/in.h>
+#  endif
+#endif
+
 struct mpd_settings {
 	char *host;

 <at>  <at>  -100,6 +111,26  <at>  <at>  mpd_check_host(const char *host, char **password_r)
 }

 /**
+ * Parse port number (which can be a service name).
+ */
+static unsigned
+mpd_parse_port(const char *str)
+{
+	if (!*str)
+		return 0;
+	if (isdigit(str[0]))
+		return atoi(str);
+
+#ifdef ENABLE_TCP
+	struct servent *servent = getservbyname(str, "tcp");
+	if (servent)
+		return ntohs(servent->s_port);
+#endif
+
+	return 0;
+}
+
+/**
  * Parses the port specification.  If not specified (0), it attempts
  * to load it from the environment variable MPD_PORT.
  */
 <at>  <at>  -109,7 +140,7  <at>  <at>  mpd_check_port(unsigned port)
 	if (port == 0) {
 		const char *env_port = getenv("MPD_PORT");
 		if (env_port != NULL)
-			port = atoi(env_port);
+			port = mpd_parse_port(env_port);
 	}

 	return port;
--

-- 
2.2.0.rc0.207.ga3a616c

_______________________________________________
mpd-devel mailing list
mpd-devel <at> musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel
X Ryl | 2 Dec 14:05 2014
Picon

PATCH: Add support for configuration specified optional headers in HTTP output plugins

As the subject says, this patch adds support for optional headers for
the HTTP output plugins. These headers are required for allowing cross
origin resource sharing (for one, but it can be used in reverse proxy
mode to identify the server sources).
This makes possible to receiving the HTTP stream asynchronously in
Javascript, and as such to lower the latency when playing the stream
in a web browser / javascript based audio player.

It also fix a bug with escaped chars not processed as described in the
config file's tokenizer.

Best regards,
Cyril
_______________________________________________
mpd-devel mailing list
mpd-devel <at> musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel
Punky | 2 Dec 08:13 2014
Picon

systemd and "zeroconf: No global port, disabling zeroconf"

Hi all,

I am now trying Debian jessie with 0.19.1.  However, zeroconf is not enabled, and /var/log/mpd/mpd.log shows "zeroconf: No global port, disabling zeroconf".

Further looking into the code, I found the following in zeroconf/ZeroconfGlue.cxx, line 52-57:
if (listen_port <= 0) { LogWarning(zeroconf_domain, "No global port, disabling zeroconf"); zeroconfEnabled = false; return; }then in Listen.cxx, line 112-118
#ifdef ENABLE_SYSTEMD_DAEMON if (listen_systemd_activation(error)) return true; if (error.IsDefined()) return false; #endif

//...line 149-151:
listen_port = port; return true; }
Since jessie now uses systemd instead of sysvinit, listen_systemd_activation() is true.  Then the function exit immediately without setting listen_port = port.

Correct me if I am wrong as I just guess from reading the code.

--
-- 

Regards,
Kim-man "Punky" Tse

* Open Source Embedded Solutions and Systems
  - Voyage Linux (http://linux.voyage.hk)
  - Voyage MPD   (http://linux.voyage.hk/voyage-mpd)
  - Voyage MuBox (http://mubox.voyage.hk)
* Voyage Store   (http://store.voyage.hk)
_______________________________________________
mpd-devel mailing list
mpd-devel <at> musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel
Michal Nazarewicz | 1 Dec 15:00 2014
Picon

[PATCHv3 1/2] settings: support service names in MPD_PORT variable

From: Michal Nazarewicz <mina86 <at> mina86.com>

If $MPD_PORT is not a number, i.e. does not start with a digit,
attempt to resolve it using getservbyname, i.e. by reading the
/etc/services database.
---
 src/settings.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/settings.c b/src/settings.c
index f2799df..d8e9247 100644
--- a/src/settings.c
+++ b/src/settings.c
 <at>  <at>  -29,7 +29,10  <at>  <at> 
 #include <mpd/settings.h>
 #include "config.h"

+#include <arpa/inet.h>
 #include <assert.h>
+#include <ctype.h>
+#include <netdb.h>
 #include <string.h>
 #include <stdlib.h>

 <at>  <at>  -100,6 +103,21  <at>  <at>  mpd_check_host(const char *host, char **password_r)
 }

 /**
+ * Parse port number (which can be a service name).
+ */
+static unsigned
+mpd_parse_port(const char *str)
+{
+	if (!*str)
+		return 0;
+	if (isdigit(str[0]))
+		return atoi(str);
+
+	struct servent *servent = getservbyname(str, "tcp");
+	return servent ? ntohs(servent->s_port) : 0;
+}
+
+/**
  * Parses the port specification.  If not specified (0), it attempts
  * to load it from the environment variable MPD_PORT.
  */
 <at>  <at>  -109,7 +127,7  <at>  <at>  mpd_check_port(unsigned port)
 	if (port == 0) {
 		const char *env_port = getenv("MPD_PORT");
 		if (env_port != NULL)
-			port = atoi(env_port);
+			port = mpd_parse_port(env_port);
 	}

 	return port;
--

-- 
2.2.0.rc0.207.ga3a616c

_______________________________________________
mpd-devel mailing list
mpd-devel <at> musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel
Piotr Kozłowski | 30 Nov 19:52 2014
Picon

[Patch] Database proxy plugin: retry connection attempts at startup

Hi,

I've written a patch that allows configurable number of attempts to connect to remote MPD server if there are any errors.

I'm running MPD proxy on a headless single board computer. It often happens that the first connection attempt fails, usually because of the delays in configuring the (wifi) network interface, but the following attempts succeed. This patch saves me a lot of time: I do not have to ssh to the board and do "service mpd start", so I think it may be useful to others, too.

Thanks,
Piotr Kozlowski
_______________________________________________
mpd-devel mailing list
mpd-devel <at> musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel
Piotr Kozłowski | 30 Nov 19:39 2014
Picon

[Patch] Database proxy plugin: retry connection attempts at startup

Hi,

I've written a patch that allows configurable number of attempts to connect to remote MPD server if there are any errors.

I'm running MPD proxy on a headless single board computer. It often happens that the first connection attempt fails, usually because of the delays in configuring the (wifi) network interface, but the following attempts succeed. This patch saves me a lot of time: I do not have to ssh to the board and do "service mpd start", so I think it may be useful to others, too.

Thanks,
Piotr Kozlowski
_______________________________________________
mpd-devel mailing list
mpd-devel <at> musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel
Michal Nazarewicz | 29 Nov 02:02 2014
Picon

[PATCH] settings: add support for reading ~/.authinfo file

From: Michal Nazarewicz <mina86 <at> mina86.com>

Instead of storing password in MPD_HOST environment variable (which
is passed around everywhere) allow saving password in an ~/.authinfo
file.  This is especially useful if MPD is listening on default
host:port, i.e. localhost:6600, in which case all one needs to do is
to put line like
	machine localhost port 6600 password some-password
to make MPD clients use “some-password” when connecting to it.
---
 src/settings.c | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/src/settings.c b/src/settings.c
index f2799df..1b3b20f 100644
--- a/src/settings.c
+++ b/src/settings.c
 <at>  <at>  -32,6 +32,7  <at>  <at> 
 #include <assert.h>
 #include <string.h>
 #include <stdlib.h>
+#include <stdio.h>

 struct mpd_settings {
 	char *host;
 <at>  <at>  -115,6 +116,104  <at>  <at>  mpd_check_port(unsigned port)
 	return port;
 }

+static char *
+mpd_parse_authinfo_line(const char *host, unsigned port, char *line)
+{
+	/* If port is zero (e.g. if socket is used), allow authinfo lines w/o
+	 * a port. */
+	bool got_host = false, got_port = !port;
+	char *pwd = NULL, *saveptr, *kw, *val;
+
+	while ((kw = strtok_r(line, " \t\n", &saveptr))) {
+		val = strtok_r(NULL, " \t\n", &saveptr);
+		/* Ignore line if there's a keyword w/o value. */
+		if (!val)
+			return NULL;
+		line = NULL;
+
+		if (!strcmp(kw, "machine")) {
+			/* Ignore line if hosts differ. */
+			if (strcmp(val, host))
+				return NULL;
+			got_host = true;
+
+		} else if (!strcmp(kw, "port")) {
+			/* Ignore line if ports differ.  TODO: Do we need to
+			 * detect errors or is atoi enough? */
+			if (atoi(val) != (int)port)
+				return NULL;
+			got_port = true;
+
+		} else if (!strcmp(kw, "password")) {
+			pwd = val;
+
+		} else {
+			/* Unknown keyword present, ignore line. */
+			return NULL;
+		}
+	}
+
+	return got_host && got_port ? pwd : NULL;
+}
+
+static char *
+mpd_parse_authinfo(const char *host, unsigned port, FILE *fd)
+{
+	char line[1024], *pwd = NULL;
+
+	do {
+		if (!fgets(line, sizeof line, fd)) {
+			return NULL;
+		}
+
+		if (!strchr(line, '\n')) {
+			/* Discard partial lines.  TODO: handle lines of
+			 * arbitrary length */
+			while (fgets(line, sizeof line, fd) &&
+			       !strchr(line, '\n')) { }
+		} else {
+			pwd = mpd_parse_authinfo_line(host, port, line);
+		}
+	} while (!pwd);
+
+	return strdup(pwd);
+}
+
+static char *
+mpd_read_authinfo_password(const char *host, unsigned port)
+{
+	static const char *filenames[] = {
+		/* Code assumes the first entry is the longest. */
+		".authinfo", ".netrc"
+	};
+
+	char *pwd = NULL, *path, *str;
+	unsigned i;
+	FILE *fd;
+
+	str = getenv("HOME");
+	if (!str) {
+		return NULL;
+	}
+
+	i = strlen(str);
+	path = malloc(i + strlen(filenames[0]) + 2);
+	memcpy(path, str, i);
+	path[i] = '/';
+	str = path + i + 1;
+
+	for (i = 0; !pwd && i < sizeof filenames / sizeof *filenames; ++i) {
+		strcpy(str,  filenames[i]);
+		fd = fopen(path, "r");
+		if (fd) {
+			pwd = mpd_parse_authinfo(host, port, fd);
+		}
+		fclose(fd);
+	}
+	free(path);
+	return pwd;
+}
+
 static unsigned
 mpd_default_timeout_ms(void)
 {
 <at>  <at>  -168,6 +267,11  <at>  <at>  mpd_settings_new(const char *host, unsigned port, unsigned timeout_ms,
 		? 0 /* no port for local socket */
 		: (port != 0 ? port : DEFAULT_PORT);

+	if (settings->host && !settings->password) {
+		settings->password = mpd_read_authinfo_password(
+			settings->host, settings->port);
+	}
+
 	return settings;
 }

--

-- 
2.2.0.rc0.207.ga3a616c

_______________________________________________
mpd-devel mailing list
mpd-devel <at> musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel
Frederic Vanden Poel | 27 Nov 00:36 2014
Picon

432 EVO has been made possible thanks to mpd

Hello,

Our 432 EVO music server has been made possible thanks to certain 
features in MPD that allow us to do our DSP postprocessing.
Not many players support what we want, but squeezelite is another one 
where our 432 Hz method already works in the lab, and also allows access 
to other sox recipes as proposed by my earlier mpd patch.

For the moment we still use mpd.

The EVO has been nominated by the three leading Dutch hifi magazines 
hifi.nl, FWD magazine and Music Emotion to participate in the election 
for "network player of the year 2014":

http://www.hifi.nl/artikel_pagina3/22673/Product-van-het-Jaar-Verkiezing-2014-Netwerkspeler-van-het-Jaar.html

The 432 EVO is nr 5 in this list, and the sound quality has been 
improved thanks to more recent MPD versions like 0.18.13 and 0.19.X 
which sound better than what VB 2.2 is using (mpd 0.17.4).
On vortexbox 2.2 the difference between the latest MPD playing directly 
from HDD and playing via LMS + vortexbox-player + MPD is day and night.

So this is a thank you mail from Klinkt Beter and 432 EVO for the 
progress MPD has made over the last years!

--

-- 
Best regards,

Frederic Vanden Poel

Klinkt Beter
www.klinktbeter.be
info <at> klinktbeter.be

+32 473 79 36 91
Blauwe Paal 45
9230 Wetteren

_______________________________________________
mpd-devel mailing list
mpd-devel <at> musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel

Gmane