libcamera: camera: Take span of StreamRole instead of vector
Change the parameter type of `generateConfiguration()` from `const std::vector&`
to `libcamera::Span`. A span is almost always preferable to a const vector ref
because it does not force dynamic allocation when none are needed, and it allows
any contiguous container to be used.
A new overload is added that accepts an initializer list so that
cam->generateConfiguration({ ... })
keeps working.
There is no API break since a span can be constructed from a vector
and the initializer list overload takes care of the initializer lists,
but this change causes an ABI break.
Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Kieran: Apply checkstyle fixups]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
committed by
Kieran Bingham
parent
8da938b007
commit
86fa7300fa
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <initializer_list>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <stdint.h>
|
||||
@@ -105,7 +106,16 @@ public:
|
||||
const ControlList &properties() const;
|
||||
|
||||
const std::set<Stream *> &streams() const;
|
||||
std::unique_ptr<CameraConfiguration> generateConfiguration(const StreamRoles &roles = {});
|
||||
|
||||
std::unique_ptr<CameraConfiguration>
|
||||
generateConfiguration(Span<const StreamRole> roles = {});
|
||||
|
||||
std::unique_ptr<CameraConfiguration>
|
||||
generateConfiguration(std::initializer_list<StreamRole> roles)
|
||||
{
|
||||
return generateConfiguration(Span(roles.begin(), roles.end()));
|
||||
}
|
||||
|
||||
int configure(CameraConfiguration *config);
|
||||
|
||||
std::unique_ptr<Request> createRequest(uint64_t cookie = 0);
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
void release(Camera *camera);
|
||||
|
||||
virtual std::unique_ptr<CameraConfiguration> generateConfiguration(Camera *camera,
|
||||
const StreamRoles &roles) = 0;
|
||||
Span<const StreamRole> roles) = 0;
|
||||
virtual int configure(Camera *camera, CameraConfiguration *config) = 0;
|
||||
|
||||
virtual int exportFrameBuffers(Camera *camera, Stream *stream,
|
||||
|
||||
Reference in New Issue
Block a user