Repaired m4a support and added support for alac and aac.

This commit is contained in:
casey langen 2019-01-01 17:20:09 -08:00
parent 4a5e8fb2a4
commit 43c4be875d
3 changed files with 22 additions and 20 deletions

2
src/3rdparty/bin vendored

@ -1 +1 @@
Subproject commit 549f033102ef7550b80db1e54ca03070f1dc20c5
Subproject commit f77857c24dec5e4d6d900995ed3d140088657eb6

View File

@ -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 },

View File

@ -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) {
@ -285,13 +287,11 @@ bool TaglibMetadataReader::ReadGeneric(const char* uri, ITagStore *target) {
TagLib::AudioProperties *audio = file.audioProperties();
this->SetAudioProperties(audio, target);
}
}
return true;
}
}
return false;
}
void TaglibMetadataReader::ExtractValueForKey(
const TagLib::MP4::ItemMap& map,