From 5264254b9d7f86991503e1174c2eca314836b68b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Mon, 5 Aug 2024 20:45:18 +0200 Subject: [PATCH] [Taglib] Use non-deprecated constructors for MPEG::File/FLAC::File The old constructor taking the FrameFactory as second, non-optional parameter has been deprecated, and replaced with a constructor taking the default'ed FrameFactory as an optional 4th parameter (the 3rd parameter, Properties::ReadStyle, is also defaulted). Unfortunately, older versions require a FrameFactory for the `FileStream` constructor overload. --- src/extractors/taglibextractor.cpp | 8 ++++++++ src/writers/taglibwriter.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/extractors/taglibextractor.cpp b/src/extractors/taglibextractor.cpp index 87401c4..fbd3bc1 100644 --- a/src/extractors/taglibextractor.cpp +++ b/src/extractors/taglibextractor.cpp @@ -565,7 +565,11 @@ void TagLibExtractor::extract(ExtractionResult* result) }; if (mimeType == QLatin1String("audio/mpeg")) { +#if TAGLIB_MAJOR_VERSION >= 2 + TagLib::MPEG::File file(&stream, true); +#else TagLib::MPEG::File file(&stream, TagLib::ID3v2::FrameFactory::instance(), true); +#endif if (file.isValid()) { extractAudioProperties(&file, result); readGenericProperties(file.properties(), result); @@ -634,7 +638,11 @@ void TagLibExtractor::extract(ExtractionResult* result) result->addImageData(extractMp4Cover(file.tag(), imageTypes)); } } else if (mimeType == QLatin1String("audio/flac")) { +#if TAGLIB_MAJOR_VERSION >= 2 + TagLib::FLAC::File file(&stream, true); +#else TagLib::FLAC::File file(&stream, TagLib::ID3v2::FrameFactory::instance(), true); +#endif if (file.isValid()) { extractAudioProperties(&file, result); readGenericProperties(file.properties(), result); diff --git a/src/writers/taglibwriter.cpp b/src/writers/taglibwriter.cpp index f7cc5a2..3d28cca 100644 --- a/src/writers/taglibwriter.cpp +++ b/src/writers/taglibwriter.cpp @@ -520,7 +520,11 @@ void TagLibWriter::write(const WriteData& data) } if (mimeType == QLatin1String("audio/mpeg")) { +#if TAGLIB_MAJOR_VERSION >= 2 + TagLib::MPEG::File file(&stream, false); +#else TagLib::MPEG::File file(&stream, TagLib::ID3v2::FrameFactory::instance(), false); +#endif if (file.isValid()) { auto savedProperties = file.properties(); writeGenericProperties(savedProperties, properties); @@ -609,7 +613,11 @@ void TagLibWriter::write(const WriteData& data) file.save(); } } else if (mimeType == QLatin1String("audio/flac")) { +#if TAGLIB_MAJOR_VERSION >= 2 + TagLib::FLAC::File file(&stream, false); +#else TagLib::FLAC::File file(&stream, TagLib::ID3v2::FrameFactory::instance(), false); +#endif if (file.isValid()) { auto savedProperties = file.properties(); writeGenericProperties(savedProperties, properties);