libcamera
v0.3.2+116-83c5ad0f
Supporting cameras in Linux since 2019
|
Provide access and manage all cameras in the system. More...
Inherits Object, and Extensible.
Public Member Functions | |
~CameraManager () | |
Destroy the camera manager. More... | |
int | start () |
Start the camera manager. More... | |
void | stop () |
Stop the camera manager. More... | |
std::vector< std::shared_ptr< Camera > > | cameras () const |
Retrieve all available cameras. More... | |
std::shared_ptr< Camera > | get (const std::string &id) |
Get a camera based on ID. More... | |
Static Public Member Functions | |
static const std::string & | version () |
Retrieve the libcamera version string. More... | |
Public Attributes | |
Signal< std::shared_ptr< Camera > > | cameraAdded |
Notify of a new camera added to the system. More... | |
Signal< std::shared_ptr< Camera > > | cameraRemoved |
Notify of a new camera removed from the system. More... | |
Provide access and manage all cameras in the system.
The camera manager is the entry point to libcamera. It enumerates devices, associates them with pipeline managers, and provides access to the cameras in the system to applications. The manager owns all Camera objects and handles hot-plugging and hot-unplugging to manage the lifetime of cameras.
To interact with libcamera, an application starts by creating a camera manager instance. Only a single instance of the camera manager may exist at a time. Attempting to create a second instance without first deleting the existing instance results in undefined behaviour.
The manager is initially stopped, and shall be started with start(). This will enumerate all the cameras present in the system, which can then be listed with list() and retrieved with get().
Cameras are shared through std::shared_ptr<>, ensuring that a camera will stay valid until the last reference is released without requiring any special action from the application. Once the application has released all the references it held to cameras, the camera manager can be stopped with stop().
libcamera::CameraManager::~CameraManager | ( | ) |
Destroy the camera manager.
Destroying the camera manager stops it if it is currently running.
std::vector< std::shared_ptr< Camera > > libcamera::CameraManager::cameras | ( | ) | const |
Retrieve all available cameras.
Before calling this function the caller is responsible for ensuring that the camera manager is running.
std::shared_ptr< Camera > libcamera::CameraManager::get | ( | const std::string & | id | ) |
Get a camera based on ID.
[in] | id | ID of camera to get |
Before calling this function the caller is responsible for ensuring that the camera manager is running.
int libcamera::CameraManager::start | ( | ) |
Start the camera manager.
Start the camera manager and enumerate all devices in the system. Once the start has been confirmed the user is free to list and otherwise interact with cameras in the system until either the camera manager is stopped or the camera is unplugged from the system.
void libcamera::CameraManager::stop | ( | ) |
Stop the camera manager.
Before stopping the camera manager the caller is responsible for making sure all cameras provided by the manager are returned to the manager.
After the manager has been stopped no resource provided by the camera manager should be consider valid or functional even if they for one reason or another have yet to be deleted.
|
inlinestatic |
Retrieve the libcamera version string.
libcamera::CameraManager::cameraAdded |
Notify of a new camera added to the system.
This signal is emitted when a new camera is detected and successfully handled by the camera manager. The notification occurs alike for cameras detected when the manager is started with start() or when new cameras are later connected to the system. When the signal is emitted the new camera is already available from the list of cameras().
The signal is emitted from the CameraManager thread. Applications shall minimize the time spent in the signal handler and shall in particular not perform any blocking operation.
libcamera::CameraManager::cameraRemoved |
Notify of a new camera removed from the system.
This signal is emitted when a camera is removed from the system. When the signal is emitted the camera is not available from the list of cameras() anymore.
The signal is emitted from the CameraManager thread. Applications shall minimize the time spent in the signal handler and shall in particular not perform any blocking operation.