diff options
Diffstat (limited to 'src/libcamera')
-rw-r--r-- | src/libcamera/camera.cpp | 4 | ||||
-rw-r--r-- | src/libcamera/stream.cpp | 36 |
2 files changed, 36 insertions, 4 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 1f307654..61d3e821 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -683,7 +683,7 @@ int Camera::configure(CameraConfiguration *config) * Allocate buffer objects in the pool. * Memory will be allocated and assigned later. */ - stream->bufferPool().createBuffers(cfg.bufferCount); + stream->createBuffers(cfg.bufferCount); } state_ = CameraConfigured; @@ -744,7 +744,7 @@ int Camera::freeBuffers() * All mappings must be destroyed before buffers can be freed * by the V4L2 device that has allocated them. */ - stream->bufferPool().destroyBuffers(); + stream->destroyBuffers(); } state_ = CameraConfigured; diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index 6d80646b..12067c08 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -435,20 +435,52 @@ std::unique_ptr<Buffer> Stream::createBuffer(unsigned int index) * \fn Stream::bufferPool() * \brief Retrieve the buffer pool for the stream * - * The buffer pool handles the buffers used to capture frames at the output of - * the stream. It is initially created empty and shall be populated with + * The buffer pool handles the memory buffers used to store frames for the + * stream. It is initially created empty and shall be populated with * buffers before being used. * * \return A reference to the buffer pool */ /** + * \fn Stream::buffers() + * \brief Retrieve the memory buffers in the Stream's buffer pool + * \return The list of stream's memory buffers + */ + +/** * \fn Stream::configuration() * \brief Retrieve the active configuration of the stream * \return The active configuration of the stream */ /** + * \brief Create buffers for the stream + * \param[in] count The number of buffers to create + * + * Create \a count empty buffers in the Stream's buffer pool. + */ +void Stream::createBuffers(unsigned int count) +{ + destroyBuffers(); + if (count == 0) + return; + + bufferPool_.createBuffers(count); +} + +/** + * \brief Destroy buffers in the stream + * + * If no buffers have been created or if buffers have already been destroyed no + * operation is performed. + */ +void Stream::destroyBuffers() +{ + bufferPool_.destroyBuffers(); +} + +/** * \var Stream::bufferPool_ * \brief The pool of buffers associated with the stream * |