From 5aef8257643bc2c70adaa59cc8ef0f2780595cbc Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Mon, 4 Feb 2019 16:33:01 +0100 Subject: libcamera: Provide a Request object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement a Request object used by applications to queue image capture requests to a camera. Signed-off-by: Jacopo Mondi Signed-off-by: Kieran Bingham Signed-off-by: Laurent Pinchart Signed-off-by: Niklas Söderlund --- include/libcamera/camera.h | 3 +++ include/libcamera/libcamera.h | 1 + include/libcamera/meson.build | 1 + include/libcamera/request.h | 44 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 include/libcamera/request.h (limited to 'include') diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h index 4940c344..bbe2696e 100644 --- a/include/libcamera/camera.h +++ b/include/libcamera/camera.h @@ -11,10 +11,12 @@ #include #include +#include #include namespace libcamera { +class Buffer; class PipelineHandler; class Stream; class StreamConfiguration; @@ -31,6 +33,7 @@ public: const std::string &name() const; + Signal &> requestCompleted; Signal disconnected; int acquire(); diff --git a/include/libcamera/libcamera.h b/include/libcamera/libcamera.h index 8167e809..dda576e9 100644 --- a/include/libcamera/libcamera.h +++ b/include/libcamera/libcamera.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index 8c14423b..5788e9bb 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -5,6 +5,7 @@ libcamera_api = files([ 'event_dispatcher.h', 'event_notifier.h', 'libcamera.h', + 'request.h', 'signal.h', 'stream.h', 'timer.h', diff --git a/include/libcamera/request.h b/include/libcamera/request.h new file mode 100644 index 00000000..ef081177 --- /dev/null +++ b/include/libcamera/request.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * request.h - Capture request handling + */ +#ifndef __LIBCAMERA_REQUEST_H__ +#define __LIBCAMERA_REQUEST_H__ + +#include +#include + +#include + +namespace libcamera { + +class Buffer; +class Camera; +class Stream; + +class Request +{ +public: + explicit Request(Camera *camera); + Request(const Request &) = delete; + Request &operator=(const Request &) = delete; + + int setBuffers(const std::map &streamMap); + Buffer *findBuffer(Stream *stream) const; + +private: + friend class Camera; + + int prepare(); + void bufferCompleted(Buffer *buffer); + + Camera *camera_; + std::map bufferMap_; + std::unordered_set pending_; +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_REQUEST_H__ */ -- cgit v1.2.1