summaryrefslogtreecommitdiff
path: root/src/cam/file_sink.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-10-12 04:24:47 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-10-15 05:05:31 +0300
commit7e2948f5e106e7d3623134fb9f6c59347640c696 (patch)
treedadcbd08b4f90052c2ccec6fbfe2feba30aaaa24 /src/cam/file_sink.cpp
parent45662c4dd757cff33ebbf296c8f656c17c9022b5 (diff)
cam: Pass stream names to FileSink
The FileSink class constructs stream names internally the same way that the CameraSession does, except that it fails to add the camera name. This results in files being written without the camera name. This could be fixed in FileSink, but we would still duplicate code to construct stream names. Pass the stream names map from CameraSession to FileSink instead, and store it internally. Fixes: 02001fecb0f5 ("cam: Turn BufferWriter into a FrameSink") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/cam/file_sink.cpp')
-rw-r--r--src/cam/file_sink.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/cam/file_sink.cpp b/src/cam/file_sink.cpp
index 3c2e565b..45213d4a 100644
--- a/src/cam/file_sink.cpp
+++ b/src/cam/file_sink.cpp
@@ -20,8 +20,9 @@
using namespace libcamera;
-FileSink::FileSink(const std::string &pattern)
- : pattern_(pattern)
+FileSink::FileSink(const std::map<const libcamera::Stream *, std::string> &streamNames,
+ const std::string &pattern)
+ : streamNames_(streamNames), pattern_(pattern)
{
}
@@ -35,12 +36,6 @@ int FileSink::configure(const libcamera::CameraConfiguration &config)
if (ret < 0)
return ret;
- streamNames_.clear();
- for (unsigned int index = 0; index < config.size(); ++index) {
- const StreamConfiguration &cfg = config.at(index);
- streamNames_[cfg.stream()] = "stream" + std::to_string(index);
- }
-
return 0;
}