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

fs: Factory: Add start/stop methods

parent c5576136
......@@ -76,6 +76,16 @@ namespace fs
/// \brief scheme Returns the mrl scheme handled by this file system factory
///
virtual const std::string& scheme() const = 0;
///
/// \brief start Starts any potential background operation that would be
/// required by this factory.
///
virtual void start() = 0;
///
/// \brief stop stops any potential background operation that would be
/// required by this factory.
///
virtual void stop() = 0;
};
}
......
......@@ -142,6 +142,14 @@ const std::string&FileSystemFactory::scheme() const
return s;
}
void FileSystemFactory::start()
{
}
void FileSystemFactory::stop()
{
}
}
}
......@@ -49,6 +49,8 @@ namespace factory
virtual bool isMrlSupported( const std::string& path ) const override;
virtual bool isNetworkFileSystem() const override;
virtual const std::string& scheme() const override;
virtual void start() override;
virtual void stop() override;
private:
DeviceListerPtr m_deviceLister;
......
......@@ -51,7 +51,6 @@ NetworkFileSystemFactory::NetworkFileSystemFactory( const std::string& protocol,
auto& em = m_mediaList->eventManager();
em.onItemAdded( [this]( VLC::MediaPtr m, int ) { onDeviceAdded( std::move( m ) ); } );
em.onItemDeleted( [this]( VLC::MediaPtr m, int ) { onDeviceRemoved( std::move( m ) ); } );
m_discoverer.start();
}
std::shared_ptr<fs::IDirectory> NetworkFileSystemFactory::createDirectory( const std::string& path )
......@@ -106,6 +105,16 @@ const std::string& NetworkFileSystemFactory::scheme() const
return m_protocol;
}
void NetworkFileSystemFactory::start()
{
m_discoverer.start();
}
void NetworkFileSystemFactory::stop()
{
m_discoverer.stop();
}
void NetworkFileSystemFactory::onDeviceAdded( VLC::MediaPtr media )
{
const auto& mrl = media->mrl();
......
......@@ -50,6 +50,8 @@ public:
virtual bool isMrlSupported( const std::string& path ) const override;
virtual bool isNetworkFileSystem() const override;
virtual const std::string& scheme() const override;
virtual void start() override;
virtual void stop() override;
private:
void onDeviceAdded( VLC::MediaPtr media );
......
......@@ -219,6 +219,9 @@ struct FileSystemFactory : public fs::IFileSystemFactory
return s;
}
virtual void start() override {}
virtual void stop() override {}
std::vector<std::shared_ptr<Device>> devices;
};
......@@ -390,6 +393,8 @@ public:
{
return false;
}
virtual void start() override {}
virtual void stop() override {}
};
}
......
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