Add back option to use system taglib, add warning at the bottom

This commit is contained in:
Jonas Kvinge 2020-07-07 23:44:04 +02:00
parent 4e003c12a6
commit 904097b7b1
5 changed files with 90 additions and 55 deletions

View File

@ -193,13 +193,28 @@ if(X11_FOUND)
endif(X11_FOUND) endif(X11_FOUND)
# TAGLIB # TAGLIB
set(TAGLIB_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/3rdparty/taglib/headers/taglib/;${CMAKE_BINARY_DIR}/3rdparty/taglib/headers/") option(USE_SYSTEM_TAGLIB "Use system taglib" OFF)
set(TAGLIB_LIBRARY_DIRS "") if(USE_SYSTEM_TAGLIB)
set(TAGLIB_LIBRARIES tag) pkg_check_modules(TAGLIB REQUIRED taglib>=1.11.1)
add_subdirectory(3rdparty/utf8-cpp) message(WARNING "Using system taglib library.")
add_subdirectory(3rdparty/taglib) find_path(HAVE_TAGLIB_DSFFILE_H taglib/dsffile.h)
set(HAVE_TAGLIB_DSFFILE ON) find_path(HAVE_TAGLIB_DSDIFFFILE_H taglib/dsdifffile.h)
add_definitions(-DTAGLIB_STATIC) if(HAVE_TAGLIB_DSFFILE_H)
set(HAVE_TAGLIB_DSFFILE ON)
endif(HAVE_TAGLIB_DSFFILE_H)
if(HAVE_TAGLIB_DSDIFFFILE_H)
set(HAVE_TAGLIB_DSDIFFFILE ON)
endif(HAVE_TAGLIB_DSDIFFFILE_H)
else(USE_SYSTEM_TAGLIB)
set(TAGLIB_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/3rdparty/taglib/headers/taglib/;${CMAKE_BINARY_DIR}/3rdparty/taglib/headers/")
set(TAGLIB_LIBRARY_DIRS "")
set(TAGLIB_LIBRARIES tag)
add_subdirectory(3rdparty/utf8-cpp)
add_subdirectory(3rdparty/taglib)
set(HAVE_TAGLIB_DSFFILE ON)
set(HAVE_TAGLIB_DSDIFFFILE ON)
add_definitions(-DTAGLIB_STATIC)
endif(USE_SYSTEM_TAGLIB)
# SingleApplication # SingleApplication
add_subdirectory(3rdparty/singleapplication) add_subdirectory(3rdparty/singleapplication)
@ -388,9 +403,9 @@ option(BUILD_TAGLIB_TESTS "Build the test suite" OFF)
if(BUILD_TESTS) if(BUILD_TESTS)
add_subdirectory(tests) add_subdirectory(tests)
endif(BUILD_TESTS) endif(BUILD_TESTS)
if(BUILD_TAGLIB_TESTS) if(NOT USE_SYSTEM_TAGLIB AND BUILD_TAGLIB_TESTS)
add_subdirectory(tests/taglib) add_subdirectory(tests/taglib)
endif(BUILD_TAGLIB_TESTS) endif(NOT USE_SYSTEM_TAGLIB AND BUILD_TAGLIB_TESTS)
# Uninstall support # Uninstall support
configure_file( configure_file(
@ -412,3 +427,7 @@ endif()
if(NOT SQLITE3_FTS5 AND NOT CMAKE_CROSSCOMPILING) if(NOT SQLITE3_FTS5 AND NOT CMAKE_CROSSCOMPILING)
message(WARNING "sqlite3 must be enabled with FTS5. See: https://www.sqlite.org/fts5.html") message(WARNING "sqlite3 must be enabled with FTS5. See: https://www.sqlite.org/fts5.html")
endif() endif()
if(USE_SYSTEM_TAGLIB AND NOT TAGLIB_VERSION VERSION_GREATER 1.11.2)
message(WARNING "Using system taglib library. There is a critical bug in the current latest version of TagLib (1.11.1) that can corrupt Ogg files, make sure your systems version has been patched, see: https://github.com/taglib/taglib/issues/864, TagLib upstream is currently not maintained. Do not set USE_SYSTEM_TAGLIB unless you are prepared keep the TagLib in your system up to date with critical fixes.")
endif()

View File

@ -25,51 +25,55 @@
#include <map> #include <map>
#include <sys/stat.h> #include <sys/stat.h>
#include "taglib/taglib.h" #include <taglib/taglib.h>
#include "taglib/fileref.h" #include <taglib/fileref.h>
#include "taglib/tbytevector.h" #include <taglib/tbytevector.h>
#include "taglib/tfile.h" #include <taglib/tfile.h>
#include "taglib/tlist.h" #include <taglib/tlist.h>
#include "taglib/tstring.h" #include <taglib/tstring.h>
#include "taglib/tstringlist.h" #include <taglib/tstringlist.h>
#include "taglib/audioproperties.h" #include <taglib/audioproperties.h>
#include "taglib/attachedpictureframe.h" #include <taglib/attachedpictureframe.h>
#include "taglib/textidentificationframe.h" #include <taglib/textidentificationframe.h>
#include "taglib/unsynchronizedlyricsframe.h" #include <taglib/unsynchronizedlyricsframe.h>
#include "taglib/xiphcomment.h" #include <taglib/xiphcomment.h>
#include "taglib/commentsframe.h" #include <taglib/commentsframe.h>
#include "taglib/tag.h" #include <taglib/tag.h>
#include "taglib/apetag.h" #include <taglib/apetag.h>
#include "taglib/apeitem.h" #include <taglib/apeitem.h>
#include "taglib/apeproperties.h" #include <taglib/apeproperties.h>
#include "taglib/id3v2tag.h" #include <taglib/id3v2tag.h>
#include "taglib/id3v2frame.h" #include <taglib/id3v2frame.h>
#include "taglib/flacfile.h" #include <taglib/flacfile.h>
#include "taglib/oggflacfile.h" #include <taglib/oggflacfile.h>
#include "taglib/flacproperties.h" #include <taglib/flacproperties.h>
#include "taglib/flacpicture.h" #include <taglib/flacpicture.h>
#include "taglib/vorbisfile.h" #include <taglib/vorbisfile.h>
#include "taglib/speexfile.h" #include <taglib/speexfile.h>
#include "taglib/wavfile.h" #include <taglib/wavfile.h>
#include "taglib/wavpackfile.h" #include <taglib/wavpackfile.h>
#include "taglib/wavpackproperties.h" #include <taglib/wavpackproperties.h>
#include "taglib/aifffile.h" #include <taglib/aifffile.h>
#include "taglib/asffile.h" #include <taglib/asffile.h>
#include "taglib/asftag.h" #include <taglib/asftag.h>
#include "taglib/asfattribute.h" #include <taglib/asfattribute.h>
#include "taglib/asfproperties.h" #include <taglib/asfproperties.h>
#include "taglib/mp4file.h" #include <taglib/mp4file.h>
#include "taglib/mp4tag.h" #include <taglib/mp4tag.h>
#include "taglib/mp4item.h" #include <taglib/mp4item.h>
#include "taglib/mp4coverart.h" #include <taglib/mp4coverart.h>
#include "taglib/mp4properties.h" #include <taglib/mp4properties.h>
#include "taglib/mpcfile.h" #include <taglib/mpcfile.h>
#include "taglib/mpegfile.h" #include <taglib/mpegfile.h>
#include "taglib/opusfile.h" #include <taglib/opusfile.h>
#include "taglib/trueaudiofile.h" #include <taglib/trueaudiofile.h>
#include "taglib/apefile.h" #include <taglib/apefile.h>
#include "taglib/dsffile.h" #ifdef HAVE_TAGLIB_DSFFILE
#include "taglib/dsdifffile.h" # include <taglib/dsffile.h>
#endif
#ifdef HAVE_TAGLIB_DSDIFFFILE
# include <taglib/dsdifffile.h>
#endif
#include <QtGlobal> #include <QtGlobal>
#include <QFile> #include <QFile>
@ -152,8 +156,12 @@ pb::tagreader::SongMetadata_FileType TagReader::GuessFileType(TagLib::FileRef *f
if (dynamic_cast<TagLib::MPC::File*>(fileref->file())) return pb::tagreader::SongMetadata_FileType_MPC; if (dynamic_cast<TagLib::MPC::File*>(fileref->file())) return pb::tagreader::SongMetadata_FileType_MPC;
if (dynamic_cast<TagLib::TrueAudio::File*>(fileref->file())) return pb::tagreader::SongMetadata_FileType_TRUEAUDIO; if (dynamic_cast<TagLib::TrueAudio::File*>(fileref->file())) return pb::tagreader::SongMetadata_FileType_TRUEAUDIO;
if (dynamic_cast<TagLib::APE::File*>(fileref->file())) return pb::tagreader::SongMetadata_FileType_APE; if (dynamic_cast<TagLib::APE::File*>(fileref->file())) return pb::tagreader::SongMetadata_FileType_APE;
#ifdef HAVE_TAGLIB_DSFFILE
if (dynamic_cast<TagLib::DSF::File*>(fileref->file())) return pb::tagreader::SongMetadata_FileType_DSF; if (dynamic_cast<TagLib::DSF::File*>(fileref->file())) return pb::tagreader::SongMetadata_FileType_DSF;
#endif
#ifdef HAVE_TAGLIB_DSDIFFFILE
if (dynamic_cast<TagLib::DSDIFF::File*>(fileref->file())) return pb::tagreader::SongMetadata_FileType_DSDIFF; if (dynamic_cast<TagLib::DSDIFF::File*>(fileref->file())) return pb::tagreader::SongMetadata_FileType_DSDIFF;
#endif
return pb::tagreader::SongMetadata_FileType_UNKNOWN; return pb::tagreader::SongMetadata_FileType_UNKNOWN;

View File

@ -37,7 +37,10 @@
class QTextCodec; class QTextCodec;
#ifndef USE_SYSTEM_TAGLIB
using namespace Strawberry_TagLib; using namespace Strawberry_TagLib;
#endif
class FileRefFactory; class FileRefFactory;

View File

@ -38,7 +38,6 @@
#cmakedefine HAVE_LIBPULSE #cmakedefine HAVE_LIBPULSE
#cmakedefine HAVE_SPARKLE #cmakedefine HAVE_SPARKLE
#cmakedefine HAVE_CHROMAPRINT #cmakedefine HAVE_CHROMAPRINT
#cmakedefine HAVE_TAGLIB_DSFFILE
#cmakedefine HAVE_GLOBALSHORTCUTS #cmakedefine HAVE_GLOBALSHORTCUTS
#cmakedefine USE_INSTALL_PREFIX #cmakedefine USE_INSTALL_PREFIX
@ -55,6 +54,10 @@
#cmakedefine HAVE_KEYSYMDEF_H #cmakedefine HAVE_KEYSYMDEF_H
#cmakedefine HAVE_XF86KEYSYM_H #cmakedefine HAVE_XF86KEYSYM_H
#cmakedefine USE_SYSTEM_TAGLIB
#cmakedefine HAVE_TAGLIB_DSFFILE
#cmakedefine HAVE_TAGLIB_DSDIFFFILE
#cmakedefine USE_BUNDLE #cmakedefine USE_BUNDLE
#define USE_BUNDLE_DIR "${USE_BUNDLE_DIR}" #define USE_BUNDLE_DIR "${USE_BUNDLE_DIR}"

View File

@ -68,7 +68,9 @@
#include "covermanager/albumcoverloader.h" #include "covermanager/albumcoverloader.h"
#include "tagreadermessages.pb.h" #include "tagreadermessages.pb.h"
#ifndef USE_SYSTEM_TAGLIB
using namespace Strawberry_TagLib; using namespace Strawberry_TagLib;
#endif
const QStringList Song::kColumns = QStringList() << "title" const QStringList Song::kColumns = QStringList() << "title"
<< "album" << "album"