summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cam/buffer_writer.cpp7
-rw-r--r--src/cam/buffer_writer.h2
-rw-r--r--src/cam/main.cpp5
3 files changed, 11 insertions, 3 deletions
diff --git a/src/cam/buffer_writer.cpp b/src/cam/buffer_writer.cpp
index f2b21aef..a7648a92 100644
--- a/src/cam/buffer_writer.cpp
+++ b/src/cam/buffer_writer.cpp
@@ -49,7 +49,12 @@ int BufferWriter::write(FrameBuffer *buffer, const std::string &streamName)
size_t pos;
int fd, ret = 0;
- filename = pattern_;
+ if (!pattern_.empty())
+ filename = pattern_;
+
+ if (filename.empty() || filename.back() == '/')
+ filename += "frame-#.bin";
+
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 604ce870..7626de42 100644
--- a/src/cam/buffer_writer.h
+++ b/src/cam/buffer_writer.h
@@ -15,7 +15,7 @@
class BufferWriter
{
public:
- BufferWriter(const std::string &pattern = "frame-#.bin");
+ BufferWriter(const std::string &pattern = "");
~BufferWriter();
void mapBuffer(libcamera::FrameBuffer *buffer);
diff --git a/src/cam/main.cpp b/src/cam/main.cpp
index a3f19d0f..6d7d45e1 100644
--- a/src/cam/main.cpp
+++ b/src/cam/main.cpp
@@ -118,7 +118,10 @@ int CamApp::parseOptions(int argc, char *argv[])
"capture", ArgumentOptional, "count");
parser.addOption(OptFile, OptionString,
"Write captured frames to disk\n"
- "The first '#' character in the file name is expanded to the stream name and frame sequence number.\n"
+ "If the file name ends with a '/', it sets the directory in which\n"
+ "to write files, using the default file name. Otherwise it sets the\n"
+ "full file path and name. The first '#' character in the file name\n"
+ "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,