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