Documentation: guides: pipeline-handler: Query pixel formats once
There is no reason to create an entire new copy of the same thing, so use the already existing `formats` object. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
b03992e66f
commit
1200775986
1 changed files with 2 additions and 2 deletions
|
@ -932,9 +932,9 @@ Add the following function implementation to your file:
|
||||||
|
|
||||||
StreamConfiguration &cfg = config_[0];
|
StreamConfiguration &cfg = config_[0];
|
||||||
|
|
||||||
const std::vector<libcamera::PixelFormat> formats = cfg.formats().pixelformats();
|
const std::vector<libcamera::PixelFormat> &formats = cfg.formats().pixelformats();
|
||||||
if (std::find(formats.begin(), formats.end(), cfg.pixelFormat) == formats.end()) {
|
if (std::find(formats.begin(), formats.end(), cfg.pixelFormat) == formats.end()) {
|
||||||
cfg.pixelFormat = cfg.formats().pixelformats()[0];
|
cfg.pixelFormat = formats[0];
|
||||||
LOG(VIVID, Debug) << "Adjusting format to " << cfg.pixelFormat.toString();
|
LOG(VIVID, Debug) << "Adjusting format to " << cfg.pixelFormat.toString();
|
||||||
status = Adjusted;
|
status = Adjusted;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue