From 07b06d76be716fa82f18c7949c00f92208962d6a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 19 Jul 2017 20:47:17 +0200 Subject: [PATCH 1/6] {android,win32}/build.py: concatenate variables from the command line --- android/build.py | 4 ++++ python/build/cmdline.py | 29 +++++++++++++++++++++++++++++ win32/build.py | 4 ++++ 3 files changed, 37 insertions(+) create mode 100644 python/build/cmdline.py diff --git a/android/build.py b/android/build.py index a37432e13..3ec3d9ba3 100755 --- a/android/build.py +++ b/android/build.py @@ -154,5 +154,9 @@ configure = [ ] + configure_args +from build.cmdline import concatenate_cmdline_variables +configure = concatenate_cmdline_variables(configure, + set(('CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS', 'LIBS'))) + subprocess.check_call(configure, env=toolchain.env) subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], env=toolchain.env) diff --git a/python/build/cmdline.py b/python/build/cmdline.py new file mode 100644 index 000000000..50245f597 --- /dev/null +++ b/python/build/cmdline.py @@ -0,0 +1,29 @@ +def concatenate_cmdline_variables(src, names): + """Find duplicate variable declarations on the given source list, and + concatenate the values of those in the 'names' list.""" + + # the result list being constructed + dest = [] + + # a map of variable name to destination list index + positions = {} + + for item in src: + i = item.find('=') + if i > 0: + # it's a variable + name = item[:i] + if name in names: + # it's a known variable + if name in positions: + # already specified: concatenate instead of + # appending it + dest[positions[name]] += ' ' + item[i + 1:] + continue + else: + # not yet seen: append it and remember the list + # index + positions[name] = len(dest) + dest.append(item) + + return dest diff --git a/win32/build.py b/win32/build.py index 1a08ba97f..037d8088e 100755 --- a/win32/build.py +++ b/win32/build.py @@ -112,5 +112,9 @@ configure = [ ] + configure_args +from build.cmdline import concatenate_cmdline_variables +configure = concatenate_cmdline_variables(configure, + set(('CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS', 'LIBS'))) + subprocess.check_call(configure, env=toolchain.env) subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], env=toolchain.env) From f633e6ca49381adb5cd94fa0114b062ea58c1c94 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 19 Jul 2017 20:26:11 +0200 Subject: [PATCH 2/6] python/build/libs: add LAME Enable it in the Windows build script, closes #78. LAME currently doesn't support Android: checking host system type... Invalid configuration `arm-linux-androideabi': system `androideabi' not recognized --- python/build/libs.py | 11 +++++++++++ win32/build.py | 1 + 2 files changed, 12 insertions(+) diff --git a/python/build/libs.py b/python/build/libs.py index bdcfeb3d3..1bc22639e 100644 --- a/python/build/libs.py +++ b/python/build/libs.py @@ -57,6 +57,17 @@ libmad = AutotoolsProject( autogen=True, ) +liblame = AutotoolsProject( + 'http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz', + '24346b4158e4af3bd9f2e194bb23eb473c75fb7377011523353196b19b9a23ff', + 'lib/libmp3lame.a', + [ + '--disable-shared', '--enable-static', + '--disable-gtktest', '--disable-analyzer-hooks', + '--disable-decoder', '--disable-frontend', + ], +) + ffmpeg = FfmpegProject( 'http://ffmpeg.org/releases/ffmpeg-3.3.2.tar.xz', '1998de1ab32616cbf2ff86efc3f1f26e76805ec5dc51e24c041c79edd8262785', diff --git a/win32/build.py b/win32/build.py index 037d8088e..c6dd7005e 100755 --- a/win32/build.py +++ b/win32/build.py @@ -76,6 +76,7 @@ thirdparty_libs = [ flac, zlib, libid3tag, + liblame, ffmpeg, curl, boost, From 573a413ee15d2494853dea2011a778dd6bed5a75 Mon Sep 17 00:00:00 2001 From: Matthew Leon Date: Wed, 19 Jul 2017 13:36:04 -0700 Subject: [PATCH 3/6] move MusicBrainz id3v2 tags to separate file We will reuse these tags elsewhere. --- Makefile.am | 1 + src/tag/Id3MusicBrainz.cxx | 34 ++++++++++++++++++++++++++++++++++ src/tag/Id3MusicBrainz.hxx | 25 +++++++++++++++++++++++++ src/tag/TagId3.cxx | 14 ++------------ 4 files changed, 62 insertions(+), 12 deletions(-) create mode 100644 src/tag/Id3MusicBrainz.cxx create mode 100644 src/tag/Id3MusicBrainz.hxx diff --git a/Makefile.am b/Makefile.am index 898abba82..c5527458c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -923,6 +923,7 @@ libtag_a_SOURCES =\ src/tag/ReplayGain.cxx src/tag/ReplayGain.hxx \ src/tag/MixRamp.cxx src/tag/MixRamp.hxx \ src/tag/Generic.cxx src/tag/Generic.hxx \ + src/tag/Id3MusicBrainz.cxx src/tag/Id3MusicBrainz.hxx \ src/tag/ApeLoader.cxx src/tag/ApeLoader.hxx \ src/tag/ApeReplayGain.cxx src/tag/ApeReplayGain.hxx \ src/tag/ApeTag.cxx src/tag/ApeTag.hxx diff --git a/src/tag/Id3MusicBrainz.cxx b/src/tag/Id3MusicBrainz.cxx new file mode 100644 index 000000000..d0de427ca --- /dev/null +++ b/src/tag/Id3MusicBrainz.cxx @@ -0,0 +1,34 @@ +/* + * Copyright 2003-2017 The Music Player Daemon Project + * http://www.musicpd.org + * + * 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 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. + */ + +#include "Id3MusicBrainz.hxx" +#include "TagTable.hxx" +#include "TagType.h" + +const struct tag_table musicbrainz_txxx_tags[] = { + { "ALBUMARTISTSORT", TAG_ALBUM_ARTIST_SORT }, + { "MusicBrainz Artist Id", TAG_MUSICBRAINZ_ARTISTID }, + { "MusicBrainz Album Id", TAG_MUSICBRAINZ_ALBUMID }, + { "MusicBrainz Album Artist Id", + TAG_MUSICBRAINZ_ALBUMARTISTID }, + { "MusicBrainz Track Id", TAG_MUSICBRAINZ_TRACKID }, + { "MusicBrainz Release Track Id", + TAG_MUSICBRAINZ_RELEASETRACKID }, + { nullptr, TAG_NUM_OF_ITEM_TYPES } +}; diff --git a/src/tag/Id3MusicBrainz.hxx b/src/tag/Id3MusicBrainz.hxx new file mode 100644 index 000000000..bbdfc4b26 --- /dev/null +++ b/src/tag/Id3MusicBrainz.hxx @@ -0,0 +1,25 @@ +/* + * Copyright 2003-2017 The Music Player Daemon Project + * http://www.musicpd.org + * + * 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 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. + */ + +#ifndef MPD_TAG_ID3MUSICBRAINZ_HXX +#define MPD_TAG_ID3MUSICBRAINZ_HXX + +extern const struct tag_table musicbrainz_txxx_tags[]; + +#endif diff --git a/src/tag/TagId3.cxx b/src/tag/TagId3.cxx index 14ce2c392..832696800 100644 --- a/src/tag/TagId3.cxx +++ b/src/tag/TagId3.cxx @@ -20,6 +20,7 @@ #include "config.h" #include "TagId3.hxx" #include "Id3Load.hxx" +#include "Id3MusicBrainz.hxx" #include "TagHandler.hxx" #include "TagTable.hxx" #include "TagBuilder.hxx" @@ -205,19 +206,8 @@ gcc_pure static TagType tag_id3_parse_txxx_name(const char *name) noexcept { - static constexpr struct tag_table txxx_tags[] = { - { "ALBUMARTISTSORT", TAG_ALBUM_ARTIST_SORT }, - { "MusicBrainz Artist Id", TAG_MUSICBRAINZ_ARTISTID }, - { "MusicBrainz Album Id", TAG_MUSICBRAINZ_ALBUMID }, - { "MusicBrainz Album Artist Id", - TAG_MUSICBRAINZ_ALBUMARTISTID }, - { "MusicBrainz Track Id", TAG_MUSICBRAINZ_TRACKID }, - { "MusicBrainz Release Track Id", - TAG_MUSICBRAINZ_RELEASETRACKID }, - { nullptr, TAG_NUM_OF_ITEM_TYPES } - }; - return tag_table_lookup(txxx_tags, name); + return tag_table_lookup(musicbrainz_txxx_tags, name); } /** From 4c0404c70dac0b2e6b74bb7957ca0e95156ebaab Mon Sep 17 00:00:00 2001 From: Matthew Leon Date: Wed, 19 Jul 2017 16:43:17 -0700 Subject: [PATCH 4/6] Check for MusicBrainz id3v2 tags in ffmpeg. Addresses #82. Previously, the ffmpeg decoder only checked for the "generic" MusicBrainz metadata keys used in other metadata container formats. --- NEWS | 2 ++ src/decoder/plugins/FfmpegMetaData.cxx | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/NEWS b/NEWS index 90867e848..bdc6ed53e 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.20.10 (not yet released) +* decoder + - ffmpeg: support MusicBrainz ID3v2 tags ver 0.20.9 (2017/06/04) * decoder diff --git a/src/decoder/plugins/FfmpegMetaData.cxx b/src/decoder/plugins/FfmpegMetaData.cxx index 24eb0cc9c..2491dbf78 100644 --- a/src/decoder/plugins/FfmpegMetaData.cxx +++ b/src/decoder/plugins/FfmpegMetaData.cxx @@ -24,6 +24,7 @@ #include "FfmpegMetaData.hxx" #include "tag/TagTable.hxx" #include "tag/TagHandler.hxx" +#include "tag/Id3MusicBrainz.hxx" extern "C" { #include @@ -75,6 +76,11 @@ FfmpegScanDictionary(AVDictionary *dict, i->name != nullptr; ++i) FfmpegScanTag(i->type, dict, i->name, handler, handler_ctx); + + for (const struct tag_table *i = musicbrainz_txxx_tags; + i->name != nullptr; ++i) + FfmpegScanTag(i->type, dict, i->name, + handler, handler_ctx); } if (handler.pair != nullptr) From cf0c59864f8d1898278ef88530aaf89657214881 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 21 Jul 2017 09:51:43 +0200 Subject: [PATCH 5/6] doc/protocol.xml: clarify that idle events do not get lost --- doc/protocol.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/protocol.xml b/doc/protocol.xml index 7996abd94..dca8a75bb 100644 --- a/doc/protocol.xml +++ b/doc/protocol.xml @@ -403,6 +403,15 @@ + + + Change events accumulate, even while the connection is + not in "idle" mode; no events gets lost while the client + is doing something else with the connection. If an + event had already occurred since the last call, the new + idle command will return immediately. + + While a client is waiting for idle results, the server disables timeouts, allowing a client From dd9fd3d8a7c3f5f3dfed426369297592a1f7616c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 31 Jul 2017 13:46:09 +0200 Subject: [PATCH 6/6] tag/Aiff: the FORM chunk size is big-endian Was broken by commit 8a86460b8f054a42130a4b59e082b66d921d2a1b Closes #87 --- NEWS | 2 ++ src/tag/Aiff.cxx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index bdc6ed53e..870287815 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ ver 0.20.10 (not yet released) * decoder - ffmpeg: support MusicBrainz ID3v2 tags +* tags + - aiff: fix FORM chunk size endianess (is big-endian) ver 0.20.9 (2017/06/04) * decoder diff --git a/src/tag/Aiff.cxx b/src/tag/Aiff.cxx index faa47f6b2..b6a7aa7ed 100644 --- a/src/tag/Aiff.cxx +++ b/src/tag/Aiff.cxx @@ -49,7 +49,7 @@ aiff_seek_id3(InputStream &is) aiff_header header; is.ReadFull(&header, sizeof(header)); if (memcmp(header.id, "FORM", 4) != 0 || - (is.KnownSize() && FromLE32(header.size) > is.GetSize()) || + (is.KnownSize() && FromBE32(header.size) > is.GetSize()) || (memcmp(header.format, "AIFF", 4) != 0 && memcmp(header.format, "AIFC", 4) != 0)) throw std::runtime_error("Not an AIFF file");