libcamera: pipeline: Pass libcamera controls into pipeline_handler::start()
Applications now have the ability to pass in controls that need to be applied on startup, rather than doing it through Request where there might be some frames of delay in getting the controls applied. This commit adds the ability to pass in a set of libcamera controls into the pipeline handlers through the pipeline_handler::start() method. These controls are provided by the application through the camera::start() public API. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
ee477efde8
commit
a62b35b8c0
11 changed files with 24 additions and 21 deletions
|
@ -209,7 +209,7 @@ methods for the overridden class members.
|
|||
int exportFrameBuffers(Camera *camera, Stream *stream,
|
||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
|
||||
|
||||
int start(Camera *camera) override;
|
||||
int start(Camera *camera, ControlList *controls) override;
|
||||
void stop(Camera *camera) override;
|
||||
|
||||
int queueRequestDevice(Camera *camera, Request *request) override;
|
||||
|
@ -239,7 +239,7 @@ methods for the overridden class members.
|
|||
return -1;
|
||||
}
|
||||
|
||||
int PipelineHandlerVivid::start(Camera *camera)
|
||||
int PipelineHandlerVivid::start(Camera *camera, ControlList *controls)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
std::unique_ptr<Request> createRequest(uint64_t cookie = 0);
|
||||
int queueRequest(Request *request);
|
||||
|
||||
int start();
|
||||
int start(ControlList *controls = nullptr);
|
||||
int stop();
|
||||
|
||||
private:
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
virtual int exportFrameBuffers(Camera *camera, Stream *stream,
|
||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers) = 0;
|
||||
|
||||
virtual int start(Camera *camera) = 0;
|
||||
virtual int start(Camera *camera, ControlList *controls) = 0;
|
||||
virtual void stop(Camera *camera) = 0;
|
||||
|
||||
int queueRequest(Camera *camera, Request *request);
|
||||
|
|
|
@ -1002,10 +1002,12 @@ int Camera::queueRequest(Request *request)
|
|||
|
||||
/**
|
||||
* \brief Start capture from camera
|
||||
* \param[in] controls Controls to be applied before starting the Camera
|
||||
*
|
||||
* Start the camera capture session. Once the camera is started the application
|
||||
* can queue requests to the camera to process and return to the application
|
||||
* until the capture session is terminated with \a stop().
|
||||
* Start the camera capture session, optionally providing a list of controls to
|
||||
* apply before starting. Once the camera is started the application can queue
|
||||
* requests to the camera to process and return to the application until the
|
||||
* capture session is terminated with \a stop().
|
||||
*
|
||||
* \context This function may only be called when the camera is in the
|
||||
* Configured state as defined in \ref camera_operation, and shall be
|
||||
|
@ -1016,7 +1018,7 @@ int Camera::queueRequest(Request *request)
|
|||
* \retval -ENODEV The camera has been disconnected from the system
|
||||
* \retval -EACCES The camera is not in a state where it can be started
|
||||
*/
|
||||
int Camera::start()
|
||||
int Camera::start(ControlList *controls)
|
||||
{
|
||||
Private *const d = LIBCAMERA_D_PTR();
|
||||
|
||||
|
@ -1027,7 +1029,7 @@ int Camera::start()
|
|||
LOG(Camera, Debug) << "Starting capture";
|
||||
|
||||
ret = d->pipe_->invokeMethod(&PipelineHandler::start,
|
||||
ConnectionTypeBlocking, this);
|
||||
ConnectionTypeBlocking, this, controls);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
int exportFrameBuffers(Camera *camera, Stream *stream,
|
||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
|
||||
|
||||
int start(Camera *camera) override;
|
||||
int start(Camera *camera, ControlList *controls) override;
|
||||
void stop(Camera *camera) override;
|
||||
|
||||
int queueRequestDevice(Camera *camera, Request *request) override;
|
||||
|
@ -596,7 +596,7 @@ int PipelineHandlerIPU3::freeBuffers(Camera *camera)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int PipelineHandlerIPU3::start(Camera *camera)
|
||||
int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] ControlList *controls)
|
||||
{
|
||||
IPU3CameraData *data = cameraData(camera);
|
||||
CIO2Device *cio2 = &data->cio2_;
|
||||
|
|
|
@ -242,7 +242,7 @@ public:
|
|||
int exportFrameBuffers(Camera *camera, Stream *stream,
|
||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
|
||||
|
||||
int start(Camera *camera) override;
|
||||
int start(Camera *camera, ControlList *controls) override;
|
||||
void stop(Camera *camera) override;
|
||||
|
||||
int queueRequestDevice(Camera *camera, Request *request) override;
|
||||
|
@ -731,7 +731,7 @@ int PipelineHandlerRPi::exportFrameBuffers([[maybe_unused]] Camera *camera, Stre
|
|||
return ret;
|
||||
}
|
||||
|
||||
int PipelineHandlerRPi::start(Camera *camera)
|
||||
int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *controls)
|
||||
{
|
||||
RPiCameraData *data = cameraData(camera);
|
||||
int ret;
|
||||
|
|
|
@ -187,7 +187,7 @@ public:
|
|||
int exportFrameBuffers(Camera *camera, Stream *stream,
|
||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
|
||||
|
||||
int start(Camera *camera) override;
|
||||
int start(Camera *camera, ControlList *controls) override;
|
||||
void stop(Camera *camera) override;
|
||||
|
||||
int queueRequestDevice(Camera *camera, Request *request) override;
|
||||
|
@ -832,7 +832,7 @@ int PipelineHandlerRkISP1::freeBuffers(Camera *camera)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int PipelineHandlerRkISP1::start(Camera *camera)
|
||||
int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *controls)
|
||||
{
|
||||
RkISP1CameraData *data = cameraData(camera);
|
||||
int ret;
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
int exportFrameBuffers(Camera *camera, Stream *stream,
|
||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
|
||||
|
||||
int start(Camera *camera) override;
|
||||
int start(Camera *camera, ControlList *controls) override;
|
||||
void stop(Camera *camera) override;
|
||||
|
||||
bool match(DeviceEnumerator *enumerator) override;
|
||||
|
@ -646,7 +646,7 @@ int SimplePipelineHandler::exportFrameBuffers(Camera *camera, Stream *stream,
|
|||
return data->video_->exportBuffers(count, buffers);
|
||||
}
|
||||
|
||||
int SimplePipelineHandler::start(Camera *camera)
|
||||
int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] ControlList *controls)
|
||||
{
|
||||
SimpleCameraData *data = cameraData(camera);
|
||||
V4L2VideoDevice *video = data->video_;
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
int exportFrameBuffers(Camera *camera, Stream *stream,
|
||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
|
||||
|
||||
int start(Camera *camera) override;
|
||||
int start(Camera *camera, ControlList *controls) override;
|
||||
void stop(Camera *camera) override;
|
||||
|
||||
int queueRequestDevice(Camera *camera, Request *request) override;
|
||||
|
@ -236,7 +236,7 @@ int PipelineHandlerUVC::exportFrameBuffers(Camera *camera, Stream *stream,
|
|||
return data->video_->exportBuffers(count, buffers);
|
||||
}
|
||||
|
||||
int PipelineHandlerUVC::start(Camera *camera)
|
||||
int PipelineHandlerUVC::start(Camera *camera, [[maybe_unused]] ControlList *controls)
|
||||
{
|
||||
UVCCameraData *data = cameraData(camera);
|
||||
unsigned int count = data->stream_.configuration().bufferCount;
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
int exportFrameBuffers(Camera *camera, Stream *stream,
|
||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
|
||||
|
||||
int start(Camera *camera) override;
|
||||
int start(Camera *camera, ControlList *controls) override;
|
||||
void stop(Camera *camera) override;
|
||||
|
||||
int queueRequestDevice(Camera *camera, Request *request) override;
|
||||
|
@ -313,7 +313,7 @@ int PipelineHandlerVimc::exportFrameBuffers(Camera *camera, Stream *stream,
|
|||
return data->video_->exportBuffers(count, buffers);
|
||||
}
|
||||
|
||||
int PipelineHandlerVimc::start(Camera *camera)
|
||||
int PipelineHandlerVimc::start(Camera *camera, [[maybe_unused]] ControlList *controls)
|
||||
{
|
||||
VimcCameraData *data = cameraData(camera);
|
||||
unsigned int count = data->stream_.configuration().bufferCount;
|
||||
|
|
|
@ -351,6 +351,7 @@ const ControlList &PipelineHandler::properties(const Camera *camera) const
|
|||
* \fn PipelineHandler::start()
|
||||
* \brief Start capturing from a group of streams
|
||||
* \param[in] camera The camera to start
|
||||
* \param[in] controls Controls to be applied before starting the Camera
|
||||
*
|
||||
* Start the group of streams that have been configured for capture by
|
||||
* \a configure(). The intended caller of this method is the Camera class which
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue