[libcamera-devel,v4,28/31] src: cam: Add output name to frame writer

Message ID 20190320163055.22056-29-jacopo@jmondi.org
State Superseded
Headers show
Series
  • libcamera: ipu3: Add ImgU support + multiple streams
Related show

Commit Message

Jacopo Mondi March 20, 2019, 4:30 p.m. UTC
Add a parameter to the frame writer 'write()' method to allow specify
which output the frame has been produced from.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/cam/buffer_writer.cpp | 4 ++--
 src/cam/buffer_writer.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Patch

diff --git a/src/cam/buffer_writer.cpp b/src/cam/buffer_writer.cpp
index 2d2258b4cd1c..2d99d2d40c16 100644
--- a/src/cam/buffer_writer.cpp
+++ b/src/cam/buffer_writer.cpp
@@ -19,13 +19,13 @@  BufferWriter::BufferWriter(const std::string &pattern)
 {
 }
 
-int BufferWriter::write(libcamera::Buffer *buffer)
+int BufferWriter::write(libcamera::Buffer *buffer, const std::string &name)
 {
 	std::string filename;
 	size_t pos;
 	int fd, ret = 0;
 
-	filename = pattern_;
+	filename = pattern_ + "-" + name;
 	pos = filename.find_first_of('#');
 	if (pos != std::string::npos) {
 		std::stringstream ss;
diff --git a/src/cam/buffer_writer.h b/src/cam/buffer_writer.h
index 9705773e0e39..62d6fbeed403 100644
--- a/src/cam/buffer_writer.h
+++ b/src/cam/buffer_writer.h
@@ -16,7 +16,7 @@  class BufferWriter
 public:
 	BufferWriter(const std::string &pattern = "frame-#.bin");
 
-	int write(libcamera::Buffer *buffer);
+	int write(libcamera::Buffer *buffer, const std::string &name);
 
 private:
 	std::string pattern_;