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 }, { ".opus", AV_CODEC_ID_OPUS },
{ ".flac", AV_CODEC_ID_FLAC }, { ".flac", AV_CODEC_ID_FLAC },
{ "audio/flac", AV_CODEC_ID_FLAC }, { "audio/flac", AV_CODEC_ID_FLAC },
{ ".alac", AV_CODEC_ID_ALAC },
{ ".aac", AV_CODEC_ID_AAC }, { ".aac", AV_CODEC_ID_AAC },
{ "audio/aac", AV_CODEC_ID_AAC }, { "audio/aac", AV_CODEC_ID_AAC },
{ ".mp4", AV_CODEC_ID_MPEG4 }, { ".mp4", AV_CODEC_ID_MPEG4 },
{ "audio/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 }, { ".mpc", AV_CODEC_ID_MUSEPACK8 },
{ ".mp+", AV_CODEC_ID_MUSEPACK8 }, { ".mp+", AV_CODEC_ID_MUSEPACK8 },
{ ".mpp", 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("ape") == 0 ||
ext.compare("mpc") == 0 || ext.compare("mpc") == 0 ||
ext.compare("aac") == 0 || ext.compare("aac") == 0 ||
ext.compare("alac") == 0 ||
#endif #endif
ext.compare("mp3") == 0 || ext.compare("mp3") == 0 ||
ext.compare("ogg") == 0 || ext.compare("ogg") == 0 ||
@ -178,14 +179,19 @@ bool TaglibMetadataReader::Read(const char* uri, ITagStore *track) {
extension = path.substr(lastDot + 1).c_str(); 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()) { if (extension.size()) {
boost::algorithm::to_lower(extension); boost::algorithm::to_lower(extension);
if (extension == "mp3") { if (extension == "mp3") {
try { try {
success = this->ReadID3V2(uri, track); this->ReadID3V2(uri, track);
} }
catch (...) { catch (...) {
std::cerr << "id3v2 tag read for " << uri << "failed!"; std::cerr << "id3v2 tag read for " << uri << "failed!";
@ -193,14 +199,7 @@ bool TaglibMetadataReader::Read(const char* uri, ITagStore *track) {
} }
} }
try { return true;
success |= this->ReadGeneric(uri, track);
}
catch (...) {
std::cerr << "generic tag read for " << uri << "failed!";
}
return success;
} }
bool TaglibMetadataReader::ReadGeneric(const char* uri, ITagStore *target) { bool TaglibMetadataReader::ReadGeneric(const char* uri, ITagStore *target) {
@ -210,7 +209,10 @@ bool TaglibMetadataReader::ReadGeneric(const char* uri, ITagStore *target) {
TagLib::FileRef file(uri); TagLib::FileRef file(uri);
#endif #endif
if (!file.isNull()) { if (file.isNull()) {
this->SetTagValue("title", uri, target);
}
else {
TagLib::Tag *tag = file.tag(); TagLib::Tag *tag = file.tag();
if (tag) { if (tag) {
@ -221,10 +223,10 @@ bool TaglibMetadataReader::ReadGeneric(const char* uri, ITagStore *target) {
this->SetTagValue("title", uri, target); this->SetTagValue("title", uri, target);
} }
this->SetTagValue("album",tag->album(), target); this->SetTagValue("album", tag->album(),target);
this->SetSlashSeparatedValues("artist",tag->artist() , target); this->SetSlashSeparatedValues("artist", tag->artist(), target);
this->SetTagValue("genre",tag->genre(), target); this->SetTagValue("genre", tag->genre(), target);
this->SetTagValue("comment",tag->comment(), target); this->SetTagValue("comment", tag->comment(), target);
if (tag->track()) { if (tag->track()) {
this->SetTagValue("track", tag->track(), target); this->SetTagValue("track", tag->track(), target);
@ -285,12 +287,10 @@ bool TaglibMetadataReader::ReadGeneric(const char* uri, ITagStore *target) {
TagLib::AudioProperties *audio = file.audioProperties(); TagLib::AudioProperties *audio = file.audioProperties();
this->SetAudioProperties(audio, target); this->SetAudioProperties(audio, target);
return true;
} }
} }
return false; return true;
} }
void TaglibMetadataReader::ExtractValueForKey( void TaglibMetadataReader::ExtractValueForKey(