@@ -74,7 +74,7 @@ public:
std::unordered_set<const ControlId *> ids;
ids.insert(&ctrl);
- request->metadata().set<T, T>(ctrl, value);
+ request->_d()->metadata().set<T, T>(ctrl, value);
Camera *camera = request->_d()->camera();
camera->metadataAvailable.emit(request, ids);
@@ -92,7 +92,7 @@ public:
std::unordered_set<const ControlId *> ids;
ids.insert(&ctrl);
- request->metadata().set(ctrl, value);
+ request->_d()->metadata().set(ctrl, value);
Camera *camera = request->_d()->camera();
camera->metadataAvailable.emit(request, ids);
@@ -42,7 +42,8 @@ public:
void resetMetadata()
{
- _o<Request>()->metadata().clear();
+ ControlList &data = metadata();
+ data.clear();
}
void prepare(std::chrono::milliseconds timeout = 0ms);
@@ -52,6 +53,8 @@ private:
friend class PipelineHandler;
friend std::ostream &operator<<(std::ostream &out, const Request &r);
+ ControlList &metadata() { return _o<Request>()->metadataRW(); }
+
void doCancelRequest();
void emitPrepareCompleted();
void notifierActivated(FrameBuffer *buffer);
@@ -50,7 +50,7 @@ public:
void reuse(ReuseFlag flags = Default);
ControlList &controls() { return *controls_; }
- ControlList &metadata() { return *metadata_; }
+ const ControlList &metadata() { return *metadata_; }
const BufferMap &buffers() const { return bufferMap_; }
int addBuffer(const Stream *stream, FrameBuffer *buffer,
std::unique_ptr<Fence> fence = nullptr);
@@ -67,6 +67,8 @@ public:
private:
LIBCAMERA_DISABLE_COPY(Request)
+ ControlList &metadataRW() { return *metadata_; }
+
ControlList *controls_;
ControlList *metadata_;
BufferMap bufferMap_;
@@ -548,7 +548,7 @@ void PipelineHandler::metadataAvailable(Request *request, const ControlList &met
if (ids.empty())
return;
- request->metadata().merge(metadata);
+ request->_d()->metadata().merge(metadata);
Camera *camera = request->_d()->camera();
camera->metadataAvailable.emit(request, ids);
Restict access to the metadata list to return a const reference. Provide a Request::Private::metadata() function for the pipeline handler base class to access the metadata list in RW mode. All other users, of the public and internal API alike, can only access metadata through a const reference. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> --- include/libcamera/internal/pipeline_handler.h | 4 ++-- include/libcamera/internal/request.h | 5 ++++- include/libcamera/request.h | 4 +++- src/libcamera/pipeline_handler.cpp | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-)