diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-03-14 16:14:27 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-03-18 19:15:18 +0200 |
commit | 33fedea818e2b6a9ed68ac86acf194b1a2da8828 (patch) | |
tree | b350f4bc1710775cfe82af3bd7b1f36ce9ee5d2a /src/libcamera/pipeline/vimc.cpp | |
parent | 9da27d5d844fa1378a4897a637c45ade275cc7e5 (diff) |
libcamera: pipeline_handler: Fold buffer management with start/stop
There's no need anymore to have the Camera object control how and when
pipeline handlers allocate and free the buffers for the
application-facing video devices. Fold those operations, currently
performed by importFrameBuffers() and freeFrameBuffers(), into the
start() and stop() functions. This simplifies the pipeline handler API,
its implementation, and the implementation of the Camera class.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/pipeline/vimc.cpp')
-rw-r--r-- | src/libcamera/pipeline/vimc.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index 097bbd5b..fa84f0c1 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -83,8 +83,6 @@ public: int exportFrameBuffers(Camera *camera, Stream *stream, std::vector<std::unique_ptr<FrameBuffer>> *buffers) override; - int importFrameBuffers(Camera *camera, Stream *stream) override; - void freeFrameBuffers(Camera *camera, Stream *stream) override; int start(Camera *camera) override; void stop(Camera *camera) override; @@ -267,31 +265,29 @@ int PipelineHandlerVimc::exportFrameBuffers(Camera *camera, Stream *stream, return data->video_->exportBuffers(count, buffers); } -int PipelineHandlerVimc::importFrameBuffers(Camera *camera, Stream *stream) +int PipelineHandlerVimc::start(Camera *camera) { VimcCameraData *data = cameraData(camera); - unsigned int count = stream->configuration().bufferCount; + unsigned int count = data->stream_.configuration().bufferCount; - return data->video_->importBuffers(count); -} - -void PipelineHandlerVimc::freeFrameBuffers(Camera *camera, Stream *stream) -{ - VimcCameraData *data = cameraData(camera); + int ret = data->video_->importBuffers(count); + if (ret < 0) + return ret; - data->video_->releaseBuffers(); -} + ret = data->video_->streamOn(); + if (ret < 0) { + data->video_->releaseBuffers(); + return ret; + } -int PipelineHandlerVimc::start(Camera *camera) -{ - VimcCameraData *data = cameraData(camera); - return data->video_->streamOn(); + return 0; } void PipelineHandlerVimc::stop(Camera *camera) { VimcCameraData *data = cameraData(camera); data->video_->streamOff(); + data->video_->releaseBuffers(); } int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request) |