cam: Add camera index to file name of capture frames

To prepare for multi-camera support, extend the file naming scheme for
captured frames to include the camera index in addition to the stream
name and frame number.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2021-07-07 03:34:28 +03:00
parent 7dab1fa58f
commit 721f4b03d8
3 changed files with 11 additions and 6 deletions

View file

@ -22,9 +22,11 @@ using namespace libcamera;
CameraSession::CameraSession(CameraManager *cm,
const std::string &cameraId,
unsigned int cameraIndex,
const OptionsParser::Options &options)
: options_(options), last_(0), queueCount_(0), captureCount_(0),
captureLimit_(0), printMetadata_(false)
: options_(options), cameraIndex_(cameraIndex), last_(0),
queueCount_(0), captureCount_(0), captureLimit_(0),
printMetadata_(false)
{
char *endptr;
unsigned long index = strtoul(cameraId.c_str(), &endptr, 10);
@ -152,7 +154,8 @@ int CameraSession::start()
streamName_.clear();
for (unsigned int index = 0; index < config_->size(); ++index) {
StreamConfiguration &cfg = config_->at(index);
streamName_[cfg.stream()] = "stream" + std::to_string(index);
streamName_[cfg.stream()] = "cam" + std::to_string(cameraIndex_)
+ "-stream" + std::to_string(index);
}
camera_->requestCompleted.connect(this, &CameraSession::requestComplete);