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:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user