Commit 082914b0 authored by Michael Pyne's avatar Michael Pyne
Browse files

cmake: Remove needless checks for Taglib format support.

The recent commit 9a54d6e7 to use
FindTaglib from ECM breaks detection of Ogg Opus support in Taglib for
some reason. This causes crashes when playing Ogg Opus files because
their relevant Taglib::File subclass is not created from our MediaFiles
factory.

However the check is needless. Taglib support for ASF and MP4 files has
been standard since 2012 or so, and Ogg Opus support was made standard
around the same time frame. So rather than check for these as optional
features, just assume that supported versions of Taglib support these
formats.
parent 8956f56d
Pipeline #50842 canceled with stage
in 6 minutes and 11 seconds
......@@ -65,11 +65,6 @@ set(HAVE_TUNEPIMP 0)
add_definitions(-DQT_STL -DQT_NO_URL_CAST_FROM_STRING)
# Look for Ogg Opus support in taglib (not released yet)
cmake_push_check_state()
check_include_file_cxx(opusfile.h TAGLIB_HAS_OPUSFILE)
cmake_pop_check_state()
configure_file (config-juk.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-juk.h )
set(juk_SRCS
......
/* Define if you tunepimp installed */
#define HAVE_TUNEPIMP @HAVE_TUNEPIMP@
/* Defined if taglib supports Ogg::Opus::File */
#cmakedefine01 TAGLIB_HAS_OPUSFILE
/* Version */
#define JUK_VERSION "${RELEASE_SERVICE_VERSION}"
......@@ -39,13 +39,10 @@
#include <attachedpictureframe.h>
#include <flacfile.h>
#include <xiphcomment.h>
#ifdef TAGLIB_WITH_MP4
#include <mp4coverart.h>
#include <mp4file.h>
#include <mp4tag.h>
#include <mp4item.h>
#endif
#include "mediafiles.h"
#include "collectionlist.h"
......@@ -289,6 +286,10 @@ bool CoverInfo::hasEmbeddedAlbumArt() const
QScopedPointer<TagLib::File> fileTag(
MediaFiles::fileFactoryByType(m_file.absFilePath()));
if (!fileTag->isValid()) {
return false;
}
if (TagLib::MPEG::File *mpegFile =
dynamic_cast<TagLib::MPEG::File *>(fileTag.data()))
{
......@@ -314,7 +315,6 @@ bool CoverInfo::hasEmbeddedAlbumArt() const
// Look if images are embedded.
return !flacFile->pictureList().isEmpty();
}
#ifdef TAGLIB_WITH_MP4
else if(TagLib::MP4::File *mp4File =
dynamic_cast<TagLib::MP4::File *>(fileTag.data()))
{
......@@ -323,7 +323,6 @@ bool CoverInfo::hasEmbeddedAlbumArt() const
return tag->contains("covr");
}
}
#endif
return false;
}
......@@ -395,7 +394,6 @@ static QImage embeddedFLACAlbumArt(const TagLib::List<TagLib::FLAC::Picture *> &
coverData.size());
}
#ifdef TAGLIB_WITH_MP4
static QImage embeddedMP4AlbumArt(TagLib::MP4::Tag *tag)
{
if(!tag->contains("covr"))
......@@ -416,7 +414,6 @@ static QImage embeddedMP4AlbumArt(TagLib::MP4::Tag *tag)
// No appropriate image found
return QImage();
}
#endif
void CoverInfo::popup() const
{
......@@ -469,7 +466,6 @@ QImage CoverInfo::embeddedAlbumArt() const
{
return embeddedFLACAlbumArt(flacFile->pictureList());
}
#ifdef TAGLIB_WITH_MP4
else if(auto *mp4File =
dynamic_cast<TagLib::MP4::File *>(fileTag.data()))
{
......@@ -478,7 +474,6 @@ QImage CoverInfo::embeddedAlbumArt() const
return embeddedMP4AlbumArt(tag);
}
}
#endif
return QImage();
}
......
......@@ -37,19 +37,9 @@
#include <xiphcomment.h>
#include <oggflacfile.h>
#include <mpcfile.h>
#include <config-juk.h>
#if TAGLIB_HAS_OPUSFILE
# include <opusfile.h>
#endif
#ifdef TAGLIB_WITH_ASF
#include <opusfile.h>
#include <asffile.h>
#endif
#ifdef TAGLIB_WITH_MP4
#include <mp4file.h>
#endif
#include "juk_debug.h"
......@@ -64,32 +54,19 @@ namespace MediaFiles {
static const char vorbisType[] = "audio/x-vorbis+ogg";
static const char oggflacType[] = "audio/x-flac+ogg";
static const char oggopusType[] = "audio/x-opus+ogg";
#ifdef TAGLIB_WITH_ASF
static const char asfType[] = "video/x-ms-asf";
#endif
#ifdef TAGLIB_WITH_MP4
static const char mp4Type[] = "audio/mp4";
static const char mp4AudiobookType[] = "audio/x-m4b";
#endif
#if TAGLIB_HAS_OPUSFILE
static const char oggopusType[] = "audio/x-opus+ogg";
#endif
static const char *const mediaTypes[] = {
mp3Type, oggType, flacType, mpcType, vorbisType, oggflacType
#ifdef TAGLIB_WITH_ASF
,asfType
#endif
#ifdef TAGLIB_WITH_MP4
,mp4Type
,mp4AudiobookType
#endif
#if TAGLIB_HAS_OPUSFILE
,oggopusType
#endif
};
static const char playlistExtension[] = ".m3u";
......@@ -159,26 +136,20 @@ TagLib::File *MediaFiles::fileFactoryByType(const QString &fileName)
file = new TagLib::FLAC::File(encodedFileName.constData());
else if(result.inherits(QLatin1String(vorbisType)))
file = new TagLib::Vorbis::File(encodedFileName.constData());
#ifdef TAGLIB_WITH_ASF
else if(result.inherits(QLatin1String(asfType)))
file = new TagLib::ASF::File(encodedFileName.constData());
#endif
#ifdef TAGLIB_WITH_MP4
else if(result.inherits(QLatin1String(mp4Type)) || result.inherits(QLatin1String(mp4AudiobookType)))
file = new TagLib::MP4::File(encodedFileName.constData());
#endif
else if(result.inherits(QLatin1String(mpcType)))
file = new TagLib::MPC::File(encodedFileName.constData());
else if(result.inherits(QLatin1String(oggflacType)))
file = new TagLib::Ogg::FLAC::File(encodedFileName.constData());
#if TAGLIB_HAS_OPUSFILE
else if(result.inherits(QLatin1String(oggopusType)) ||
(result.inherits(QLatin1String(oggType)) && fileName.endsWith(QLatin1String(".opus")))
)
{
file = new TagLib::Ogg::Opus::File(encodedFileName.constData());
}
#endif
return file;
}
......@@ -236,19 +207,15 @@ bool MediaFiles::isVorbis(const QString &fileName)
return isFileOfMimeType(fileName, vorbisType);
}
#ifdef TAGLIB_WITH_ASF
bool MediaFiles::isASF(const QString &fileName)
{
return isFileOfMimeType(fileName, asfType);
}
#endif
#ifdef TAGLIB_WITH_MP4
bool MediaFiles::isMP4(const QString &fileName)
{
return isFileOfMimeType(fileName, mp4Type) || isFileOfMimeType(fileName, mp4AudiobookType);
}
#endif
bool MediaFiles::isOggFLAC(const QString &fileName)
{
......
......@@ -95,19 +95,15 @@ namespace MediaFiles
*/
bool isVorbis(const QString &fileName);
#ifdef TAGLIB_WITH_ASF
/**
* Returns true if fileName is an ASF file.
*/
bool isASF(const QString &fileName);
#endif
#ifdef TAGLIB_WITH_MP4
/**
* Returns true if fileName is a MP4 file.
*/
bool isMP4(const QString &fileName);
#endif
/**
* Returns true if fileName is an Ogg/FLAC file.
......
......@@ -16,7 +16,6 @@
#include "playlistitem.h"
#include <config-juk.h>
#include <kiconloader.h>
#include <QCollator>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment