diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2020-09-23 19:05:41 +0900 |
---|---|---|
committer | Paul Elder <paul.elder@ideasonboard.com> | 2020-10-12 11:32:40 +0900 |
commit | c753223ad6b90550fae31aedd79fbedc13da2e75 (patch) | |
tree | 957c83eb734fbfc633fd3a0a39c8339695323fe4 /include | |
parent | 05cdef27ab766a199a256c73ef4b338ce4f4dac5 (diff) |
libcamera, android, cam, gstreamer, qcam, v4l2: Reuse Request
Allow reuse of the Request object by implementing reuse(). This means
the applications now have the responsibility of freeing the Request
objects, so make all libcamera users (cam, qcam, v4l2-compat, gstreamer,
android) do so.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/camera.h | 2 | ||||
-rw-r--r-- | include/libcamera/request.h | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h index a2ee4e7e..79ff8d6b 100644 --- a/include/libcamera/camera.h +++ b/include/libcamera/camera.h @@ -96,7 +96,7 @@ public: std::unique_ptr<CameraConfiguration> generateConfiguration(const StreamRoles &roles = {}); int configure(CameraConfiguration *config); - Request *createRequest(uint64_t cookie = 0); + std::unique_ptr<Request> createRequest(uint64_t cookie = 0); int queueRequest(Request *request); int start(); diff --git a/include/libcamera/request.h b/include/libcamera/request.h index 5976ac50..655b1324 100644 --- a/include/libcamera/request.h +++ b/include/libcamera/request.h @@ -31,6 +31,11 @@ public: RequestCancelled, }; + enum ReuseFlag { + Default = 0, + ReuseBuffers = (1 << 0), + }; + using BufferMap = std::map<const Stream *, FrameBuffer *>; Request(Camera *camera, uint64_t cookie = 0); @@ -38,6 +43,8 @@ public: Request &operator=(const Request &) = delete; ~Request(); + void reuse(ReuseFlag flags = Default); + ControlList &controls() { return *controls_; } ControlList &metadata() { return *metadata_; } const BufferMap &buffers() const { return bufferMap_; } |