summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-10-21 20:01:19 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-11-19 18:30:26 +0100
commitf7ddfd451775afd5f7c95771ce2a6b80b703836b (patch)
tree714afe072f5e5509e35920742813c4b71128983a
parent40888cfdcee71b0f8daab96a0bfdda7302be02ae (diff)
libcamera: camera: Remove explicit stream to buffer map in requestCompleted signal
The stream to buffer map in the requestCompleted signal is taken directly from the request which is part of the same signal. Remove the map as it can be fetched directly from the request. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--include/libcamera/camera.h3
-rw-r--r--src/android/camera_device.cpp4
-rw-r--r--src/android/camera_device.h3
-rw-r--r--src/cam/capture.cpp4
-rw-r--r--src/cam/capture.h3
-rw-r--r--src/libcamera/camera.cpp2
-rw-r--r--src/qcam/main_window.cpp5
-rw-r--r--src/qcam/main_window.h4
-rw-r--r--test/camera/capture.cpp4
9 files changed, 16 insertions, 16 deletions
diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h
index 21fac550..ef6a37bb 100644
--- a/include/libcamera/camera.h
+++ b/include/libcamera/camera.h
@@ -7,7 +7,6 @@
#ifndef __LIBCAMERA_CAMERA_H__
#define __LIBCAMERA_CAMERA_H__
-#include <map>
#include <memory>
#include <set>
#include <stdint.h>
@@ -79,7 +78,7 @@ public:
const std::string &name() const;
Signal<Request *, Buffer *> bufferCompleted;
- Signal<Request *, const std::map<Stream *, Buffer *> &> requestCompleted;
+ Signal<Request *> requestCompleted;
Signal<Camera *> disconnected;
int acquire();
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 897f5458..065e0292 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -769,9 +769,9 @@ error:
delete descriptor;
}
-void CameraDevice::requestComplete(Request *request,
- const std::map<Stream *, Buffer *> &buffers)
+void CameraDevice::requestComplete(Request *request)
{
+ const std::map<Stream *, Buffer *> &buffers = request->buffers();
Buffer *libcameraBuffer = buffers.begin()->second;
camera3_buffer_status status = CAMERA3_BUFFER_STATUS_OK;
std::unique_ptr<CameraMetadata> resultMetadata;
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index 2105b5b9..caa617dc 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -34,8 +34,7 @@ public:
const camera_metadata_t *constructDefaultRequestSettings(int type);
int configureStreams(camera3_stream_configuration_t *stream_list);
void processCaptureRequest(camera3_capture_request_t *request);
- void requestComplete(libcamera::Request *request,
- const std::map<libcamera::Stream *, libcamera::Buffer *> &buffers);
+ void requestComplete(libcamera::Request *request);
private:
struct Camera3RequestDescriptor {
diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp
index 0d7854d6..27332df1 100644
--- a/src/cam/capture.cpp
+++ b/src/cam/capture.cpp
@@ -133,11 +133,13 @@ int Capture::capture(EventLoop *loop)
return ret;
}
-void Capture::requestComplete(Request *request, const std::map<Stream *, Buffer *> &buffers)
+void Capture::requestComplete(Request *request)
{
if (request->status() == Request::RequestCancelled)
return;
+ const std::map<Stream *, Buffer *> &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();
fps = last_ != std::chrono::steady_clock::time_point() && fps
diff --git a/src/cam/capture.h b/src/cam/capture.h
index ee0dc421..4d396afb 100644
--- a/src/cam/capture.h
+++ b/src/cam/capture.h
@@ -28,8 +28,7 @@ public:
private:
int capture(EventLoop *loop);
- void requestComplete(libcamera::Request *request,
- const std::map<libcamera::Stream *, libcamera::Buffer *> &buffers);
+ void requestComplete(libcamera::Request *request);
libcamera::Camera *camera_;
libcamera::CameraConfiguration *config_;
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 76c737cb..e810fb72 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -919,7 +919,7 @@ void Camera::requestComplete(Request *request)
stream->unmapBuffer(buffer);
}
- requestCompleted.emit(request, request->buffers());
+ requestCompleted.emit(request);
delete request;
}
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index 3d563092..cca7365a 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -248,12 +248,13 @@ void MainWindow::stopCapture()
setWindowTitle(title_);
}
-void MainWindow::requestComplete(Request *request,
- const std::map<Stream *, Buffer *> &buffers)
+void MainWindow::requestComplete(Request *request)
{
if (request->status() == Request::RequestCancelled)
return;
+ const std::map<Stream *, Buffer *> &buffers = request->buffers();
+
framesCaptured_++;
Buffer *buffer = buffers.begin()->second;
diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h
index 30dd8743..0786e915 100644
--- a/src/qcam/main_window.h
+++ b/src/qcam/main_window.h
@@ -7,7 +7,6 @@
#ifndef __QCAM_MAIN_WINDOW_H__
#define __QCAM_MAIN_WINDOW_H__
-#include <map>
#include <memory>
#include <QElapsedTimer>
@@ -49,8 +48,7 @@ private:
int startCapture();
void stopCapture();
- void requestComplete(Request *request,
- const std::map<Stream *, Buffer *> &buffers);
+ void requestComplete(Request *request);
int display(Buffer *buffer);
QString title_;
diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
index 791ccad1..83f97474 100644
--- a/test/camera/capture.cpp
+++ b/test/camera/capture.cpp
@@ -27,11 +27,13 @@ protected:
completeBuffersCount_++;
}
- void requestComplete(Request *request, const std::map<Stream *, Buffer *> &buffers)
+ void requestComplete(Request *request)
{
if (request->status() != Request::RequestComplete)
return;
+ const std::map<Stream *, Buffer *> &buffers = request->buffers();
+
completeRequestsCount_++;
/* Create a new request. */