android: camera_device: Use reference to settings

In preparation to use the keys part of a capture request to
fill in the result metadata, create a reference to
descriptor_->settings_.

While at it, move the 'ret' variable declaration to the beginning of
the function and rename it in 'found', as it will be used in many
places and move the \todo comment up as it applies to all metadata
whose value is copied from settings.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi 2021-01-29 14:54:39 +01:00
parent da4b325f41
commit 94d42ce014

View file

@ -1936,7 +1936,9 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
int64_t timestamp) int64_t timestamp)
{ {
const ControlList &metadata = descriptor->request_->metadata(); const ControlList &metadata = descriptor->request_->metadata();
const CameraMetadata &settings = descriptor->settings_;
camera_metadata_ro_entry_t entry; camera_metadata_ro_entry_t entry;
bool found;
/* /*
* \todo Keep this in sync with the actual number of entries. * \todo Keep this in sync with the actual number of entries.
@ -1961,6 +1963,12 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
return nullptr; return nullptr;
} }
/*
* \todo The value of the results metadata copied from the settings
* will have to be passed to the libcamera::Camera and extracted
* from libcamera::Request::metadata.
*/
uint8_t value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF; uint8_t value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF;
resultMetadata->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &value, 1); resultMetadata->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &value, 1);
@ -1975,10 +1983,9 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
aeFpsTarget.data(), aeFpsTarget.size()); aeFpsTarget.data(), aeFpsTarget.size());
value = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE; value = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE;
/* \todo Handle IPA appropriately */ found = settings.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry);
bool ret = descriptor->settings_.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry);
resultMetadata->addEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, resultMetadata->addEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,
ret ? entry.data.u8 : &value, 1); found ? entry.data.u8 : &value, 1);
value = ANDROID_CONTROL_AE_STATE_CONVERGED; value = ANDROID_CONTROL_AE_STATE_CONVERGED;
resultMetadata->addEntry(ANDROID_CONTROL_AE_STATE, &value, 1); resultMetadata->addEntry(ANDROID_CONTROL_AE_STATE, &value, 1);
@ -2022,8 +2029,7 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
value = ANDROID_FLASH_STATE_UNAVAILABLE; value = ANDROID_FLASH_STATE_UNAVAILABLE;
resultMetadata->addEntry(ANDROID_FLASH_STATE, &value, 1); resultMetadata->addEntry(ANDROID_FLASH_STATE, &value, 1);
ret = descriptor->settings_.getEntry(ANDROID_LENS_APERTURE, &entry); if (settings.getEntry(ANDROID_LENS_APERTURE, &entry))
if (ret)
resultMetadata->addEntry(ANDROID_LENS_APERTURE, entry.data.f, 1); resultMetadata->addEntry(ANDROID_LENS_APERTURE, entry.data.f, 1);
float focal_length = 1.0; float focal_length = 1.0;