summaryrefslogtreecommitdiff
path: root/src/cam/buffer_writer.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-05-19 02:19:47 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-08-05 16:23:10 +0300
commit02001fecb0f578438bcfb27cc7496d721c6a18d1 (patch)
tree425b98c28587f9eea768dec33e17d0065faccd3b /src/cam/buffer_writer.h
parentf929a2890ccc3d2cf9be0a73fadcc4c9c40ece79 (diff)
cam: Turn BufferWriter into a FrameSink
Make the BufferWriter class inherit from FrameSink, and use the FrameSink API to manage it. This makes the code more generic, and will allow usage of other sinks. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'src/cam/buffer_writer.h')
-rw-r--r--src/cam/buffer_writer.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/cam/buffer_writer.h b/src/cam/buffer_writer.h
index 7626de42..32bb6ed5 100644
--- a/src/cam/buffer_writer.h
+++ b/src/cam/buffer_writer.h
@@ -10,20 +10,27 @@
#include <map>
#include <string>
-#include <libcamera/framebuffer.h>
+#include <libcamera/stream.h>
-class BufferWriter
+#include "frame_sink.h"
+
+class BufferWriter : public FrameSink
{
public:
BufferWriter(const std::string &pattern = "");
~BufferWriter();
- void mapBuffer(libcamera::FrameBuffer *buffer);
+ int configure(const libcamera::CameraConfiguration &config) override;
+
+ void mapBuffer(libcamera::FrameBuffer *buffer) override;
- int write(libcamera::FrameBuffer *buffer,
- const std::string &streamName);
+ bool processRequest(libcamera::Request *request) override;
private:
+ void writeBuffer(const libcamera::Stream *stream,
+ libcamera::FrameBuffer *buffer);
+
+ std::map<const libcamera::Stream *, std::string> streamNames_;
std::string pattern_;
std::map<int, std::pair<void *, unsigned int>> mappedBuffers_;
};