From 81888780b4647caaa9bfc48453e4a769fe76339f Mon Sep 17 00:00:00 2001 From: casey langen Date: Tue, 25 Dec 2018 15:41:08 -0800 Subject: [PATCH] Added support for opus, wavepack and wma when the ffmpeg decoder is enabled. --- src/plugins/ffmpegdecoder/plugin.cpp | 1 + .../taglib_plugin/TaglibMetadataReader.cpp | 28 +++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/plugins/ffmpegdecoder/plugin.cpp b/src/plugins/ffmpegdecoder/plugin.cpp index 6eccdefc1..5b0cacd4c 100644 --- a/src/plugins/ffmpegdecoder/plugin.cpp +++ b/src/plugins/ffmpegdecoder/plugin.cpp @@ -105,6 +105,7 @@ class FfmpegDecoderFactory : public musik::core::sdk::IDecoderFactory { { "audio/monkeys-audio", AV_CODEC_ID_APE }, { ".wma", AV_CODEC_ID_WMAV2 }, { "audio/x-ms-wma", AV_CODEC_ID_WMAV2 }, + { ".wv", AV_CODEC_ID_WAVPACK }, }; AVCodec* codec = av_codec_next(nullptr); diff --git a/src/plugins/taglib_plugin/TaglibMetadataReader.cpp b/src/plugins/taglib_plugin/TaglibMetadataReader.cpp index db53c7dea..06f1f04be 100644 --- a/src/plugins/taglib_plugin/TaglibMetadataReader.cpp +++ b/src/plugins/taglib_plugin/TaglibMetadataReader.cpp @@ -54,6 +54,7 @@ #include #include #include + #include #else #include #include @@ -71,6 +72,7 @@ #include #include #include + #include #include #include #include @@ -141,19 +143,23 @@ void TaglibMetadataReader::Release() { delete this; } -bool TaglibMetadataReader::CanRead(const char *extension){ +bool TaglibMetadataReader::CanRead(const char *extension) { if (extension) { std::string ext(extension); boost::algorithm::to_lower(ext); - return +#if FFMPEG_DECODER + ext.compare("opus") == 0 || + ext.compare("wv") == 0 || + ext.compare("wma") == 0 || + ext.compare("ape") == 0 || + ext.compare("mpc") == 0 || + ext.compare("aac") == 0 || +#endif ext.compare("mp3") == 0 || ext.compare("ogg") == 0 || - ext.compare("aac") == 0 || ext.compare("m4a") == 0 || - ext.compare("flac") == 0 || - ext.compare("ape") == 0 || - ext.compare("mpc") == 0; + ext.compare("flac") == 0; } return false; @@ -259,6 +265,16 @@ bool TaglibMetadataReader::ReadGeneric(const char* uri, ITagStore *target) { this->ExtractValueForKey(mp4TagMap, "aART", "album_artist", target); this->ExtractValueForKey(mp4TagMap, "disk", "disc", target); this->ExtractReplayGain(mp4TagMap, target); + handled = true; + } + } + + if (!handled) { + auto wvFile = dynamic_cast(file.file()); + if (wvFile && wvFile->hasAPETag()) { + this->ReadFromMap(wvFile->properties(), target); + this->ExtractReplayGain(wvFile->properties(), target); + handled = true; } } }