Commit dcc02476 authored by Kieran Bingham's avatar Kieran Bingham
Browse files

libcamera: buffer: Break friendship with Request



The FrameBuffer class is only friends with Request so that the request
can be associated with the buffers.

FrameBuffer already has a helper to setRequest(), so let's use that
directly instead.
Reviewed-by: default avatarPaul Elder <paul.elder@ideasonboard.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarKieran Bingham <kieran.bingham@ideasonboard.com>
parent 70238cec
......@@ -56,7 +56,6 @@ public:
private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(FrameBuffer)
friend class Request; /* Needed to update request_. */
friend class V4L2VideoDevice; /* Needed to update metadata_. */
std::vector<Plane> planes_;
......
......@@ -118,8 +118,9 @@ void Request::reuse(ReuseFlag flags)
pending_.clear();
if (flags & ReuseBuffers) {
for (auto pair : bufferMap_) {
pair.second->request_ = this;
pending_.insert(pair.second);
FrameBuffer *buffer = pair.second;
buffer->setRequest(this);
pending_.insert(buffer);
}
} else {
bufferMap_.clear();
......@@ -187,7 +188,7 @@ int Request::addBuffer(const Stream *stream, FrameBuffer *buffer)
return -EEXIST;
}
buffer->request_ = this;
buffer->setRequest(this);
pending_.insert(buffer);
bufferMap_[stream] = buffer;
......@@ -294,7 +295,7 @@ bool Request::completeBuffer(FrameBuffer *buffer)
int ret = pending_.erase(buffer);
ASSERT(ret == 1);
buffer->request_ = nullptr;
buffer->setRequest(nullptr);
if (buffer->metadata().status == FrameMetadata::FrameCancelled)
cancelled_ = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment