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

parser: Use shared_ptr for parser services

Since we want those to be provided by the users, but don't want to
prevent them from owning their own services
parent e1e4de12
......@@ -714,8 +714,8 @@ void MediaLibrary::startParser()
{
m_parser.reset( new parser::Parser( this ) );
std::unique_ptr<parser::VLCMetadataService> vlcService( new parser::VLCMetadataService );
std::unique_ptr<parser::MetadataAnalyzer> metadataService( new parser::MetadataAnalyzer );
auto vlcService = std::make_shared<parser::VLCMetadataService>();
auto metadataService = std::make_shared<parser::MetadataAnalyzer>();
m_parser->addService( std::move( vlcService ) );
m_parser->addService( std::move( metadataService ) );
m_parser->start();
......
......@@ -50,7 +50,7 @@ public:
class Parser : IParserCb
{
public:
using ServicePtr = std::unique_ptr<IParserService>;
using ServicePtr = std::shared_ptr<IParserService>;
using WorkerPtr = std::unique_ptr<Worker>;
Parser( MediaLibrary* ml );
......
......@@ -101,7 +101,7 @@ void Worker::parse( std::shared_ptr<Task> t )
}
bool Worker::initialize( MediaLibrary* ml, IParserCb* parserCb,
std::unique_ptr<IParserService> service )
std::shared_ptr<IParserService> service )
{
m_ml = ml;
m_service = std::move( service );
......
......@@ -63,7 +63,7 @@ public:
///
void stop();
void parse( std::shared_ptr<Task> t );
bool initialize( MediaLibrary* ml, IParserCb* parserCb, std::unique_ptr<IParserService> service );
bool initialize( MediaLibrary* ml, IParserCb* parserCb, std::shared_ptr<IParserService> service );
bool isIdle() const;
///
/// \brief flush flush every currently scheduled tasks
......@@ -87,7 +87,7 @@ private:
private:
MediaLibrary* m_ml;
std::unique_ptr<IParserService> m_service;
std::shared_ptr<IParserService> m_service;
IParserCb* m_parserCb;
bool m_stopParser;
bool m_paused;
......
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