qcam: main_window: Prefer stream formats that don't require conversion
Query the viewfinder for the formats it supports natively, and select one of them for the stream if possible. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
8bd4f20193
commit
e74885c870
1 changed files with 13 additions and 0 deletions
|
@ -297,6 +297,19 @@ int MainWindow::startCapture()
|
|||
}
|
||||
}
|
||||
|
||||
/* Use a format supported by the viewfinder if available. */
|
||||
std::vector<PixelFormat> formats = cfg.formats().pixelformats();
|
||||
for (const PixelFormat &format : viewfinder_->nativeFormats()) {
|
||||
auto match = std::find_if(formats.begin(), formats.end(),
|
||||
[&](const PixelFormat &f) {
|
||||
return f == format;
|
||||
});
|
||||
if (match != formats.end()) {
|
||||
cfg.pixelFormat = format;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CameraConfiguration::Status validation = config_->validate();
|
||||
if (validation == CameraConfiguration::Invalid) {
|
||||
qWarning() << "Failed to create valid camera configuration";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue