libcamera
v0.3.2+116-83c5ad0f
Supporting cameras in Linux since 2019
|
Provide access and manage all cameras in the system. More...
Classes | |
class | Private |
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... | |
Public Member Functions inherited from libcamera::Object | |
Object (Object *parent=nullptr) | |
Construct an Object instance. More... | |
virtual | ~Object () |
Destroy an Object instance. More... | |
void | deleteLater () |
Schedule deletion of the instance in the thread it belongs to. More... | |
void | postMessage (std::unique_ptr< Message > msg) |
Post a message to the object's thread. More... | |
template<typename T , typename R , typename... FuncArgs, typename... Args, std::enable_if_t< std::is_base_of< Object, T >::value > * = nullptr> | |
R | invokeMethod (R(T::*func)(FuncArgs...), ConnectionType type, Args &&... args) |
Invoke a method asynchronously on an Object instance. More... | |
Thread * | thread () const |
Retrieve the thread the object is bound to. More... | |
void | moveToThread (Thread *thread) |
Move the object and all its children to a different thread. More... | |
Object * | parent () const |
Retrieve the object's parent. More... | |
Public Member Functions inherited from libcamera::Extensible | |
Extensible (std::unique_ptr< Private > d) | |
Construct an instance of an Extensible class. 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... | |
Additional Inherited Members | |
Protected Member Functions inherited from libcamera::Object | |
virtual void | message (Message *msg) |
Message handler for the object. More... | |
bool | assertThreadBound (const char *message) |
Check if the caller complies with thread-bound constraints. More... | |
Protected Member Functions inherited from libcamera::Extensible | |
template<typename T > | |
const T * | _d () const |
Retrieve the private data instance. More... | |
template<typename T > | |
T * | _d () |
Retrieve the private data instance. 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.