@@ -96,12 +96,21 @@ std::map<Stream *, BufferPool *>
PipelineHandlerUVC::allocateBuffers(Camera *camera,
std::map<Stream *, StreamConfiguration> &config)
{
- return std::map<Stream *, BufferPool *> {};
+ StreamConfiguration *cfg = &config[&stream_];
+
+ LOG(UVC, Debug) << "Requesting " << cfg->bufferCount << " buffers";
+
+ BufferPool *pool = video_->requestBuffers(cfg->bufferCount);
+
+ if (!pool)
+ LOG(UVC, Error) << "Failed to acquire a buffer pool";
+
+ return std::map<Stream *, BufferPool *> { {&stream_, pool} };
}
int PipelineHandlerUVC::freeBuffers(Camera *camera)
{
- return 0;
+ return video_->releaseBuffers();
}
int PipelineHandlerUVC::start(const Camera *camera)
Allow the UVC pipeline to allocate and free buffers for the single stream attached to the camera. The buffers are allocated and freed utilising the V4L2Device requestBuffers() and releaseBuffers() interface. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> --- src/libcamera/pipeline/uvcvideo.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)