libcamera: v4l2_subdevice: Replace ImageFormats with a map
Replace the V4L2Subdevice usage of the ImageFormats class with a std::map and the utils::map_keys() helper. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
d9295552b1
commit
dcda73ec14
5 changed files with 29 additions and 22 deletions
|
@ -47,29 +47,29 @@ void ListFormatsTest::printFormats(unsigned int pad,
|
|||
int ListFormatsTest::run()
|
||||
{
|
||||
/* List all formats available on existing "Scaler" pads. */
|
||||
ImageFormats formats;
|
||||
V4L2Subdevice::Formats formats;
|
||||
|
||||
formats = scaler_->formats(0);
|
||||
if (formats.isEmpty()) {
|
||||
if (formats.empty()) {
|
||||
cerr << "Failed to list formats on pad 0 of subdevice "
|
||||
<< scaler_->entity()->name() << endl;
|
||||
return TestFail;
|
||||
}
|
||||
for (unsigned int code : formats.formats())
|
||||
printFormats(0, code, formats.sizes(code));
|
||||
for (unsigned int code : utils::map_keys(formats))
|
||||
printFormats(0, code, formats[code]);
|
||||
|
||||
formats = scaler_->formats(1);
|
||||
if (formats.isEmpty()) {
|
||||
if (formats.empty()) {
|
||||
cerr << "Failed to list formats on pad 1 of subdevice "
|
||||
<< scaler_->entity()->name() << endl;
|
||||
return TestFail;
|
||||
}
|
||||
for (unsigned int code : formats.formats())
|
||||
printFormats(1, code, formats.sizes(code));
|
||||
for (unsigned int code : utils::map_keys(formats))
|
||||
printFormats(1, code, formats[code]);
|
||||
|
||||
/* List format on a non-existing pad, format vector shall be empty. */
|
||||
formats = scaler_->formats(2);
|
||||
if (!formats.isEmpty()) {
|
||||
if (!formats.empty()) {
|
||||
cerr << "Listing formats on non-existing pad 2 of subdevice "
|
||||
<< scaler_->entity()->name()
|
||||
<< " should return an empty format list" << endl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue