@@ -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();
@@ -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;
@@ -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 {
@@ -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
@@ -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_;
@@ -919,7 +919,7 @@ void Camera::requestComplete(Request *request)
stream->unmapBuffer(buffer);
}
- requestCompleted.emit(request, request->buffers());
+ requestCompleted.emit(request);
delete request;
}
@@ -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;
@@ -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_;
@@ -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. */