summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-02-04 16:33:01 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-02-06 07:41:51 +0200
commit5aef8257643bc2c70adaa59cc8ef0f2780595cbc (patch)
tree7c622f850453552a274ee3b49d93bf768674782a /include
parent1d7b6297f2ff01c71ebc44788d25545caa6e84e3 (diff)
libcamera: Provide a Request object
Implement a Request object used by applications to queue image capture requests to a camera. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/camera.h3
-rw-r--r--include/libcamera/libcamera.h1
-rw-r--r--include/libcamera/meson.build1
-rw-r--r--include/libcamera/request.h44
4 files changed, 49 insertions, 0 deletions
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 <memory>
#include <string>
+#include <libcamera/request.h>
#include <libcamera/signal.h>
namespace libcamera {
+class Buffer;
class PipelineHandler;
class Stream;
class StreamConfiguration;
@@ -31,6 +33,7 @@ public:
const std::string &name() const;
+ Signal<Request *, const std::map<Stream *, Buffer *> &> requestCompleted;
Signal<Camera *> 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 <libcamera/camera_manager.h>
#include <libcamera/event_dispatcher.h>
#include <libcamera/event_notifier.h>
+#include <libcamera/request.h>
#include <libcamera/signal.h>
#include <libcamera/stream.h>
#include <libcamera/timer.h>
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 <map>
+#include <unordered_set>
+
+#include <libcamera/signal.h>
+
+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<Stream *, Buffer *> &streamMap);
+ Buffer *findBuffer(Stream *stream) const;
+
+private:
+ friend class Camera;
+
+ int prepare();
+ void bufferCompleted(Buffer *buffer);
+
+ Camera *camera_;
+ std::map<Stream *, Buffer *> bufferMap_;
+ std::unordered_set<Buffer *> pending_;
+};
+
+} /* namespace libcamera */
+
+#endif /* __LIBCAMERA_REQUEST_H__ */