qmmp/qmmp-taglib2.patch

124 lines
4.3 KiB
Diff

--- a/src/plugins/Input/archive/archivetagreader.cpp
+++ b/src/plugins/Input/archive/archivetagreader.cpp
@@ -42,7 +42,11 @@
return m_fileName.constData();
#endif
}
+#if TAGLIB_MAJOR_VERSION >= 2
+ virtual TagLib::ByteVector readBlock(size_t length) override
+#else
virtual TagLib::ByteVector readBlock(unsigned long length) override
+#endif
{
char data[length];
qint64 l = m_input->read(data, length);
@@ -55,10 +59,17 @@
}
virtual void writeBlock(const TagLib::ByteVector &) override
{}
+#if TAGLIB_MAJOR_VERSION >= 2
+ virtual void insert(const TagLib::ByteVector &, TagLib::offset_t, size_t) override
+ {}
+ virtual void removeBlock(TagLib::offset_t, size_t) override
+ {}
+#else
virtual void insert(const TagLib::ByteVector &, unsigned long, unsigned long) override
{}
virtual void removeBlock(unsigned long, unsigned long) override
{}
+#endif
virtual bool readOnly() const override
{
return true;
--- a/src/plugins/Input/flac/decoder_flac.cpp
+++ b/src/plugins/Input/flac/decoder_flac.cpp
@@ -295,7 +295,11 @@
p.remove("flac://");
p.remove(QRegularExpression("#\\d+$"));
TagLib::FileStream stream(QStringToFileName(p), true);
+#if TAGLIB_MAJOR_VERSION >= 2
+ TagLib::FLAC::File fileRef(&stream);
+#else
TagLib::FLAC::File fileRef(&stream, TagLib::ID3v2::FrameFactory::instance());
+#endif
//looking for cuesheet comment
TagLib::Ogg::XiphComment *tag = fileRef.xiphComment();
TagLib::FLAC::Properties *ap = fileRef.audioProperties();
--- a/src/plugins/Input/flac/decoderflacfactory.cpp
+++ b/src/plugins/Input/flac/decoderflacfactory.cpp
@@ -97,7 +97,11 @@
if(filePath.endsWith(".flac", Qt::CaseInsensitive))
{
+#if TAGLIB_MAJOR_VERSION >= 2
+ flacFile = new TagLib::FLAC::File(&stream);
+#else
flacFile = new TagLib::FLAC::File(&stream, TagLib::ID3v2::FrameFactory::instance());
+#endif
tag = flacFile->xiphComment();
ap = flacFile->audioProperties();
}
--- a/src/plugins/Input/flac/flacmetadatamodel.cpp
+++ b/src/plugins/Input/flac/flacmetadatamodel.cpp
@@ -41,7 +41,11 @@
if(m_path.endsWith(".flac", Qt::CaseInsensitive))
{
m_stream = new TagLib::FileStream(QStringToFileName(m_path), readOnly);
+#if TAGLIB_MAJOR_VERSION >= 2
+ TagLib::FLAC::File *f = new TagLib::FLAC::File(m_stream);
+#else
TagLib::FLAC::File *f = new TagLib::FLAC::File(m_stream, TagLib::ID3v2::FrameFactory::instance());
+#endif
m_tag = f->xiphComment();
m_file = f;
setDialogHints(dialogHints() | MetaDataModel::IsCueEditable);
--- a/src/plugins/Input/mpeg/decodermpegfactory.cpp
+++ b/src/plugins/Input/mpeg/decodermpegfactory.cpp
@@ -220,7 +220,11 @@
return QList<TrackInfo*>() << info;
TagLib::FileStream stream(QStringToFileName(path), true);
+#if TAGLIB_MAJOR_VERSION >= 2
+ TagLib::MPEG::File fileRef(&stream);
+#else
TagLib::MPEG::File fileRef(&stream, TagLib::ID3v2::FrameFactory::instance());
+#endif
if (parts & TrackInfo::MetaData)
{
@@ -348,6 +352,11 @@
break;
case TagLib::MPEG::Header::Version2_5:
info->setValue(Qmmp::FORMAT_NAME, QString("MPEG-2.5 layer %1").arg(fileRef.audioProperties()->layer()));
+ break;
+#if TAGLIB_MAJOR_VERSION >= 2
+ case TagLib::MPEG::Header::Version4:
+ info->setValue(Qmmp::FORMAT_NAME, QString("MPEG-4 layer %1").arg(fileRef.audioProperties()->layer()));
+#endif
}
info->setDuration(fileRef.audioProperties()->lengthInMilliseconds());
}
--- a/src/plugins/Input/mpeg/mpegmetadatamodel.cpp
+++ b/src/plugins/Input/mpeg/mpegmetadatamodel.cpp
@@ -41,7 +41,11 @@
MetaDataModel(readOnly, MetaDataModel::IsCoverEditable)
{
m_stream = new TagLib::FileStream(QStringToFileName(path), readOnly);
+#if TAGLIB_MAJOR_VERSION >= 2
+ m_file = new TagLib::MPEG::File(m_stream);
+#else
m_file = new TagLib::MPEG::File(m_stream, TagLib::ID3v2::FrameFactory::instance());
+#endif
m_tags << new MpegFileTagModel(using_rusxmms, m_file, TagLib::MPEG::File::ID3v1);
m_tags << new MpegFileTagModel(using_rusxmms, m_file, TagLib::MPEG::File::ID3v2);
m_tags << new MpegFileTagModel(using_rusxmms, m_file, TagLib::MPEG::File::APE);