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

Rename VLCThumbnailer -> ThumbnailerWorker

And move it out of the VLC subfolder since it doesn't depend on VLC
anymore
parent 4152b2eb
......@@ -237,7 +237,7 @@ endif
libmedialibrary_la_SOURCES += \
src/metadata_services/vlc/VLCMetadataService.cpp \
src/metadata_services/vlc/VLCThumbnailer.cpp \
src/metadata_services/ThumbnailerWorker.cpp \
src/metadata_services/vlc/Common.cpp \
src/utils/VLCInstance.cpp \
src/factory/NetworkFileSystemFactory.cpp \
......@@ -250,7 +250,7 @@ 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/ThumbnailerWorker.h \
src/metadata_services/vlc/imagecompressors/IImageCompressor.h \
src/factory/NetworkFileSystemFactory.h \
src/filesystem/network/Device.h \
......
......@@ -68,7 +68,7 @@
// Metadata services:
#ifdef HAVE_LIBVLC
#include "metadata_services/vlc/VLCMetadataService.h"
#include "metadata_services/vlc/VLCThumbnailer.h"
#include "metadata_services/ThumbnailerWorker.h"
#endif
#include "metadata_services/MetadataParser.h"
......@@ -798,7 +798,7 @@ void MediaLibrary::startDeletionNotifier()
void MediaLibrary::startThumbnailer()
{
#ifdef HAVE_LIBVLC
m_thumbnailer = std::unique_ptr<VLCThumbnailer>( new VLCThumbnailer( this ) );
m_thumbnailer = std::unique_ptr<ThumbnailerWorker>( new ThumbnailerWorker( this ) );
#endif
}
......
......@@ -36,7 +36,7 @@ namespace medialibrary
class ModificationNotifier;
class DiscovererWorker;
class VLCThumbnailer;
class ThumbnailerWorker;
class Album;
class Artist;
......@@ -252,7 +252,7 @@ class MediaLibrary : public IMediaLibrary, public IDeviceListerCb
std::atomic_bool m_discovererIdle;
std::atomic_bool m_parserIdle;
#ifdef HAVE_LIBVLC
std::unique_ptr<VLCThumbnailer> m_thumbnailer;
std::unique_ptr<ThumbnailerWorker> m_thumbnailer;
#endif
};
......
......@@ -24,31 +24,25 @@
#include "config.h"
#endif
#ifndef HAVE_LIBVLC
# error This file requires libvlc
#endif
#include "VLCThumbnailer.h"
#include "ThumbnailerWorker.h"
#include "Media.h"
#include "File.h"
#include "logging/Logger.h"
#include "MediaLibrary.h"
#include "utils/VLCInstance.h"
#include "utils/ModificationsNotifier.h"
#include <vlcpp/vlc.hpp>
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
#include "CoreThumbnailer.h"
#include "vlc/CoreThumbnailer.h"
#else
#include "VmemThumbnailer.h"
#include "vlc/VmemThumbnailer.h"
#endif
namespace medialibrary
{
VLCThumbnailer::VLCThumbnailer( MediaLibraryPtr ml )
ThumbnailerWorker::ThumbnailerWorker( MediaLibraryPtr ml )
: m_ml( ml )
, m_run( false )
, m_paused( false )
......@@ -60,12 +54,12 @@ VLCThumbnailer::VLCThumbnailer( MediaLibraryPtr ml )
#endif
}
VLCThumbnailer::~VLCThumbnailer()
ThumbnailerWorker::~ThumbnailerWorker()
{
stop();
}
void VLCThumbnailer::requestThumbnail( MediaPtr media )
void ThumbnailerWorker::requestThumbnail( MediaPtr media )
{
{
std::unique_lock<compat::Mutex> lock( m_mutex );
......@@ -74,19 +68,19 @@ void VLCThumbnailer::requestThumbnail( MediaPtr media )
if ( m_thread.get_id() == compat::Thread::id{} )
{
m_run = true;
m_thread = compat::Thread( &VLCThumbnailer::run, this );
m_thread = compat::Thread( &ThumbnailerWorker::run, this );
}
else
m_cond.notify_all();
}
void VLCThumbnailer::pause()
void ThumbnailerWorker::pause()
{
std::lock_guard<compat::Mutex> lock( m_mutex );
m_paused = true;
}
void VLCThumbnailer::resume()
void ThumbnailerWorker::resume()
{
std::lock_guard<compat::Mutex> lock( m_mutex );
if ( m_paused == false )
......@@ -95,7 +89,7 @@ void VLCThumbnailer::resume()
m_cond.notify_all();
}
void VLCThumbnailer::run()
void ThumbnailerWorker::run()
{
LOG_INFO( "Starting thumbnailer thread" );
while ( m_run == true )
......@@ -121,7 +115,7 @@ void VLCThumbnailer::run()
LOG_INFO( "Exiting thumbnailer thread" );
}
void VLCThumbnailer::stop()
void ThumbnailerWorker::stop()
{
bool running = true;
if ( m_run.compare_exchange_strong( running, false ) )
......@@ -136,7 +130,7 @@ void VLCThumbnailer::stop()
}
}
bool VLCThumbnailer::generateThumbnail( MediaPtr media )
bool ThumbnailerWorker::generateThumbnail( MediaPtr media )
{
assert( media->type() != Media::Type::Audio );
......
......@@ -34,11 +34,11 @@
namespace medialibrary
{
class VLCThumbnailer
class ThumbnailerWorker
{
public:
explicit VLCThumbnailer( MediaLibraryPtr ml );
virtual ~VLCThumbnailer();
explicit ThumbnailerWorker( MediaLibraryPtr ml );
virtual ~ThumbnailerWorker();
void requestThumbnail( MediaPtr media );
void pause();
void resume();
......
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