From f456ca674dc2e328fb62b21598bb98f92574d1bb Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 27 Oct 2018 12:15:52 +0200 Subject: [PATCH] Update taglib --- 3rdparty/taglib/dsdiff/dsdifffile.cpp | 13 +++++++++++++ 3rdparty/taglib/dsdiff/dsdifffile.h | 9 +++++++++ 3rdparty/taglib/dsf/dsffile.cpp | 14 +++++++++++++- 3rdparty/taglib/dsf/dsffile.h | 11 ++++++++++- 3rdparty/taglib/fileref.cpp | 8 ++++---- .../mpeg/id3v2/frames/tableofcontentsframe.cpp | 18 +++++++++++++++++- 6 files changed, 66 insertions(+), 7 deletions(-) diff --git a/3rdparty/taglib/dsdiff/dsdifffile.cpp b/3rdparty/taglib/dsdiff/dsdifffile.cpp index 3fead7b74..73b2dbb25 100644 --- a/3rdparty/taglib/dsdiff/dsdifffile.cpp +++ b/3rdparty/taglib/dsdiff/dsdifffile.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "tagunion.h" #include "dsdifffile.h" @@ -97,6 +98,18 @@ public: bool hasDiin; }; +//////////////////////////////////////////////////////////////////////////////// +// static members +//////////////////////////////////////////////////////////////////////////////// + +bool DSDIFF::File::isSupported(IOStream *stream) +{ + // A DSDIFF file has to start with "FRM8????????DSD ". + + const ByteVector id = Utils::readHeader(stream, 16, false); + return (id.startsWith("FRM8") && id.containsAt("DSD ", 12)); +} + //////////////////////////////////////////////////////////////////////////////// // public members //////////////////////////////////////////////////////////////////////////////// diff --git a/3rdparty/taglib/dsdiff/dsdifffile.h b/3rdparty/taglib/dsdiff/dsdifffile.h index f61b111bf..8b8887442 100644 --- a/3rdparty/taglib/dsdiff/dsdifffile.h +++ b/3rdparty/taglib/dsdiff/dsdifffile.h @@ -185,6 +185,15 @@ namespace TagLib { */ bool hasDIINTag() const; + /*! + * Returns whether or not the given \a stream can be opened as a DSDIFF + * file. + * + * \note This method is designed to do a quick check. The result may + * not necessarily be correct. + */ + static bool isSupported(IOStream *stream); + protected: enum Endianness { BigEndian, LittleEndian }; diff --git a/3rdparty/taglib/dsf/dsffile.cpp b/3rdparty/taglib/dsf/dsffile.cpp index 394e66b85..1b2c24031 100644 --- a/3rdparty/taglib/dsf/dsffile.cpp +++ b/3rdparty/taglib/dsf/dsffile.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - copyright : (C) 2013 by Stephen F. Booth + copyright : (C) 2013 - 2018 by Stephen F. Booth email : me@sbooth.org ***************************************************************************/ @@ -28,6 +28,7 @@ #include #include #include +#include #include "dsffile.h" @@ -56,6 +57,17 @@ public: ID3v2::Tag *tag; }; +//////////////////////////////////////////////////////////////////////////////// +// static members +//////////////////////////////////////////////////////////////////////////////// + +bool DSF::File::isSupported(IOStream *stream) +{ + // A DSF file has to start with "DSD " + const ByteVector id = Utils::readHeader(stream, 4, false); + return id.startsWith("DSD "); +} + //////////////////////////////////////////////////////////////////////////////// // public members //////////////////////////////////////////////////////////////////////////////// diff --git a/3rdparty/taglib/dsf/dsffile.h b/3rdparty/taglib/dsf/dsffile.h index b1422b16f..e75298d7c 100644 --- a/3rdparty/taglib/dsf/dsffile.h +++ b/3rdparty/taglib/dsf/dsffile.h @@ -1,5 +1,5 @@ /*************************************************************************** - copyright : (C) 2013 by Stephen F. Booth + copyright : (C) 2013 - 2018 by Stephen F. Booth email : me@sbooth.org ***************************************************************************/ @@ -103,6 +103,15 @@ namespace TagLib { */ virtual bool save(); + /*! + * Returns whether or not the given \a stream can be opened as a DSF + * file. + * + * \note This method is designed to do a quick check. The result may + * not necessarily be correct. + */ + static bool isSupported(IOStream *stream); + private: File(const File &); File &operator=(const File &); diff --git a/3rdparty/taglib/fileref.cpp b/3rdparty/taglib/fileref.cpp index de2a52148..5ec4dc06d 100644 --- a/3rdparty/taglib/fileref.cpp +++ b/3rdparty/taglib/fileref.cpp @@ -180,10 +180,10 @@ namespace file = new RIFF::WAV::File(stream, readAudioProperties, audioPropertiesStyle); else if(APE::File::isSupported(stream)) file = new APE::File(stream, readAudioProperties, audioPropertiesStyle); - //else if(DSF::File::isSupported(stream)) - //return new DSDIFF::File(stream, readAudioProperties, audioPropertiesStyle); - //else if(DSDIFF::File::isSupported(stream)) - //return new DSF::File(stream, readAudioProperties, audioPropertiesStyle); + else if(DSDIFF::File::isSupported(stream)) + file = new DSDIFF::File(stream, readAudioProperties, audioPropertiesStyle); + else if(DSF::File::isSupported(stream)) + file = new DSF::File(stream, readAudioProperties, audioPropertiesStyle); // isSupported() only does a quick check, so double check the file here. diff --git a/3rdparty/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp b/3rdparty/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp index ddd3b88c6..efe89d171 100644 --- a/3rdparty/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp +++ b/3rdparty/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp @@ -216,7 +216,23 @@ void TableOfContentsFrame::removeEmbeddedFrames(const ByteVector &id) String TableOfContentsFrame::toString() const { - return String(); + String s = String(d->elementID) + + ": top level: " + (d->isTopLevel ? "true" : "false") + + ", ordered: " + (d->isOrdered ? "true" : "false"); + + if(!d->childElements.isEmpty()) { + s+= ", chapters: [ " + String(d->childElements.toByteVector(", ")) + " ]"; + } + + if(!d->embeddedFrameList.isEmpty()) { + StringList frameIDs; + for(FrameList::ConstIterator it = d->embeddedFrameList.begin(); + it != d->embeddedFrameList.end(); ++it) + frameIDs.append((*it)->frameID()); + s += ", sub-frames: [ " + frameIDs.toString(", ") + " ]"; + } + + return s; } PropertyMap TableOfContentsFrame::asProperties() const