summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/buffer.h55
-rw-r--r--include/libcamera/request.h4
-rw-r--r--include/libcamera/stream.h4
3 files changed, 42 insertions, 21 deletions
diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h
index 260a62e9..f5ba6207 100644
--- a/include/libcamera/buffer.h
+++ b/include/libcamera/buffer.h
@@ -14,6 +14,7 @@ namespace libcamera {
class BufferPool;
class Request;
+class Stream;
class Plane final
{
@@ -36,6 +37,30 @@ private:
void *mem_;
};
+class BufferMemory final
+{
+public:
+ std::vector<Plane> &planes() { return planes_; }
+
+private:
+ std::vector<Plane> planes_;
+};
+
+class BufferPool final
+{
+public:
+ ~BufferPool();
+
+ void createBuffers(unsigned int count);
+ void destroyBuffers();
+
+ unsigned int count() const { return buffers_.size(); }
+ std::vector<BufferMemory> &buffers() { return buffers_; }
+
+private:
+ std::vector<BufferMemory> buffers_;
+};
+
class Buffer final
{
public:
@@ -45,20 +70,24 @@ public:
BufferCancelled,
};
- Buffer();
+ Buffer(unsigned int index = -1, const Buffer *metadata = nullptr);
+ Buffer(const Buffer &) = delete;
+ Buffer &operator=(const Buffer &) = delete;
unsigned int index() const { return index_; }
+
unsigned int bytesused() const { return bytesused_; }
uint64_t timestamp() const { return timestamp_; }
unsigned int sequence() const { return sequence_; }
+
Status status() const { return status_; }
- std::vector<Plane> &planes() { return planes_; }
Request *request() const { return request_; }
+ Stream *stream() const { return stream_; }
private:
- friend class BufferPool;
friend class PipelineHandler;
friend class Request;
+ friend class Stream;
friend class V4L2VideoDevice;
void cancel();
@@ -66,28 +95,14 @@ private:
void setRequest(Request *request) { request_ = request; }
unsigned int index_;
+
unsigned int bytesused_;
uint64_t timestamp_;
unsigned int sequence_;
- Status status_;
- std::vector<Plane> planes_;
+ Status status_;
Request *request_;
-};
-
-class BufferPool final
-{
-public:
- ~BufferPool();
-
- void createBuffers(unsigned int count);
- void destroyBuffers();
-
- unsigned int count() const { return buffers_.size(); }
- std::vector<Buffer> &buffers() { return buffers_; }
-
-private:
- std::vector<Buffer> buffers_;
+ Stream *stream_;
};
} /* namespace libcamera */
diff --git a/include/libcamera/request.h b/include/libcamera/request.h
index 4fdb3b51..f69b4e7a 100644
--- a/include/libcamera/request.h
+++ b/include/libcamera/request.h
@@ -8,6 +8,7 @@
#define __LIBCAMERA_REQUEST_H__
#include <map>
+#include <memory>
#include <stdint.h>
#include <unordered_set>
@@ -33,10 +34,11 @@ public:
Request(Camera *camera, uint64_t cookie = 0);
Request(const Request &) = delete;
Request &operator=(const Request &) = delete;
+ ~Request();
ControlList &controls() { return controls_; }
const std::map<Stream *, Buffer *> &buffers() const { return bufferMap_; }
- int setBuffers(const std::map<Stream *, Buffer *> &streamMap);
+ int addBuffer(std::unique_ptr<Buffer> buffer);
Buffer *findBuffer(Stream *stream) const;
uint64_t cookie() const { return cookie_; }
diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
index 5b4fea32..f595a630 100644
--- a/include/libcamera/stream.h
+++ b/include/libcamera/stream.h
@@ -8,6 +8,7 @@
#define __LIBCAMERA_STREAM_H__
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -66,6 +67,9 @@ class Stream
{
public:
Stream();
+
+ std::unique_ptr<Buffer> createBuffer(unsigned int index);
+
BufferPool &bufferPool() { return bufferPool_; }
const StreamConfiguration &configuration() const { return configuration_; }