libcamera: camera_manager: Make the class a singleton
There can only be a single camera manager instance in the application. Creating it as a singleton helps avoiding mistakes. It also allows the camera manager to be used as a storage of global data, such as the future event dispatcher. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
+1
-6
@@ -19,10 +19,7 @@ class ListTest : public Test
|
||||
protected:
|
||||
int init()
|
||||
{
|
||||
cm = new CameraManager();
|
||||
if (!cm)
|
||||
return -ENOMEM;
|
||||
|
||||
cm = CameraManager::instance();
|
||||
cm->start();
|
||||
|
||||
return 0;
|
||||
@@ -43,8 +40,6 @@ protected:
|
||||
void cleanup()
|
||||
{
|
||||
cm->stop();
|
||||
|
||||
delete cm;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user