<div dir="ltr"><div>Hi Paul, thank you for this patch,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 12, 2021 at 7:25 PM Paul Elder <<a href="mailto:paul.elder@ideasonboard.com">paul.elder@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Now that CameraMetadata supports more convenient functions, use those<br>
instead.<br>
<br>
Signed-off-by: Paul Elder <<a href="mailto:paul.elder@ideasonboard.com" target="_blank">paul.elder@ideasonboard.com</a>><br>
<br>
---<br>
New in v3<br>
---<br>
 src/android/camera_device.cpp | 241 +++++++++++++++-------------------<br>
 1 file changed, 105 insertions(+), 136 deletions(-)<br>
<br>
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp<br>
index 74f6915c..1bafb339 100644<br>
--- a/src/android/camera_device.cpp<br>
+++ b/src/android/camera_device.cpp<br>
@@ -803,7 +803,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                        data.push_back(ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF);<br>
                }<br>
                staticMetadata_->addEntry(ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES,<br>
-                                         data.data(), data.size());<br>
+                                         data);<br>
        }<br>
<br>
        /* Control static metadata. */<br>
@@ -814,15 +814,13 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES,<br>
-                                 aeAvailableAntiBandingModes.data(),<br>
-                                 aeAvailableAntiBandingModes.size());<br>
+                                 aeAvailableAntiBandingModes);<br>
<br>
        std::vector<uint8_t> aeAvailableModes = {<br>
                ANDROID_CONTROL_AE_MODE_ON,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_AE_AVAILABLE_MODES,<br>
-                                 aeAvailableModes.data(),<br>
-                                 aeAvailableModes.size());<br>
+                                 aeAvailableModes);<br>
<br>
        int64_t minFrameDurationNsec = -1;<br>
        int64_t maxFrameDurationNsec = -1;<br>
@@ -871,8 +869,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                0, 0,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_AE_COMPENSATION_RANGE,<br>
-                                 aeCompensationRange.data(),<br>
-                                 aeCompensationRange.size());<br>
+                                 aeCompensationRange);<br>
<br>
        const camera_metadata_rational_t aeCompensationStep[] = {<br>
                { 0, 1 }<br>
@@ -884,29 +881,25 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                ANDROID_CONTROL_AF_MODE_OFF,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_AF_AVAILABLE_MODES,<br>
-                                 availableAfModes.data(),<br>
-                                 availableAfModes.size());<br>
+                                 availableAfModes);<br>
<br>
        std::vector<uint8_t> availableEffects = {<br>
                ANDROID_CONTROL_EFFECT_MODE_OFF,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_AVAILABLE_EFFECTS,<br>
-                                 availableEffects.data(),<br>
-                                 availableEffects.size());<br>
+                                 availableEffects);<br>
<br>
        std::vector<uint8_t> availableSceneModes = {<br>
                ANDROID_CONTROL_SCENE_MODE_DISABLED,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_AVAILABLE_SCENE_MODES,<br>
-                                 availableSceneModes.data(),<br>
-                                 availableSceneModes.size());<br>
+                                 availableSceneModes);<br>
<br>
        std::vector<uint8_t> availableStabilizationModes = {<br>
                ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES,<br>
-                                 availableStabilizationModes.data(),<br>
-                                 availableStabilizationModes.size());<br>
+                                 availableStabilizationModes);<br>
<br>
        /*<br>
         * \todo Inspect the Camera capabilities to report the available<br>
@@ -916,15 +909,13 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                ANDROID_CONTROL_AWB_MODE_AUTO,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_AWB_AVAILABLE_MODES,<br>
-                                 availableAwbModes.data(),<br>
-                                 availableAwbModes.size());<br>
+                                 availableAwbModes);<br>
<br>
        std::vector<int32_t> availableMaxRegions = {<br>
                0, 0, 0,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_MAX_REGIONS,<br>
-                                 availableMaxRegions.data(),<br>
-                                 availableMaxRegions.size());<br>
+                                 availableMaxRegions);<br>
<br>
        std::vector<uint8_t> sceneModesOverride = {<br>
                ANDROID_CONTROL_AE_MODE_ON,<br>
@@ -932,20 +923,19 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                ANDROID_CONTROL_AF_MODE_OFF,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_SCENE_MODE_OVERRIDES,<br>
-                                 sceneModesOverride.data(),<br>
-                                 sceneModesOverride.size());<br>
+                                 sceneModesOverride);<br>
<br>
        uint8_t aeLockAvailable = ANDROID_CONTROL_AE_LOCK_AVAILABLE_FALSE;<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_AE_LOCK_AVAILABLE,<br>
-                                 &aeLockAvailable, 1);<br>
+                                 aeLockAvailable);<br>
<br>
        uint8_t awbLockAvailable = ANDROID_CONTROL_AWB_LOCK_AVAILABLE_FALSE;<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_AWB_LOCK_AVAILABLE,<br>
-                                 &awbLockAvailable, 1);<br>
+                                 awbLockAvailable);<br>
<br>
        char availableControlModes = ANDROID_CONTROL_MODE_AUTO;<br>
        staticMetadata_->addEntry(ANDROID_CONTROL_AVAILABLE_MODES,<br>
-                                 &availableControlModes, 1);<br>
+                                 availableControlModes);<br>
<br>
        /* JPEG static metadata. */<br>
<br>
@@ -983,9 +973,9 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                thumbnailEntries.push_back(size.height);<br>
        }<br>
        staticMetadata_->addEntry(ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES,<br>
-                                 thumbnailEntries.data(), thumbnailEntries.size());<br>
+                                 thumbnailEntries);<br>
<br>
-       staticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, &maxJpegBufferSize_, 1);<br>
+       staticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, maxJpegBufferSize_);<br>
<br>
        /* Sensor static metadata. */<br>
        std::array<int32_t, 2> pixelArraySize;<br>
@@ -994,7 +984,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                pixelArraySize[0] = size.width;<br>
                pixelArraySize[1] = size.height;<br>
                staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,<br>
-                                         pixelArraySize.data(), pixelArraySize.size());<br>
+                                         pixelArraySize.data(), 2);<br>
        }<br>
<br>
        if (properties.contains(properties::UnitCellSize)) {<br>
@@ -1004,7 +994,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                        cellSize.height * pixelArraySize[1] / 1e6f<br>
                };<br>
                staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,<br>
-                                         physicalSize.data(), physicalSize.size());<br>
+                                         physicalSize.data(), 2);<br>
        }<br>
<br>
        {<br>
@@ -1017,20 +1007,20 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                        static_cast<int32_t>(rects[0].height),<br>
                };<br>
                staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,<br>
-                                         data.data(), data.size());<br>
+                                         data);<br>
        }<br>
<br>
        int32_t sensitivityRange[] = {<br>
                32, 2400,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_SENSOR_INFO_SENSITIVITY_RANGE,<br>
-                                 &sensitivityRange, 2);<br>
+                                 sensitivityRange, 2);<br>
<br>
        /* Report the color filter arrangement if the camera reports it. */<br>
        if (properties.contains(properties::draft::ColorFilterArrangement)) {<br>
                uint8_t filterArr = properties.get(properties::draft::ColorFilterArrangement);<br>
                staticMetadata_->addEntry(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,<br>
-                                         &filterArr, 1);<br>
+                                         filterArr);<br>
        }<br>
<br>
        const auto &exposureInfo = controlsInfo.find(&controls::ExposureTime);<br>
@@ -1040,25 +1030,24 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                        exposureInfo->second.max().get<int32_t>() * 1000LL,<br>
                };<br>
                staticMetadata_->addEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,<br>
-                                         &exposureTimeRange, 2);<br>
+                                         exposureTimeRange, 2);<br>
        }<br>
<br>
-       staticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION, &orientation_, 1);<br>
+       staticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION, orientation_);<br>
<br>
        std::vector<int32_t> testPatterModes = {<br>
                ANDROID_SENSOR_TEST_PATTERN_MODE_OFF,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES,<br>
-                                 testPatterModes.data(),<br>
-                                 testPatterModes.size());<br>
+                                 testPatterModes);<br>
<br>
        uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;<br>
        staticMetadata_->addEntry(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,<br>
-                                 &timestampSource, 1);<br>
+                                 timestampSource);<br>
<br>
        if (maxFrameDurationNsec > 0)<br>
                staticMetadata_->addEntry(ANDROID_SENSOR_INFO_MAX_FRAME_DURATION,<br>
-                                         &maxFrameDurationNsec, 1);<br>
+                                         maxFrameDurationNsec);<br>
<br>
        /* Statistics static metadata. */<br>
        uint8_t faceDetectMode = ANDROID_STATISTICS_FACE_DETECT_MODE_OFF;<br>
@@ -1067,7 +1056,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
<br>
        int32_t maxFaceCount = 0;<br>
        staticMetadata_->addEntry(ANDROID_STATISTICS_INFO_MAX_FACE_COUNT,<br>
-                                 &maxFaceCount, 1);<br>
+                                 maxFaceCount);<br>
<br>
        {<br>
                std::vector<uint8_t> data;<br>
@@ -1080,25 +1069,24 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                        data.push_back(ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF);<br>
                }<br>
                staticMetadata_->addEntry(ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES,<br>
-                                         data.data(), data.size());<br>
+                                         data);<br>
        }<br>
<br>
        /* Sync static metadata. */<br>
        int32_t maxLatency = ANDROID_SYNC_MAX_LATENCY_UNKNOWN;<br>
-       staticMetadata_->addEntry(ANDROID_SYNC_MAX_LATENCY, &maxLatency, 1);<br>
+       staticMetadata_->addEntry(ANDROID_SYNC_MAX_LATENCY, maxLatency);<br>
<br>
        /* Flash static metadata. */<br>
        char flashAvailable = ANDROID_FLASH_INFO_AVAILABLE_FALSE;<br>
        staticMetadata_->addEntry(ANDROID_FLASH_INFO_AVAILABLE,<br>
-                                 &flashAvailable, 1);<br>
+                                 flashAvailable);<br>
<br>
        /* Lens static metadata. */<br>
        std::vector<float> lensApertures = {<br>
                2.53 / 100,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_LENS_INFO_AVAILABLE_APERTURES,<br>
-                                 lensApertures.data(),<br>
-                                 lensApertures.size());<br>
+                                 lensApertures);<br>
<br>
        uint8_t lensFacing;<br>
        switch (facing_) {<br>
@@ -1113,29 +1101,27 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                lensFacing = ANDROID_LENS_FACING_EXTERNAL;<br>
                break;<br>
        }<br>
-       staticMetadata_->addEntry(ANDROID_LENS_FACING, &lensFacing, 1);<br>
+       staticMetadata_->addEntry(ANDROID_LENS_FACING, lensFacing);<br>
<br>
-       std::vector<float> lensFocalLenghts = {<br>
+       std::vector<float> lensFocalLengths = {<br>
                1,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS,<br>
-                                 lensFocalLenghts.data(),<br>
-                                 lensFocalLenghts.size());<br>
+                                 lensFocalLengths);<br>
<br>
        std::vector<uint8_t> opticalStabilizations = {<br>
                ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION,<br>
-                                 opticalStabilizations.data(),<br>
-                                 opticalStabilizations.size());<br>
+                                 opticalStabilizations);<br>
<br>
        float hypeFocalDistance = 0;<br>
        staticMetadata_->addEntry(ANDROID_LENS_INFO_HYPERFOCAL_DISTANCE,<br>
-                                 &hypeFocalDistance, 1);<br>
+                                 hypeFocalDistance);<br>
<br>
        float minFocusDistance = 0;<br>
        staticMetadata_->addEntry(ANDROID_LENS_INFO_MINIMUM_FOCUS_DISTANCE,<br>
-                                 &minFocusDistance, 1);<br>
+                                 minFocusDistance);<br>
<br>
        /* Noise reduction modes. */<br>
        {<br>
@@ -1149,7 +1135,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                        data.push_back(ANDROID_NOISE_REDUCTION_MODE_OFF);<br>
                }<br>
                staticMetadata_->addEntry(ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES,<br>
-                                         data.data(), data.size());<br>
+                                         data);<br>
        }<br>
<br>
        /* Scaler static metadata. */<br>
@@ -1174,7 +1160,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                                   1.0f * max.height / min.height);<br>
        }<br>
        staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM,<br>
-                                 &maxZoom, 1);<br>
+                                 maxZoom);<br>
<br>
        std::vector<uint32_t> availableStreamConfigurations;<br>
        availableStreamConfigurations.reserve(streamConfigurations_.size() * 4);<br>
@@ -1193,8 +1179,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                ANDROID_SCALER_AVAILABLE_FORMATS_BLOB, 2560, 1920, 33333333,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_STALL_DURATIONS,<br>
-                                 availableStallDurations.data(),<br>
-                                 availableStallDurations.size());<br>
+                                 availableStallDurations);<br>
<br>
        /* Use the minimum frame duration for all the YUV/RGB formats. */<br>
        if (minFrameDurationNsec > 0) {<br>
@@ -1207,22 +1192,21 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                        minFrameDurations.push_back(minFrameDurationNsec);<br>
                }<br>
                staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS,<br>
-                                         minFrameDurations.data(),<br>
-                                         minFrameDurations.size());<br>
+                                         minFrameDurations);<br>
        }<br>
<br>
        uint8_t croppingType = ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY;<br>
-       staticMetadata_->addEntry(ANDROID_SCALER_CROPPING_TYPE, &croppingType, 1);<br>
+       staticMetadata_->addEntry(ANDROID_SCALER_CROPPING_TYPE, croppingType);<br>
<br>
        /* Info static metadata. */<br>
        uint8_t supportedHWLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED;<br>
        staticMetadata_->addEntry(ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL,<br>
-                                 &supportedHWLevel, 1);<br>
+                                 supportedHWLevel);<br>
<br>
        /* Request static metadata. */<br>
        int32_t partialResultCount = 1;<br>
        staticMetadata_->addEntry(ANDROID_REQUEST_PARTIAL_RESULT_COUNT,<br>
-                                 &partialResultCount, 1);<br>
+                                 partialResultCount);<br>
<br>
        {<br>
                /* Default the value to 2 if not reported by the camera. */<br>
@@ -1231,13 +1215,13 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                if (infoMap != controlsInfo.end())<br>
                        maxPipelineDepth = infoMap->second.max().get<int32_t>();<br>
                staticMetadata_->addEntry(ANDROID_REQUEST_PIPELINE_MAX_DEPTH,<br>
-                                         &maxPipelineDepth, 1);<br>
+                                         maxPipelineDepth);<br>
        }<br>
<br>
        /* LIMITED does not support reprocessing. */<br>
        uint32_t maxNumInputStreams = 0;<br>
        staticMetadata_->addEntry(ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS,<br>
-                                 &maxNumInputStreams, 1);<br>
+                                 maxNumInputStreams);<br>
<br>
        std::vector<uint8_t> availableCapabilities = {<br>
                ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE,<br>
@@ -1261,11 +1245,10 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
        /* Number of { RAW, YUV, JPEG } supported output streams */<br>
        int32_t numOutStreams[] = { rawStreamAvailable, 2, 1 };<br>
        staticMetadata_->addEntry(ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS,<br>
-                                 &numOutStreams, 3);<br>
+                                 numOutStreams, 3);<br></blockquote><div><br></div><div>You can remove 3 if you use Span as I suggested.</div><div>ditto to others.</div><div><br></div><div>-Hiro</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
        staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CAPABILITIES,<br>
-                                 availableCapabilities.data(),<br>
-                                 availableCapabilities.size());<br>
+                                 availableCapabilities);<br>
<br>
        std::vector<int32_t> availableCharacteristicsKeys = {<br>
                ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES,<br>
@@ -1320,8 +1303,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                ANDROID_SYNC_MAX_LATENCY,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS,<br>
-                                 availableCharacteristicsKeys.data(),<br>
-                                 availableCharacteristicsKeys.size());<br>
+                                 availableCharacteristicsKeys);<br>
<br>
        std::vector<int32_t> availableRequestKeys = {<br>
                ANDROID_COLOR_CORRECTION_ABERRATION_MODE,<br>
@@ -1352,8 +1334,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                ANDROID_STATISTICS_FACE_DETECT_MODE<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS,<br>
-                                 availableRequestKeys.data(),<br>
-                                 availableRequestKeys.size());<br>
+                                 availableRequestKeys);<br>
<br>
        std::vector<int32_t> availableResultKeys = {<br>
                ANDROID_COLOR_CORRECTION_ABERRATION_MODE,<br>
@@ -1402,8 +1383,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()<br>
                ANDROID_STATISTICS_SCENE_FLICKER,<br>
        };<br>
        staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_RESULT_KEYS,<br>
-                                 availableResultKeys.data(),<br>
-                                 availableResultKeys.size());<br>
+                                 availableResultKeys);<br>
<br>
        if (!staticMetadata_->isValid()) {<br>
                LOG(HAL, Error) << "Failed to construct static metadata";<br>
@@ -1442,69 +1422,63 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplatePreview()<br>
                                  entry.data.i32, 2);<br>
<br>
        uint8_t aeMode = ANDROID_CONTROL_AE_MODE_ON;<br>
-       requestTemplate->addEntry(ANDROID_CONTROL_AE_MODE,<br>
-                                 &aeMode, 1);<br>
+       requestTemplate->addEntry(ANDROID_CONTROL_AE_MODE, aeMode);<br>
<br>
        int32_t aeExposureCompensation = 0;<br>
        requestTemplate->addEntry(ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION,<br>
-                                 &aeExposureCompensation, 1);<br>
+                                 aeExposureCompensation);<br>
<br>
        uint8_t aePrecaptureTrigger = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE;<br>
        requestTemplate->addEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,<br>
-                                 &aePrecaptureTrigger, 1);<br>
+                                 aePrecaptureTrigger);<br>
<br>
        uint8_t aeLock = ANDROID_CONTROL_AE_LOCK_OFF;<br>
-       requestTemplate->addEntry(ANDROID_CONTROL_AE_LOCK,<br>
-                                 &aeLock, 1);<br>
+       requestTemplate->addEntry(ANDROID_CONTROL_AE_LOCK, aeLock);<br>
<br>
        uint8_t aeAntibandingMode = ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO;<br>
        requestTemplate->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE,<br>
-                                 &aeAntibandingMode, 1);<br>
+                                 aeAntibandingMode);<br>
<br>
        uint8_t afMode = ANDROID_CONTROL_AF_MODE_OFF;<br>
-       requestTemplate->addEntry(ANDROID_CONTROL_AF_MODE, &afMode, 1);<br>
+       requestTemplate->addEntry(ANDROID_CONTROL_AF_MODE, afMode);<br>
<br>
        uint8_t afTrigger = ANDROID_CONTROL_AF_TRIGGER_IDLE;<br>
-       requestTemplate->addEntry(ANDROID_CONTROL_AF_TRIGGER,<br>
-                                 &afTrigger, 1);<br>
+       requestTemplate->addEntry(ANDROID_CONTROL_AF_TRIGGER, afTrigger);<br>
<br>
        uint8_t awbMode = ANDROID_CONTROL_AWB_MODE_AUTO;<br>
-       requestTemplate->addEntry(ANDROID_CONTROL_AWB_MODE,<br>
-                                 &awbMode, 1);<br>
+       requestTemplate->addEntry(ANDROID_CONTROL_AWB_MODE, awbMode);<br>
<br>
        uint8_t awbLock = ANDROID_CONTROL_AWB_LOCK_OFF;<br>
-       requestTemplate->addEntry(ANDROID_CONTROL_AWB_LOCK,<br>
-                                 &awbLock, 1);<br>
+       requestTemplate->addEntry(ANDROID_CONTROL_AWB_LOCK, awbLock);<br>
<br>
        uint8_t flashMode = ANDROID_FLASH_MODE_OFF;<br>
-       requestTemplate->addEntry(ANDROID_FLASH_MODE,<br>
-                                 &flashMode, 1);<br>
+       requestTemplate->addEntry(ANDROID_FLASH_MODE, flashMode);<br>
<br>
        uint8_t faceDetectMode = ANDROID_STATISTICS_FACE_DETECT_MODE_OFF;<br>
        requestTemplate->addEntry(ANDROID_STATISTICS_FACE_DETECT_MODE,<br>
-                                 &faceDetectMode, 1);<br>
+                                 faceDetectMode);<br>
<br>
        uint8_t noiseReduction = ANDROID_NOISE_REDUCTION_MODE_OFF;<br>
        requestTemplate->addEntry(ANDROID_NOISE_REDUCTION_MODE,<br>
-                                 &noiseReduction, 1);<br>
+                                 noiseReduction);<br>
<br>
        uint8_t aberrationMode = ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF;<br>
        requestTemplate->addEntry(ANDROID_COLOR_CORRECTION_ABERRATION_MODE,<br>
-                                 &aberrationMode, 1);<br>
+                                 aberrationMode);<br>
<br>
        uint8_t controlMode = ANDROID_CONTROL_MODE_AUTO;<br>
-       requestTemplate->addEntry(ANDROID_CONTROL_MODE, &controlMode, 1);<br>
+       requestTemplate->addEntry(ANDROID_CONTROL_MODE, controlMode);<br>
<br>
        float lensAperture = 2.53 / 100;<br>
-       requestTemplate->addEntry(ANDROID_LENS_APERTURE, &lensAperture, 1);<br>
+       requestTemplate->addEntry(ANDROID_LENS_APERTURE, lensAperture);<br>
<br>
        uint8_t opticalStabilization = ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF;<br>
        requestTemplate->addEntry(ANDROID_LENS_OPTICAL_STABILIZATION_MODE,<br>
-                                 &opticalStabilization, 1);<br>
+                                 opticalStabilization);<br>
<br>
        uint8_t captureIntent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;<br>
        requestTemplate->addEntry(ANDROID_CONTROL_CAPTURE_INTENT,<br>
-                                 &captureIntent, 1);<br>
+                                 captureIntent);<br>
<br>
        return requestTemplate;<br>
 }<br>
@@ -1580,7 +1554,7 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)<br>
        }<br>
<br>
        requestTemplate->updateEntry(ANDROID_CONTROL_CAPTURE_INTENT,<br>
-                                    &captureIntent, 1);<br>
+                                    captureIntent);<br>
<br>
        requestTemplates_[type] = std::move(requestTemplate);<br>
        return requestTemplates_[type]->get();<br>
@@ -2154,20 +2128,20 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons<br>
<br>
        uint8_t value = ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF;<br>
        resultMetadata->addEntry(ANDROID_COLOR_CORRECTION_ABERRATION_MODE,<br>
-                                &value, 1);<br>
+                                value);<br>
<br>
        value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE, value);<br>
<br>
        int32_t value32 = 0;<br>
        resultMetadata->addEntry(ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION,<br>
-                                &value32, 1);<br>
+                                value32);<br>
<br>
        value = ANDROID_CONTROL_AE_LOCK_OFF;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_AE_LOCK, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_AE_LOCK, value);<br>
<br>
        value = ANDROID_CONTROL_AE_MODE_ON;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_AE_MODE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_AE_MODE, value);<br>
<br>
        if (settings.getEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, &entry))<br>
                /*<br>
@@ -2178,109 +2152,104 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons<br>
                resultMetadata->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,<br>
                                         entry.data.i32, 2);<br>
<br>
-       value = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE;<br>
        found = settings.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry);<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,<br>
-                                found ? entry.data.u8 : &value, 1);<br>
+       value = found ? *entry.data.u8 :<br>
+                       (uint8_t)ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE;<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, value);<br>
<br>
        value = ANDROID_CONTROL_AE_STATE_CONVERGED;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_AE_STATE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_AE_STATE, value);<br>
<br>
        value = ANDROID_CONTROL_AF_MODE_OFF;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_AF_MODE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_AF_MODE, value);<br>
<br>
        value = ANDROID_CONTROL_AF_STATE_INACTIVE;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_AF_STATE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_AF_STATE, value);<br>
<br>
        value = ANDROID_CONTROL_AF_TRIGGER_IDLE;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_AF_TRIGGER, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_AF_TRIGGER, value);<br>
<br>
        value = ANDROID_CONTROL_AWB_MODE_AUTO;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_AWB_MODE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_AWB_MODE, value);<br>
<br>
        value = ANDROID_CONTROL_AWB_LOCK_OFF;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_AWB_LOCK, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_AWB_LOCK, value);<br>
<br>
        value = ANDROID_CONTROL_AWB_STATE_CONVERGED;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_AWB_STATE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_AWB_STATE, value);<br>
<br>
        value = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_CAPTURE_INTENT, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_CAPTURE_INTENT, value);<br>
<br>
        value = ANDROID_CONTROL_EFFECT_MODE_OFF;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_EFFECT_MODE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_EFFECT_MODE, value);<br>
<br>
        value = ANDROID_CONTROL_MODE_AUTO;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_MODE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_MODE, value);<br>
<br>
        value = ANDROID_CONTROL_SCENE_MODE_DISABLED;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_SCENE_MODE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_SCENE_MODE, value);<br>
<br>
        value = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF;<br>
-       resultMetadata->addEntry(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, value);<br>
<br>
        value = ANDROID_FLASH_MODE_OFF;<br>
-       resultMetadata->addEntry(ANDROID_FLASH_MODE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_FLASH_MODE, value);<br>
<br>
        value = ANDROID_FLASH_STATE_UNAVAILABLE;<br>
-       resultMetadata->addEntry(ANDROID_FLASH_STATE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_FLASH_STATE, value);<br>
<br>
        if (settings.getEntry(ANDROID_LENS_APERTURE, &entry))<br>
                resultMetadata->addEntry(ANDROID_LENS_APERTURE, entry.data.f, 1);<br>
<br>
        float focal_length = 1.0;<br>
-       resultMetadata->addEntry(ANDROID_LENS_FOCAL_LENGTH, &focal_length, 1);<br>
+       resultMetadata->addEntry(ANDROID_LENS_FOCAL_LENGTH, focal_length);<br>
<br>
        value = ANDROID_LENS_STATE_STATIONARY;<br>
-       resultMetadata->addEntry(ANDROID_LENS_STATE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_LENS_STATE, value);<br>
<br>
        value = ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF;<br>
        resultMetadata->addEntry(ANDROID_LENS_OPTICAL_STABILIZATION_MODE,<br>
-                                &value, 1);<br>
+                                value);<br>
<br>
        value32 = ANDROID_SENSOR_TEST_PATTERN_MODE_OFF;<br>
-       resultMetadata->addEntry(ANDROID_SENSOR_TEST_PATTERN_MODE,<br>
-                                &value32, 1);<br>
+       resultMetadata->addEntry(ANDROID_SENSOR_TEST_PATTERN_MODE, value32);<br>
<br>
        value = ANDROID_STATISTICS_FACE_DETECT_MODE_OFF;<br>
-       resultMetadata->addEntry(ANDROID_STATISTICS_FACE_DETECT_MODE,<br>
-                                &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_STATISTICS_FACE_DETECT_MODE, value);<br>
<br>
        value = ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF;<br>
        resultMetadata->addEntry(ANDROID_STATISTICS_LENS_SHADING_MAP_MODE,<br>
-                                &value, 1);<br>
+                                value);<br>
<br>
        value = ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_OFF;<br>
-       resultMetadata->addEntry(ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE,<br>
-                                &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE, value);<br>
<br>
        value = ANDROID_STATISTICS_SCENE_FLICKER_NONE;<br>
-       resultMetadata->addEntry(ANDROID_STATISTICS_SCENE_FLICKER,<br>
-                                &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_STATISTICS_SCENE_FLICKER, value);<br>
<br>
        value = ANDROID_NOISE_REDUCTION_MODE_OFF;<br>
-       resultMetadata->addEntry(ANDROID_NOISE_REDUCTION_MODE, &value, 1);<br>
+       resultMetadata->addEntry(ANDROID_NOISE_REDUCTION_MODE, value);<br>
<br>
        /* 33.3 msec */<br>
        const int64_t rolling_shutter_skew = 33300000;<br>
        resultMetadata->addEntry(ANDROID_SENSOR_ROLLING_SHUTTER_SKEW,<br>
-                                &rolling_shutter_skew, 1);<br>
+                                rolling_shutter_skew);<br>
<br>
        /* Add metadata tags reported by libcamera. */<br>
        const int64_t timestamp = metadata.get(controls::SensorTimestamp);<br>
-       resultMetadata->addEntry(ANDROID_SENSOR_TIMESTAMP, &timestamp, 1);<br>
+       resultMetadata->addEntry(ANDROID_SENSOR_TIMESTAMP, timestamp);<br>
<br>
        if (metadata.contains(controls::draft::PipelineDepth)) {<br>
                uint8_t pipeline_depth =<br>
                        metadata.get<int32_t>(controls::draft::PipelineDepth);<br>
                resultMetadata->addEntry(ANDROID_REQUEST_PIPELINE_DEPTH,<br>
-                                        &pipeline_depth, 1);<br>
+                                        pipeline_depth);<br>
        }<br>
<br>
        if (metadata.contains(controls::ExposureTime)) {<br>
                int64_t exposure = metadata.get(controls::ExposureTime) * 1000ULL;<br>
-               resultMetadata->addEntry(ANDROID_SENSOR_EXPOSURE_TIME,<br>
-                                        &exposure, 1);<br>
+               resultMetadata->addEntry(ANDROID_SENSOR_EXPOSURE_TIME, exposure);<br>
        }<br>
<br>
        if (metadata.contains(controls::ScalerCrop)) {<br>
@@ -2289,7 +2258,7 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons<br>
                        crop.x, crop.y, static_cast<int32_t>(crop.width),<br>
                        static_cast<int32_t>(crop.height),<br>
                };<br>
-               resultMetadata->addEntry(ANDROID_SCALER_CROP_REGION, cropRect, 4);<br>
+               resultMetadata->addEntry(ANDROID_SCALER_CROP_REGION, cropRect, 2);<br>
        }<br>
<br>
        /*<br>
-- <br>
2.27.0<br>
<br>
_______________________________________________<br>
libcamera-devel mailing list<br>
<a href="mailto:libcamera-devel@lists.libcamera.org" target="_blank">libcamera-devel@lists.libcamera.org</a><br>
<a href="https://lists.libcamera.org/listinfo/libcamera-devel" rel="noreferrer" target="_blank">https://lists.libcamera.org/listinfo/libcamera-devel</a><br>
</blockquote></div></div>