summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-08-11 00:56:13 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-08-14 13:19:15 +0200
commitdac8e9552ccdff137e717270468e584c2a9895b9 (patch)
tree467e192ac4272d2e407d11192e40715040aacf53
parent02018a7d0222cefe8e6587deebe607917e20e2a1 (diff)
libcamera: request: Declare a using directive for map of buffers
Declare a using directive for the map of Stream to FrameBuffer. Update all users of Request::buffers() to use the new usage directive. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--include/libcamera/request.h6
-rw-r--r--src/android/camera_device.cpp2
-rw-r--r--src/cam/capture.cpp2
-rw-r--r--src/libcamera/request.cpp5
-rw-r--r--src/qcam/main_window.h4
-rw-r--r--test/camera/buffer_import.cpp2
-rw-r--r--test/camera/capture.cpp2
7 files changed, 15 insertions, 8 deletions
diff --git a/include/libcamera/request.h b/include/libcamera/request.h
index eded6831..e74f56a7 100644
--- a/include/libcamera/request.h
+++ b/include/libcamera/request.h
@@ -31,6 +31,8 @@ public:
RequestCancelled,
};
+ using BufferMap = std::map<Stream *, FrameBuffer *>;
+
Request(Camera *camera, uint64_t cookie = 0);
Request(const Request &) = delete;
Request &operator=(const Request &) = delete;
@@ -38,7 +40,7 @@ public:
ControlList &controls() { return *controls_; }
ControlList &metadata() { return *metadata_; }
- const std::map<Stream *, FrameBuffer *> &buffers() const { return bufferMap_; }
+ const BufferMap &buffers() const { return bufferMap_; }
int addBuffer(Stream *stream, FrameBuffer *buffer);
FrameBuffer *findBuffer(Stream *stream) const;
@@ -58,7 +60,7 @@ private:
CameraControlValidator *validator_;
ControlList *controls_;
ControlList *metadata_;
- std::map<Stream *, FrameBuffer *> bufferMap_;
+ BufferMap bufferMap_;
std::unordered_set<FrameBuffer *> pending_;
const uint64_t cookie_;
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index d9183501..3419236a 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1371,7 +1371,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
void CameraDevice::requestComplete(Request *request)
{
- const std::map<Stream *, FrameBuffer *> &buffers = request->buffers();
+ const Request::BufferMap &buffers = request->buffers();
camera3_buffer_status status = CAMERA3_BUFFER_STATUS_OK;
std::unique_ptr<CameraMetadata> resultMetadata;
Camera3RequestDescriptor *descriptor =
diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp
index 3d8e89d5..07203769 100644
--- a/src/cam/capture.cpp
+++ b/src/cam/capture.cpp
@@ -157,7 +157,7 @@ void Capture::requestComplete(Request *request)
if (request->status() == Request::RequestCancelled)
return;
- const std::map<Stream *, FrameBuffer *> &buffers = request->buffers();
+ const Request::BufferMap &buffers = request->buffers();
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
double fps = std::chrono::duration_cast<std::chrono::milliseconds>(now - last_).count();
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index f3753514..d5f11e8c 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -38,6 +38,11 @@ LOG_DEFINE_CATEGORY(Request)
*/
/**
+ * \typedef Request::BufferMap
+ * \brief A map of Stream to FrameBuffer pointers
+ */
+
+/**
* \class Request
* \brief A frame capture request
*
diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h
index 4606fe48..6e1bcd76 100644
--- a/src/qcam/main_window.h
+++ b/src/qcam/main_window.h
@@ -47,13 +47,13 @@ public:
{
}
- CaptureRequest(const std::map<Stream *, FrameBuffer *> &buffers,
+ CaptureRequest(const Request::BufferMap &buffers,
const ControlList &metadata)
: buffers_(buffers), metadata_(metadata)
{
}
- std::map<Stream *, FrameBuffer *> buffers_;
+ Request::BufferMap buffers_;
ControlList metadata_;
};
diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp
index 46e03746..726d2cb2 100644
--- a/test/camera/buffer_import.cpp
+++ b/test/camera/buffer_import.cpp
@@ -46,7 +46,7 @@ protected:
if (request->status() != Request::RequestComplete)
return;
- const std::map<Stream *, FrameBuffer *> &buffers = request->buffers();
+ const Request::BufferMap &buffers = request->buffers();
completeRequestsCount_++;
diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
index ea84daee..ae572eb9 100644
--- a/test/camera/capture.cpp
+++ b/test/camera/capture.cpp
@@ -39,7 +39,7 @@ protected:
if (request->status() != Request::RequestComplete)
return;
- const std::map<Stream *, FrameBuffer *> &buffers = request->buffers();
+ const Request::BufferMap &buffers = request->buffers();
completeRequestsCount_++;