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

Rename IMetadataCb to IMediaLibraryCb

This will be meant for potential future callbacks, in order to avoid
passing multiple one method callbacks to IMediaLibrary::initialize()
parent 0559c03c
......@@ -8,10 +8,10 @@
#include "factory/IFileSystem.h"
#include "IDiscoverer.h"
class IMetadataCb
class IMediaLibraryCb
{
public:
virtual ~IMetadataCb() = default;
virtual ~IMediaLibraryCb() = default;
/**
* @brief onMetadataUpdated Will be called when a file gets some updated metadata
* @param file The updated file.
......@@ -30,7 +30,7 @@ class IMediaLibrary
/// \param dbPath Path to the database
/// \return true in case of success, false otherwise
///
virtual bool initialize( const std::string& dbPath, const std::string& snapshotPath, IMetadataCb* metadataCb ) = 0;
virtual bool initialize( const std::string& dbPath, const std::string& snapshotPath, IMediaLibraryCb* metadataCb ) = 0;
/**
* Replaces the default filesystem factory
* The default one will use standard opendir/readdir functions
......
......@@ -68,7 +68,7 @@ void MediaLibrary::setFsFactory(std::shared_ptr<factory::IFileSystem> fsFactory)
m_fsFactory = fsFactory;
}
bool MediaLibrary::initialize( const std::string& dbPath, const std::string& snapshotPath, IMetadataCb* metadataCb )
bool MediaLibrary::initialize( const std::string& dbPath, const std::string& snapshotPath, IMediaLibraryCb* metadataCb )
{
if ( m_fsFactory == nullptr )
m_fsFactory.reset( new factory::FileSystemDefaultFactory );
......@@ -215,7 +215,7 @@ void MediaLibrary::addMetadataService(std::unique_ptr<IMetadataService> service)
m_parser->addService( std::move( service ) );
}
void MediaLibrary::parse(FilePtr file , IMetadataCb *cb)
void MediaLibrary::parse(FilePtr file , IMediaLibraryCb *cb)
{
m_parser->parse( file, cb );
}
......
......@@ -13,7 +13,7 @@ class MediaLibrary : public IMediaLibrary, public IDiscovererCb
public:
MediaLibrary();
~MediaLibrary();
virtual bool initialize( const std::string& dbPath, const std::string& snapshotPath, IMetadataCb* metadataCb );
virtual bool initialize( const std::string& dbPath, const std::string& snapshotPath, IMediaLibraryCb* metadataCb );
virtual void setFsFactory( std::shared_ptr<factory::IFileSystem> fsFactory ) override;
virtual std::vector<FilePtr> files();
......@@ -38,7 +38,7 @@ class MediaLibrary : public IMediaLibrary, public IDiscovererCb
virtual MoviePtr movie( const std::string& title );
virtual MoviePtr createMovie( const std::string& title );
virtual void parse( FilePtr file, IMetadataCb* cb );
virtual void parse( FilePtr file, IMediaLibraryCb* cb );
virtual void discover( const std::string& entryPoint ) override;
// IDiscovererCb implementation
......@@ -62,7 +62,7 @@ class MediaLibrary : public IMediaLibrary, public IDiscovererCb
std::shared_ptr<factory::IFileSystem> m_fsFactory;
std::vector<std::unique_ptr<IDiscoverer>> m_discoverers;
std::string m_snapshotPath;
IMetadataCb* m_metadataCb;
IMediaLibraryCb* m_metadataCb;
// Keep the parser as last field.
// The parser holds a (raw) pointer to the media library. When MediaLibrary's destructor gets called
......
......@@ -31,7 +31,7 @@ void Parser::addService(std::unique_ptr<IMetadataService> service)
});
}
void Parser::parse(FilePtr file, IMetadataCb* cb)
void Parser::parse(FilePtr file, IMediaLibraryCb* cb)
{
std::lock_guard<std::mutex> lock( m_lock );
......@@ -65,7 +65,7 @@ void Parser::run()
}
Parser::Task::Task( FilePtr file, Parser::ServiceList& serviceList, IMetadataCb* metadataCb )
Parser::Task::Task( FilePtr file, Parser::ServiceList& serviceList, IMediaLibraryCb* metadataCb )
: file(file)
, it( serviceList.begin() )
, end( serviceList.end() )
......
......@@ -19,7 +19,7 @@ class Parser : public IMetadataServiceCb
Parser();
~Parser();
void addService(std::unique_ptr<IMetadataService> service );
void parse( FilePtr file, IMetadataCb* cb );
void parse( FilePtr file, IMediaLibraryCb* cb );
private:
virtual void done( FilePtr file, ServiceStatus status, void* data );
......@@ -30,11 +30,11 @@ class Parser : public IMetadataServiceCb
typedef std::vector<ServicePtr> ServiceList;
struct Task
{
Task(FilePtr file, ServiceList& serviceList , IMetadataCb* metadataCb);
Task(FilePtr file, ServiceList& serviceList , IMediaLibraryCb* metadataCb);
FilePtr file;
ServiceList::iterator it;
ServiceList::iterator end;
IMetadataCb* cb;
IMediaLibraryCb* cb;
};
private:
......
......@@ -25,7 +25,7 @@ void Tests::TearDown()
}
void Tests::Reload(std::shared_ptr<factory::IFileSystem> fs /*= nullptr*/, IMetadataCb* metadataCb /*= nullptr*/ )
void Tests::Reload(std::shared_ptr<factory::IFileSystem> fs /*= nullptr*/, IMediaLibraryCb* metadataCb /*= nullptr*/ )
{
ml.reset( MediaLibraryFactory::create() );
if ( fs == nullptr )
......
......@@ -10,6 +10,6 @@ protected:
std::shared_ptr<factory::IFileSystem> defaultFs;
virtual void SetUp() override;
void Reload( std::shared_ptr<factory::IFileSystem> fs = nullptr, IMetadataCb* metadataCb = nullptr );
void Reload( std::shared_ptr<factory::IFileSystem> fs = nullptr, IMediaLibraryCb* metadataCb = nullptr );
virtual void TearDown() override;
};
......@@ -10,7 +10,7 @@
#include "IAlbumTrack.h"
#include "IVideoTrack.h"
class ServiceCb : public IMetadataCb
class ServiceCb : public IMediaLibraryCb
{
public:
std::condition_variable waitCond;
......
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