cam: Extend BufferWriter to include a stream name in file path

To be able to write multiple buffers captured in the same request (and
hence having the same sequence number) the buffer writer needs to name
each file uniquely. Add a stream name to the writer function which the
buffer writer can add to the part of the pattern it already expands to
the sequence number. As cam only supports one stream, hard code the name
to stream0.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund 2019-04-05 20:56:07 +02:00
parent ea34d1a574
commit 47a9f357fe
3 changed files with 7 additions and 5 deletions

View file

@ -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) {