From d5cfa6d4dc0849ae199fb85ddd7d31d6a0f34d33 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Jun 2015 00:08:29 +0200 Subject: TagId3: remove the "id3v1_encoding" setting Drop support for misencoded tags. People should not be using ID3v1 anyway. --- NEWS | 2 ++ doc/mpd.conf.5 | 6 ----- doc/mpdconf.example | 4 --- src/config/ConfigTemplates.cxx | 2 +- src/tag/TagId3.cxx | 57 ++++++++---------------------------------- 5 files changed, 13 insertions(+), 58 deletions(-) diff --git a/NEWS b/NEWS index 63219a1a7..56533ff6a 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,8 @@ ver 0.20 (not yet released) - ape, ogg: drop support for non-standard tag "album artist" affected filetypes: vorbis, flac, opus & all files with ape2 tags (most importantly some mp3s) + - id3: remove the "id3v1_encoding" setting; by definition, all ID3v1 tags + are ISO-Latin-1 * decoder - ffmpeg: support ReplayGain and MixRamp - ffmpeg: support stream tags diff --git a/doc/mpd.conf.5 b/doc/mpd.conf.5 index 0cd6c313d..23b319d8a 100644 --- a/doc/mpd.conf.5 +++ b/doc/mpd.conf.5 @@ -156,12 +156,6 @@ This specifies the character set used for the filesystem. A list of supported character sets can be obtained by running "iconv \-l". The default is determined from the locale when the db was originally created. .TP -.B id3v1_encoding -This specifies the character set which ID3v1 tags are encoded in. A list of -supported character sets can be obtained by running "iconv \-l". The default is -to let libid3tag convert them (from ISO-8859-1, as the standard specifies) and -do no additional conversion. -.TP .B gapless_mp3_playback This specifies whether to support gapless playback of MP3s which have the necessary headers. Useful if your MP3s have headers with incorrect diff --git a/doc/mpdconf.example b/doc/mpdconf.example index 73a71f1f4..bf407ea4e 100644 --- a/doc/mpdconf.example +++ b/doc/mpdconf.example @@ -373,8 +373,4 @@ input { # #filesystem_charset "UTF-8" # -# This setting controls the encoding that ID3v1 tags should be converted from. -# -#id3v1_encoding "ISO-8859-1" -# ############################################################################### diff --git a/src/config/ConfigTemplates.cxx b/src/config/ConfigTemplates.cxx index 44eb6c252..b5f0c3e93 100644 --- a/src/config/ConfigTemplates.cxx +++ b/src/config/ConfigTemplates.cxx @@ -64,7 +64,7 @@ const ConfigTemplate config_param_templates[] = { { "max_command_list_size" }, { "max_output_buffer_size" }, { "filesystem_charset" }, - { "id3v1_encoding" }, + { "id3v1_encoding", false, true }, { "metadata_to_use" }, { "save_absolute_paths_in_playlists" }, { "gapless_mp3_playback" }, diff --git a/src/tag/TagId3.cxx b/src/tag/TagId3.cxx index 98f85daff..288f239d1 100644 --- a/src/tag/TagId3.cxx +++ b/src/tag/TagId3.cxx @@ -33,10 +33,6 @@ #include "fs/Path.hxx" #include "fs/FileSystem.hxx" -#ifdef HAVE_GLIB -#include -#endif - #include #include @@ -91,43 +87,11 @@ tag_id3_getstring(const struct id3_frame *frame, unsigned i) /* This will try to convert a string to utf-8, */ static id3_utf8_t * -import_id3_string(bool is_id3v1, const id3_ucs4_t *ucs4) +import_id3_string(const id3_ucs4_t *ucs4) { - id3_utf8_t *utf8; - -#ifdef HAVE_GLIB - /* use encoding field here? */ - const char *encoding; - if (is_id3v1 && - (encoding = config_get_string(ConfigOption::ID3V1_ENCODING, - nullptr)) != nullptr) { - id3_latin1_t *isostr = id3_ucs4_latin1duplicate(ucs4); - if (gcc_unlikely(isostr == nullptr)) - return nullptr; - - utf8 = (id3_utf8_t *) - g_convert_with_fallback((const char*)isostr, -1, - "utf-8", encoding, - nullptr, nullptr, - nullptr, nullptr); - if (utf8 == nullptr) { - FormatWarning(id3_domain, - "Unable to convert %s string to UTF-8: '%s'", - encoding, isostr); - free(isostr); - return nullptr; - } - free(isostr); - } else { -#else - (void)is_id3v1; -#endif - utf8 = id3_ucs4_utf8duplicate(ucs4); - if (gcc_unlikely(utf8 == nullptr)) - return nullptr; -#ifdef HAVE_GLIB - } -#endif + id3_utf8_t *utf8 = id3_ucs4_utf8duplicate(ucs4); + if (gcc_unlikely(utf8 == nullptr)) + return nullptr; id3_utf8_t *utf8_stripped = (id3_utf8_t *) xstrdup(Strip((char *)utf8)); @@ -144,7 +108,7 @@ import_id3_string(bool is_id3v1, const id3_ucs4_t *ucs4) * - string list */ static void -tag_id3_import_text_frame(struct id3_tag *tag, const struct id3_frame *frame, +tag_id3_import_text_frame(const struct id3_frame *frame, TagType type, const struct tag_handler *handler, void *handler_ctx) { @@ -173,7 +137,7 @@ tag_id3_import_text_frame(struct id3_tag *tag, const struct id3_frame *frame, if (type == TAG_GENRE) ucs4 = id3_genre_name(ucs4); - id3_utf8_t *utf8 = import_id3_string(tag_is_id3v1(tag), ucs4); + id3_utf8_t *utf8 = import_id3_string(ucs4); if (utf8 == nullptr) continue; @@ -194,7 +158,7 @@ tag_id3_import_text(struct id3_tag *tag, const char *id, TagType type, const struct id3_frame *frame; for (unsigned i = 0; (frame = id3_tag_findframe(tag, id, i)) != nullptr; ++i) - tag_id3_import_text_frame(tag, frame, type, + tag_id3_import_text_frame(frame, type, handler, handler_ctx); } @@ -208,8 +172,7 @@ tag_id3_import_text(struct id3_tag *tag, const char *id, TagType type, * - full string (we use this one) */ static void -tag_id3_import_comment_frame(struct id3_tag *tag, - const struct id3_frame *frame, TagType type, +tag_id3_import_comment_frame(const struct id3_frame *frame, TagType type, const struct tag_handler *handler, void *handler_ctx) { @@ -225,7 +188,7 @@ tag_id3_import_comment_frame(struct id3_tag *tag, if (ucs4 == nullptr) return; - id3_utf8_t *utf8 = import_id3_string(tag_is_id3v1(tag), ucs4); + id3_utf8_t *utf8 = import_id3_string(ucs4); if (utf8 == nullptr) return; @@ -244,7 +207,7 @@ tag_id3_import_comment(struct id3_tag *tag, const char *id, TagType type, const struct id3_frame *frame; for (unsigned i = 0; (frame = id3_tag_findframe(tag, id, i)) != nullptr; ++i) - tag_id3_import_comment_frame(tag, frame, type, + tag_id3_import_comment_frame(frame, type, handler, handler_ctx); } -- cgit v1.2.3