summaryrefslogtreecommitdiff
path: root/src/cam/capture.h
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-05-23 01:45:09 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-05-25 14:27:55 +0200
commite741a5482c3e5a8c5468d030a7b5ba2f07201577 (patch)
treec459ed89a8f8f9987ac4b91bca010e847bb463b2 /src/cam/capture.h
parent9342c606495a2bc5485b69c51f16d5730bb0386c (diff)
cam: capture: Break out capture to a new class
Reduce the complexity of main.cpp by compartmentalising the capture logic into its own class. There is no functional change. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/cam/capture.h')
-rw-r--r--src/cam/capture.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/cam/capture.h b/src/cam/capture.h
new file mode 100644
index 00000000..a97d1f44
--- /dev/null
+++ b/src/cam/capture.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2019, Google Inc.
+ *
+ * capture.h - Cam capture
+ */
+#ifndef __CAM_CAPTURE_H__
+#define __CAM_CAPTURE_H__
+
+#include <memory>
+
+#include <libcamera/camera.h>
+#include <libcamera/request.h>
+#include <libcamera/stream.h>
+
+#include "buffer_writer.h"
+#include "event_loop.h"
+#include "options.h"
+
+class Capture
+{
+public:
+ Capture(libcamera::Camera *camera);
+
+ int run(EventLoop *loop, const OptionsParser::Options &options);
+private:
+ int prepareConfig(const OptionsParser::Options &options);
+
+ int capture(EventLoop *loop);
+
+ void requestComplete(libcamera::Request *request,
+ const std::map<libcamera::Stream *, libcamera::Buffer *> &buffers);
+
+ libcamera::Camera *camera_;
+ std::unique_ptr<libcamera::CameraConfiguration> config_;
+
+ std::map<libcamera::Stream *, std::string> streamName_;
+ BufferWriter *writer_;
+ uint64_t last_;
+};
+
+#endif /* __CAM_CAPTURE_H__ */