Merge branch 'v0.20.x'
This commit is contained in:
		| @@ -24,6 +24,7 @@ | ||||
| #include "FfmpegMetaData.hxx" | ||||
| #include "tag/Table.hxx" | ||||
| #include "tag/Handler.hxx" | ||||
| #include "tag/Id3MusicBrainz.hxx" | ||||
|  | ||||
| extern "C" { | ||||
| #include <libavutil/dict.h> | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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"); | ||||
|   | ||||
							
								
								
									
										34
									
								
								src/tag/Id3MusicBrainz.cxx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								src/tag/Id3MusicBrainz.cxx
									
									
									
									
									
										Normal file
									
								
							| @@ -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 "Table.hxx" | ||||
| #include "Type.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 } | ||||
| }; | ||||
							
								
								
									
										25
									
								
								src/tag/Id3MusicBrainz.hxx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/tag/Id3MusicBrainz.hxx
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||
| @@ -23,6 +23,7 @@ | ||||
| #include "Handler.hxx" | ||||
| #include "Table.hxx" | ||||
| #include "Builder.hxx" | ||||
| #include "Id3MusicBrainz.hxx" | ||||
| #include "util/Alloc.hxx" | ||||
| #include "util/ScopeExit.hxx" | ||||
| #include "util/StringStrip.hxx" | ||||
| @@ -209,19 +210,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); | ||||
| } | ||||
|  | ||||
| /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann