From 43c4be875d03182eb35bb2297b739d8de565bb9c Mon Sep 17 00:00:00 2001 From: casey langen Date: Tue, 1 Jan 2019 17:20:09 -0800 Subject: [PATCH] Repaired m4a support and added support for alac and aac. --- src/3rdparty/bin | 2 +- src/plugins/ffmpegdecoder/plugin.cpp | 4 ++- .../taglib_plugin/TaglibMetadataReader.cpp | 36 +++++++++---------- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/3rdparty/bin b/src/3rdparty/bin index 549f03310..f77857c24 160000 --- a/src/3rdparty/bin +++ b/src/3rdparty/bin @@ -1 +1 @@ -Subproject commit 549f033102ef7550b80db1e54ca03070f1dc20c5 +Subproject commit f77857c24dec5e4d6d900995ed3d140088657eb6 diff --git a/src/plugins/ffmpegdecoder/plugin.cpp b/src/plugins/ffmpegdecoder/plugin.cpp index f56fa7e2b..0bb8275eb 100644 --- a/src/plugins/ffmpegdecoder/plugin.cpp +++ b/src/plugins/ffmpegdecoder/plugin.cpp @@ -92,11 +92,13 @@ class FfmpegDecoderFactory : public musik::core::sdk::IDecoderFactory { { ".opus", AV_CODEC_ID_OPUS }, { ".flac", AV_CODEC_ID_FLAC }, { "audio/flac", AV_CODEC_ID_FLAC }, + { ".alac", AV_CODEC_ID_ALAC }, { ".aac", AV_CODEC_ID_AAC }, { "audio/aac", AV_CODEC_ID_AAC }, { ".mp4", AV_CODEC_ID_MPEG4 }, { "audio/mp4", AV_CODEC_ID_MPEG4 }, - { ".m4a", AV_CODEC_ID_MPEG4 }, + { ".aac", AV_CODEC_ID_AAC }, + { ".m4a", AV_CODEC_ID_AAC }, { ".mpc", AV_CODEC_ID_MUSEPACK8 }, { ".mp+", AV_CODEC_ID_MUSEPACK8 }, { ".mpp", AV_CODEC_ID_MUSEPACK8 }, diff --git a/src/plugins/taglib_plugin/TaglibMetadataReader.cpp b/src/plugins/taglib_plugin/TaglibMetadataReader.cpp index 9bd34ffc6..751f480cc 100644 --- a/src/plugins/taglib_plugin/TaglibMetadataReader.cpp +++ b/src/plugins/taglib_plugin/TaglibMetadataReader.cpp @@ -159,6 +159,7 @@ bool TaglibMetadataReader::CanRead(const char *extension) { ext.compare("ape") == 0 || ext.compare("mpc") == 0 || ext.compare("aac") == 0 || + ext.compare("alac") == 0 || #endif ext.compare("mp3") == 0 || ext.compare("ogg") == 0 || @@ -178,14 +179,19 @@ bool TaglibMetadataReader::Read(const char* uri, ITagStore *track) { extension = path.substr(lastDot + 1).c_str(); } - bool success = false; + try { + this->ReadGeneric(uri, track); + } + catch (...) { + std::cerr << "generic tag read for " << uri << "failed!"; + } if (extension.size()) { boost::algorithm::to_lower(extension); if (extension == "mp3") { try { - success = this->ReadID3V2(uri, track); + this->ReadID3V2(uri, track); } catch (...) { std::cerr << "id3v2 tag read for " << uri << "failed!"; @@ -193,14 +199,7 @@ bool TaglibMetadataReader::Read(const char* uri, ITagStore *track) { } } - try { - success |= this->ReadGeneric(uri, track); - } - catch (...) { - std::cerr << "generic tag read for " << uri << "failed!"; - } - - return success; + return true; } bool TaglibMetadataReader::ReadGeneric(const char* uri, ITagStore *target) { @@ -210,7 +209,10 @@ bool TaglibMetadataReader::ReadGeneric(const char* uri, ITagStore *target) { TagLib::FileRef file(uri); #endif - if (!file.isNull()) { + if (file.isNull()) { + this->SetTagValue("title", uri, target); + } + else { TagLib::Tag *tag = file.tag(); if (tag) { @@ -221,10 +223,10 @@ bool TaglibMetadataReader::ReadGeneric(const char* uri, ITagStore *target) { this->SetTagValue("title", uri, target); } - this->SetTagValue("album",tag->album(), target); - this->SetSlashSeparatedValues("artist",tag->artist() , target); - this->SetTagValue("genre",tag->genre(), target); - this->SetTagValue("comment",tag->comment(), target); + this->SetTagValue("album", tag->album(),target); + this->SetSlashSeparatedValues("artist", tag->artist(), target); + this->SetTagValue("genre", tag->genre(), target); + this->SetTagValue("comment", tag->comment(), target); if (tag->track()) { this->SetTagValue("track", tag->track(), target); @@ -285,12 +287,10 @@ bool TaglibMetadataReader::ReadGeneric(const char* uri, ITagStore *target) { TagLib::AudioProperties *audio = file.audioProperties(); this->SetAudioProperties(audio, target); - - return true; } } - return false; + return true; } void TaglibMetadataReader::ExtractValueForKey(