Commit ddee909b authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Allow medialibrary to be built without libvlc as a dependency

parent 8c3edf5a
......@@ -17,8 +17,6 @@ libmedialibrary_la_CXXFLAGS = \
libmedialibrary_la_CPPFLAGS = \
$(MEDIALIB_CPPFLAGS) \
$(SQLITE_CFLAGS) \
$(VLC_CFLAGS) \
$(VLCPP_CFLAGS) \
$(NULL)
libmedialibrary_la_HEADERS = \
......@@ -86,20 +84,13 @@ libmedialibrary_la_SOURCES = \
src/discoverer/FsDiscoverer.cpp \
src/discoverer/probe/PathProbe.cpp \
src/factory/FileSystemFactory.cpp \
src/factory/NetworkFileSystemFactory.cpp \
src/factory/DeviceListerFactory.cpp \
src/filesystem/common/CommonDevice.cpp \
src/filesystem/common/CommonFile.cpp \
src/filesystem/common/CommonDirectory.cpp \
src/filesystem/network/Directory.cpp \
src/filesystem/network/File.cpp \
src/filesystem/network/Device.cpp \
src/logging/IostreamLogger.cpp \
src/logging/Logger.cpp \
src/metadata_services/MetadataParser.cpp \
src/metadata_services/vlc/Common.cpp \
src/metadata_services/vlc/VLCMetadataService.cpp \
src/metadata_services/vlc/VLCThumbnailer.cpp \
src/parser/Parser.cpp \
src/parser/ParserWorker.cpp \
src/parser/Task.cpp \
......@@ -107,9 +98,9 @@ libmedialibrary_la_SOURCES = \
src/utils/Filename.cpp \
src/utils/ModificationsNotifier.cpp \
src/utils/Url.cpp \
src/utils/VLCInstance.cpp \
$(NULL)
noinst_HEADERS = \
include/discoverer/IDiscoverer.h \
include/factory/IFileSystem.h \
......@@ -133,7 +124,6 @@ noinst_HEADERS = \
src/discoverer/probe/IProbe.h \
src/discoverer/probe/PathProbe.h \
src/factory/FileSystemFactory.h \
src/factory/NetworkFileSystemFactory.h \
src/factory/DeviceListerFactory.h \
src/File.h \
src/filesystem/common/CommonFile.h \
......@@ -143,9 +133,6 @@ noinst_HEADERS = \
src/filesystem/unix/Device.h \
src/filesystem/unix/Directory.h \
src/filesystem/unix/File.h \
src/filesystem/network/Device.h \
src/filesystem/network/Directory.h \
src/filesystem/network/File.h \
src/filesystem/unix/DeviceLister.h \
src/filesystem/win32/Directory.h \
src/filesystem/win32/File.h \
......@@ -158,10 +145,6 @@ noinst_HEADERS = \
src/Media.h \
src/MediaLibrary.h \
src/metadata_services/MetadataParser.h \
src/metadata_services/vlc/Common.hpp \
src/metadata_services/vlc/VLCMetadataService.h \
src/metadata_services/vlc/VLCThumbnailer.h \
src/metadata_services/vlc/imagecompressors/IImageCompressor.h \
src/Movie.h \
src/parser/Parser.h \
src/parser/ParserWorker.h \
......@@ -177,7 +160,6 @@ noinst_HEADERS = \
src/utils/ModificationsNotifier.h \
src/utils/SWMRLock.h \
src/utils/Url.h \
src/utils/VLCInstance.h \
src/VideoTrack.h \
src/compat/Thread.h \
src/compat/Mutex.h \
......@@ -216,7 +198,6 @@ endif
libmedialibrary_la_LIBADD = \
$(SQLITE_LIBS) \
$(VLC_LIBS) \
$(NULL)
libmedialibrary_la_LDFLAGS = -no-undefined -export-symbols-regex 'NewMediaLibrary'
......@@ -238,6 +219,40 @@ if HAVE_DARWIN
lib_LTLIBRARIES += libmedialibrary_macos.la
endif
if HAVE_LIBVLC
libmedialibrary_la_SOURCES += \
src/metadata_services/vlc/VLCMetadataService.cpp \
src/metadata_services/vlc/VLCThumbnailer.cpp \
src/metadata_services/vlc/Common.cpp \
src/utils/VLCInstance.cpp \
src/factory/NetworkFileSystemFactory.cpp \
src/filesystem/network/Directory.cpp \
src/filesystem/network/File.cpp \
src/filesystem/network/Device.cpp \
$(NULL)
noinst_HEADERS += \
src/utils/VLCInstance.h \
src/metadata_services/vlc/Common.hpp \
src/metadata_services/vlc/VLCMetadataService.h \
src/metadata_services/vlc/VLCThumbnailer.h \
src/metadata_services/vlc/imagecompressors/IImageCompressor.h \
src/factory/NetworkFileSystemFactory.h \
src/filesystem/network/Device.h \
src/filesystem/network/Directory.h \
src/filesystem/network/File.h \
$(NULL)
libmedialibrary_la_CPPFLAGS += \
$(VLC_CFLAGS) \
$(VLCPP_CFLAGS) \
$(NULL)
libmedialibrary_la_LIBADD += $(VLC_LIBS)
endif
EXTRA_DIST=
if HAVE_TESTS
......
......@@ -277,17 +277,24 @@ AS_IF([test "${enable_debug}" = "no"],[
AC_DEFINE(NDEBUG)
])
AC_ARG_WITH(libvlc, [AC_HELP_STRING([--with-libvlc], [build with libvlc integration (default enabled)])],, [with_libvlc=yes])
AH_TEMPLATE(HAVE_LIBVLC, [Define to 1 if libvlc integration is enabled])
AS_IF([test "${with_libvlc}" != "no"], [
AC_DEFINE(HAVE_LIBVLC)
PKG_CHECK_MODULES(VLC, libvlc >= 3.0)
PKG_CHECK_MODULES(VLCPP, libvlcpp,
[AC_MSG_RESULT([Found libvlcpp.pc])],
[
# Checking for files doesn't work when cross compiling. Simply assume
# The file is there
AC_MSG_RESULT([Falling back to submodule])
AC_SUBST([VLCPP_CFLAGS],[-I${srcdir}/libvlcpp])
]
)
])
AM_CONDITIONAL(HAVE_LIBVLC, [test "${with_libvlc}" != "no"])
PKG_CHECK_MODULES(SQLITE, sqlite3)
PKG_CHECK_MODULES(VLC, libvlc >= 3.0)
PKG_CHECK_MODULES(VLCPP, libvlcpp,
[AC_MSG_RESULT([Found libvlcpp.pc])],
[
# Checking for files doesn't work when cross compiling. Simply assume
# The file is there
AC_MSG_RESULT([Falling back to submodule])
AC_SUBST([VLCPP_CFLAGS],[-I${srcdir}/libvlcpp])
]
)
PKG_CHECK_MODULES(LIBJPEG, libjpeg, [
have_libjpeg="yes"
......
......@@ -63,14 +63,20 @@
#include "discoverer/FsDiscoverer.h"
// Metadata services:
#ifdef HAVE_LIBVLC
#include "metadata_services/vlc/VLCMetadataService.h"
#include "metadata_services/vlc/VLCThumbnailer.h"
#endif
#include "metadata_services/MetadataParser.h"
// FileSystem
#include "factory/DeviceListerFactory.h"
#include "factory/FileSystemFactory.h"
#ifdef HAVE_LIBVLC
#include "factory/NetworkFileSystemFactory.h"
#endif
#include "medialibrary/filesystem/IDevice.h"
namespace medialibrary
......@@ -718,7 +724,11 @@ bool MediaLibrary::startParser()
if ( m_services.size() == 0 )
{
#ifdef HAVE_LIBVLC
m_parser->addService( std::make_shared<parser::VLCMetadataService>() );
#else
return false;
#endif
}
else
{
......@@ -749,8 +759,12 @@ void MediaLibrary::startDeletionNotifier()
bool MediaLibrary::startThumbnailer()
{
#ifdef HAVE_LIBVLC
m_thumbnailer = std::unique_ptr<VLCThumbnailer>( new VLCThumbnailer( this ) );
return true;
#else
return false;
#endif
}
void MediaLibrary::addLocalFsFactory()
......@@ -1204,6 +1218,7 @@ void MediaLibrary::discover( const std::string& entryPoint )
bool MediaLibrary::setDiscoverNetworkEnabled( bool enabled )
{
#ifdef HAVE_LIBVLC
if ( enabled )
{
auto it = std::find_if( begin( m_fsFactories ), end( m_fsFactories ), []( const std::shared_ptr<factory::IFileSystem> fs ) {
......@@ -1219,6 +1234,9 @@ bool MediaLibrary::setDiscoverNetworkEnabled( bool enabled )
}), end( m_fsFactories ) );
}
return true;
#else
return false;
#endif
}
Query<IFolder> MediaLibrary::entryPoints() const
......@@ -1318,8 +1336,12 @@ void MediaLibrary::forceRescan()
bool MediaLibrary::requestThumbnail( MediaPtr media )
{
#ifdef HAVE_LIBVLC
m_thumbnailer->requestThumbnail( media );
return true;
#else
return false;
#endif
}
void MediaLibrary::addParserService( std::shared_ptr<parser::IParserService> service )
......
......@@ -236,7 +236,9 @@ class MediaLibrary : public IMediaLibrary, public IDeviceListerCb
bool m_initialized;
std::atomic_bool m_discovererIdle;
std::atomic_bool m_parserIdle;
#ifdef HAVE_LIBVLC
std::unique_ptr<VLCThumbnailer> m_thumbnailer;
#endif
};
}
......
......@@ -24,6 +24,10 @@
#include "config.h"
#endif
#ifndef HAVE_LIBVLC
# error This file requires libvlc
#endif
#include "NetworkFileSystemFactory.h"
#include "filesystem/network/Directory.h"
#include "utils/VLCInstance.h"
......
......@@ -24,6 +24,10 @@
# include "config.h"
#endif
#ifndef HAVE_LIBVLC
# error This file requires libvlc
#endif
#include "Device.h"
namespace medialibrary
......
......@@ -24,6 +24,10 @@
# include "config.h"
#endif
#ifndef HAVE_LIBVLC
# error This file requires libvlc
#endif
#include "Directory.h"
#include "File.h"
#include "utils/Filename.h"
......
......@@ -24,6 +24,10 @@
#include "config.h"
#endif
#ifndef HAVE_LIBVLC
# error This file requires libvlc
#endif
#include "File.h"
namespace medialibrary
......
......@@ -24,6 +24,10 @@
#include "config.h"
#endif
#ifndef HAVE_LIBVLC
# error This file requires libvlc
#endif
#include "Common.hpp"
#include "Media.h"
#include "utils/Filename.h"
......
......@@ -24,6 +24,10 @@
# include "config.h"
#endif
#ifndef HAVE_LIBVLC
# error This file requires libvlc
#endif
#include <chrono>
#include "VLCMetadataService.h"
......
......@@ -24,6 +24,10 @@
#include "config.h"
#endif
#ifndef HAVE_LIBVLC
# error This file requires libvlc
#endif
#include "VLCThumbnailer.h"
#include "AlbumTrack.h"
......
......@@ -24,6 +24,10 @@
# include "config.h"
#endif
#ifndef HAVE_LIBVLC
# error This file requires libvlc
#endif
#include "VLCInstance.h"
#include "logging/Logger.h"
#include "vlcpp/vlc.hpp"
......
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