libcamera: camera: Implement the threading model

Document the threading model of the Camera class and implement it.
Selected functions become thread-safe, and require a few functions of
the PipelineHandler class to be called through cross-thread invocation
as the pipeline handlers live in the camera manager thread, while the
Camera class is mostly accessed from the application thread. The
PipelineHandler is made to inherit from the Object class to support
this.

Disconnection is currently left out as it is not implemented in pipeline
handlers, and isn't fully supported in the Camera class either. This
will be revisited when implementing proper hotplug support.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart
2020-01-18 03:09:33 +02:00
parent 1aa49db823
commit a8310248fc
2 changed files with 83 additions and 27 deletions
+3 -1
View File
@@ -17,6 +17,7 @@
#include <ipa/ipa_interface.h>
#include <libcamera/controls.h>
#include <libcamera/object.h>
#include <libcamera/stream.h>
namespace libcamera {
@@ -51,7 +52,8 @@ private:
CameraData &operator=(const CameraData &) = delete;
};
class PipelineHandler : public std::enable_shared_from_this<PipelineHandler>
class PipelineHandler : public std::enable_shared_from_this<PipelineHandler>,
public Object
{
public:
PipelineHandler(CameraManager *manager);