From e741a5482c3e5a8c5468d030a7b5ba2f07201577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Thu, 23 May 2019 01:45:09 +0200 Subject: cam: capture: Break out capture to a new class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/cam/capture.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/cam/capture.h (limited to 'src/cam/capture.h') 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 + +#include +#include +#include + +#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 &buffers); + + libcamera::Camera *camera_; + std::unique_ptr config_; + + std::map streamName_; + BufferWriter *writer_; + uint64_t last_; +}; + +#endif /* __CAM_CAPTURE_H__ */ -- cgit v1.2.1