libcamera: camera_sensor: Relax restriction on sizes
The CameraSensor class assumes that camera sensors support the exact same list of sizes of all media bus codes. While allowing a simpler API, this assumption is incorrect and is blocking usage of some camera sensors. Relaxing the constraint is possible without changes to the CameraSensor API syntax, but requires changing its semantics. The sizes() function now returns the list of all sizes for all media bus codes, and the getFormat() function now searches in all supported media bus codes. The former is likely not the most useful option for pipeline handlers, but the sizes() function is currently unused. Designing a better API will require inspecting current and expected future use cases in pipeline handlers to determine proper heuristics. While at it, fix a small typo in an unrelated comment. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <libcamera/controls.h>
|
||||
#include <libcamera/geometry.h>
|
||||
|
||||
#include "formats.h"
|
||||
#include "log.h"
|
||||
|
||||
namespace libcamera {
|
||||
@@ -51,7 +52,7 @@ public:
|
||||
const MediaEntity *entity() const { return entity_; }
|
||||
const std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }
|
||||
const std::vector<Size> &sizes() const { return sizes_; }
|
||||
const Size &resolution() const;
|
||||
const Size &resolution() const { return resolution_; }
|
||||
|
||||
V4L2SubdeviceFormat getFormat(const std::vector<unsigned int> &mbusCodes,
|
||||
const Size &size) const;
|
||||
@@ -74,6 +75,8 @@ private:
|
||||
|
||||
std::string model_;
|
||||
|
||||
ImageFormats formats_;
|
||||
Size resolution_;
|
||||
std::vector<unsigned int> mbusCodes_;
|
||||
std::vector<Size> sizes_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user