summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cam/buffer_writer.cpp6
-rw-r--r--src/cam/buffer_writer.h2
-rw-r--r--src/cam/main.cpp4
3 files changed, 7 insertions, 5 deletions
diff --git a/src/cam/buffer_writer.cpp b/src/cam/buffer_writer.cpp
index 2d2258b4..e0374ffc 100644
--- a/src/cam/buffer_writer.cpp
+++ b/src/cam/buffer_writer.cpp
@@ -19,7 +19,8 @@ BufferWriter::BufferWriter(const std::string &pattern)
{
}
-int BufferWriter::write(libcamera::Buffer *buffer)
+int BufferWriter::write(libcamera::Buffer *buffer,
+ const std::string &streamName)
{
std::string filename;
size_t pos;
@@ -29,7 +30,8 @@ int BufferWriter::write(libcamera::Buffer *buffer)
pos = filename.find_first_of('#');
if (pos != std::string::npos) {
std::stringstream ss;
- ss << std::setw(6) << std::setfill('0') << buffer->sequence();
+ ss << streamName << "-" << std::setw(6)
+ << std::setfill('0') << buffer->sequence();
filename.replace(pos, 1, ss.str());
}
diff --git a/src/cam/buffer_writer.h b/src/cam/buffer_writer.h
index 9705773e..7bf785d1 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 &streamName);
private:
std::string pattern_;
diff --git a/src/cam/main.cpp b/src/cam/main.cpp
index 41a4d9c6..3dd4b24d 100644
--- a/src/cam/main.cpp
+++ b/src/cam/main.cpp
@@ -57,7 +57,7 @@ static int parseOptions(int argc, char *argv[])
"Capture until interrupted by user", "capture");
parser.addOption(OptFile, OptionString,
"Write captured frames to disk\n"
- "The first '#' character in the file name is expanded to the frame sequence number.\n"
+ "The first '#' character in the file name is expanded to the stream name and frame sequence number.\n"
"The default file name is 'frame-#.bin'.",
"file", ArgumentOptional, "filename");
parser.addOption(OptStream, &streamKeyValue,
@@ -121,7 +121,7 @@ static void requestComplete(Request *request, const std::map<Stream *, Buffer *>
<< std::endl;
if (writer)
- writer->write(buffer);
+ writer->write(buffer, "stream0");
request = camera->createRequest();
if (!request) {