Skip to content

Commit

Permalink
use new flac file api when taglib >= 2.0 is available
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilInTheGaps committed Jan 5, 2025
1 parent 2436f79 commit 1eed4f0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/tools/audio/thumbnails/loaders/tagimageloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,21 @@ auto TagImageLoader::loadFromData(const QString &path, std::unique_ptr<ByteVecto
case FileUtils::MimeType::Vorbis: {
return loadFromVorbis(Ogg::Vorbis::File(data.get()), path);
}
#if TAGLIB_MAJOR_VERSION >= 2
case FileUtils::MimeType::FLAC: {
if (FLAC::File flac(data.get(), true, TagLib::FLAC::Properties::ReadStyle::Average, ID3v2::FrameFactory::instance()); flac.isValid())
return loadFromFlac(flac, path);

return loadFromFlac(Ogg::FLAC::File(data.get()), path);
}
#else
case FileUtils::MimeType::FLAC: {
if (FLAC::File flac(data.get(), ID3v2::FrameFactory::instance()); flac.isValid())
return loadFromFlac(flac, path);

return loadFromFlac(Ogg::FLAC::File(data.get()), path);
}
#endif
case FileUtils::MimeType::WAV: {
return loadFromWav(RIFF::WAV::File(data.get()), path);
}
Expand Down

0 comments on commit 1eed4f0

Please sign in to comment.