summaryrefslogtreecommitdiff
path: root/src/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/android')
-rw-r--r--src/android/camera_device.cpp21
-rw-r--r--src/android/camera_device.h4
-rw-r--r--src/android/camera_worker.h4
3 files changed, 22 insertions, 7 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 1c7bf4ed..26aa3bc4 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -675,10 +675,10 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
{
/*
* \todo Keep this in sync with the actual number of entries.
- * Currently: 51 entries, 687 bytes of static metadata
+ * Currently: 52 entries, 698 bytes of static metadata
*/
uint32_t numEntries = 52;
- uint32_t byteSize = 694;
+ uint32_t byteSize = 698;
/*
* Calculate space occupation in bytes for dynamically built metadata
@@ -1187,6 +1187,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
ANDROID_CONTROL_AWB_STATE,
ANDROID_CONTROL_AWB_LOCK,
ANDROID_LENS_STATE,
+ ANDROID_REQUEST_PIPELINE_DEPTH,
ANDROID_SCALER_CROP_REGION,
ANDROID_SENSOR_TIMESTAMP,
ANDROID_SENSOR_ROLLING_SHUTTER_SKEW,
@@ -1704,7 +1705,7 @@ void CameraDevice::requestComplete(Request *request)
* pipeline handlers) timestamp in the Request itself.
*/
uint64_t timestamp = buffers.begin()->second->metadata().timestamp;
- resultMetadata = getResultMetadata(descriptor->frameNumber_, timestamp);
+ resultMetadata = getResultMetadata(descriptor, timestamp);
/* Handle any JPEG compression. */
for (unsigned int i = 0; i < descriptor->numBuffers_; ++i) {
@@ -1822,15 +1823,17 @@ void CameraDevice::notifyError(uint32_t frameNumber, camera3_stream_t *stream)
* Produce a set of fixed result metadata.
*/
std::unique_ptr<CameraMetadata>
-CameraDevice::getResultMetadata([[maybe_unused]] int frame_number,
+CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
int64_t timestamp)
{
+ const ControlList &metadata = descriptor->request_->metadata();
+
/*
* \todo Keep this in sync with the actual number of entries.
* Currently: 18 entries, 62 bytes
*/
std::unique_ptr<CameraMetadata> resultMetadata =
- std::make_unique<CameraMetadata>(18, 62);
+ std::make_unique<CameraMetadata>(19, 63);
if (!resultMetadata->isValid()) {
LOG(HAL, Error) << "Failed to allocate static metadata";
return nullptr;
@@ -1880,6 +1883,14 @@ CameraDevice::getResultMetadata([[maybe_unused]] int frame_number,
resultMetadata->addEntry(ANDROID_STATISTICS_SCENE_FLICKER,
&scene_flicker, 1);
+ /* Add metadata tags reported by libcamera. */
+ if (metadata.contains(controls::draft::PipelineDepth)) {
+ uint8_t pipeline_depth =
+ metadata.get<int32_t>(controls::draft::PipelineDepth);
+ resultMetadata->addEntry(ANDROID_REQUEST_PIPELINE_DEPTH,
+ &pipeline_depth, 1);
+ }
+
/*
* Return the result metadata pack even is not valid: get() will return
* nullptr.
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index 45efcf47..07d3a846 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -105,8 +105,8 @@ private:
void notifyError(uint32_t frameNumber, camera3_stream_t *stream);
CameraMetadata *requestTemplatePreview();
libcamera::PixelFormat toPixelFormat(int format) const;
- std::unique_ptr<CameraMetadata> getResultMetadata(int frame_number,
- int64_t timestamp);
+ std::unique_ptr<CameraMetadata> getResultMetadata(
+ Camera3RequestDescriptor *descriptor, int64_t timestamp);
unsigned int id_;
camera3_device_t camera3Device_;
diff --git a/src/android/camera_worker.h b/src/android/camera_worker.h
index fff50217..847a2fc4 100644
--- a/src/android/camera_worker.h
+++ b/src/android/camera_worker.h
@@ -25,6 +25,10 @@ public:
CaptureRequest(libcamera::Camera *camera, uint64_t cookie);
const std::vector<int> &fences() const { return acquireFences_; }
+ const libcamera::ControlList &metadata() const
+ {
+ return request_->metadata();
+ }
void addBuffer(libcamera::Stream *stream,
libcamera::FrameBuffer *buffer, int fence);