summaryrefslogtreecommitdiff
path: root/src/cam/camera_session.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-05 06:40:19 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-22 17:13:39 +0300
commit94d828d880492617c936434a5ca93ee83366a31b (patch)
treeb4a671605782069d6bbc410292f6075296e466ff /src/cam/camera_session.h
parent180e95f06a4c0a97f58b9f791d0b48298fdd7def (diff)
cam: Rename Capture to CameraSession
Rename the Capture class to CameraSession, to prepare for multi-camera support that will gather more camera-related operations than capture in that class. While at it, remove an unneeded blank line. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/cam/camera_session.h')
-rw-r--r--src/cam/camera_session.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/cam/camera_session.h b/src/cam/camera_session.h
new file mode 100644
index 00000000..ef8a11c3
--- /dev/null
+++ b/src/cam/camera_session.h
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2019, Google Inc.
+ *
+ * camera_session.h - Camera capture session
+ */
+#ifndef __CAM_CAMERA_SESSION_H__
+#define __CAM_CAMERA_SESSION_H__
+
+#include <memory>
+#include <stdint.h>
+#include <vector>
+
+#include <libcamera/camera.h>
+#include <libcamera/framebuffer.h>
+#include <libcamera/framebuffer_allocator.h>
+#include <libcamera/request.h>
+#include <libcamera/stream.h>
+
+#include "buffer_writer.h"
+#include "event_loop.h"
+#include "options.h"
+
+class CameraSession
+{
+public:
+ CameraSession(std::shared_ptr<libcamera::Camera> camera,
+ libcamera::CameraConfiguration *config,
+ EventLoop *loop);
+
+ int run(const OptionsParser::Options &options);
+private:
+ int capture(libcamera::FrameBufferAllocator *allocator);
+
+ int queueRequest(libcamera::Request *request);
+ void requestComplete(libcamera::Request *request);
+ void processRequest(libcamera::Request *request);
+
+ std::shared_ptr<libcamera::Camera> camera_;
+ libcamera::CameraConfiguration *config_;
+
+ std::map<const libcamera::Stream *, std::string> streamName_;
+ BufferWriter *writer_;
+ uint64_t last_;
+
+ EventLoop *loop_;
+ unsigned int queueCount_;
+ unsigned int captureCount_;
+ unsigned int captureLimit_;
+ bool printMetadata_;
+
+ std::vector<std::unique_ptr<libcamera::Request>> requests_;
+};
+
+#endif /* __CAM_CAMERA_SESSION_H__ */