Add fixed properties to v4l2_metadata constructor.
BUG: 30140438 Change-Id: I371d00a19d89b439e72805a1bd9b23fc42ee8400
This commit is contained in:
parent
5156c2d1c9
commit
ab3a0a4620
2 changed files with 77 additions and 7 deletions
|
@ -328,13 +328,7 @@ int V4L2Camera::initStaticInfo(camera_metadata_t** out) {
|
|||
return res;
|
||||
}
|
||||
|
||||
// No known V4L2 shading map info.
|
||||
int32_t shading_map_size[] = {1, 1};
|
||||
res = info.update(ANDROID_LENS_INFO_SHADING_MAP_SIZE,
|
||||
shading_map_size, ARRAY_SIZE(shading_map_size));
|
||||
if (res != android::OK) {
|
||||
return res;
|
||||
}
|
||||
// lens.info.shadingMapSize not required for non-full devices.
|
||||
|
||||
// All V4L2 devices are considered to be external facing.
|
||||
uint8_t facing = ANDROID_LENS_FACING_EXTERNAL;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <camera/CameraMetadata.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "metadata/fixed_property.h"
|
||||
|
||||
namespace v4l2_camera_hal {
|
||||
|
||||
|
@ -28,6 +29,81 @@ V4L2Metadata::V4L2Metadata(V4L2Wrapper* device) : device_(device) {
|
|||
// TODO(b/30140438): Add all metadata components used by V4L2Camera here.
|
||||
// Currently these are all the fixed properties. Will add the other properties
|
||||
// as more PartialMetadata subclasses get implemented.
|
||||
|
||||
// TODO(b/30510395): subcomponents of 3A.
|
||||
AddComponent(std::unique_ptr<PartialMetadataInterface>(
|
||||
new FixedProperty<std::array<int32_t, 3>>(
|
||||
ANDROID_CONTROL_MAX_REGIONS, {{/*AE*/ 0, /*AWB*/ 0, /*AF*/ 0}})));
|
||||
|
||||
// TODO(30510395): subcomponents focus/lens.
|
||||
AddComponent(
|
||||
std::unique_ptr<PartialMetadataInterface>(new FixedProperty<uint8_t>(
|
||||
ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION,
|
||||
ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED)));
|
||||
|
||||
// TODO(30510395): subcomponents of formats/streams.
|
||||
// TODO(b/29939583): V4L2 can only support 1 stream at a time.
|
||||
// For now, just reporting minimum allowable for LIMITED devices.
|
||||
AddComponent(std::unique_ptr<PartialMetadataInterface>(
|
||||
new FixedProperty<std::array<int32_t, 3>>(
|
||||
ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS,
|
||||
{{/* Raw */ 0, /* Non-stalling */ 2, /* Stalling */ 1}})));
|
||||
// Reprocessing not supported.
|
||||
AddComponent(std::unique_ptr<PartialMetadataInterface>(
|
||||
new FixedProperty<int32_t>(ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS, 0)));
|
||||
// No way to know pipeline depth for V4L2, so fake with max allowable latency.
|
||||
// Doesn't mean much without per-frame controls anyways.
|
||||
AddComponent(std::unique_ptr<PartialMetadataInterface>(
|
||||
new FixedProperty<uint8_t>(ANDROID_REQUEST_PIPELINE_MAX_DEPTH, 4)));
|
||||
// "LIMITED devices are strongly encouraged to use a non-negative value.
|
||||
// If UNKNOWN is used here then app developers do not have a way to know
|
||||
// when sensor settings have been applied." - Unfortunately, V4L2 doesn't
|
||||
// really help here either. Could even be that adjusting settings mid-stream
|
||||
// blocks in V4L2, and should be avoided.
|
||||
AddComponent(
|
||||
std::unique_ptr<PartialMetadataInterface>(new FixedProperty<int32_t>(
|
||||
ANDROID_SYNC_MAX_LATENCY, ANDROID_SYNC_MAX_LATENCY_UNKNOWN)));
|
||||
|
||||
// TODO(30510395): subcomponents of cropping/sensors.
|
||||
// V4L2 VIDIOC_CROPCAP doesn't give a way to query this;
|
||||
// it's driver dependent. For now, assume freeform, and
|
||||
// some cameras may just behave badly.
|
||||
// TODO(b/29579652): Figure out a way to determine this.
|
||||
AddComponent(std::unique_ptr<PartialMetadataInterface>(
|
||||
new FixedProperty<uint8_t>(ANDROID_SCALER_CROPPING_TYPE,
|
||||
ANDROID_SCALER_CROPPING_TYPE_FREEFORM)));
|
||||
// No way to get in V4L2, so faked. RPi camera v2 is 3.674 x 2.760 mm.
|
||||
// Physical size is used in framework calculations (field of view,
|
||||
// pixel pitch, etc.), so faking it may have unexpected results.
|
||||
AddComponent(std::unique_ptr<PartialMetadataInterface>(
|
||||
new FixedProperty<std::array<float, 2>>(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,
|
||||
{{3.674, 2.760}})));
|
||||
// HAL uses BOOTTIME timestamps.
|
||||
// TODO(b/29457051): make sure timestamps are consistent throughout the HAL.
|
||||
AddComponent(
|
||||
std::unique_ptr<PartialMetadataInterface>(new FixedProperty<uint8_t>(
|
||||
ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,
|
||||
ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN)));
|
||||
// Noo way to actually get orientation from V4L2.
|
||||
AddComponent(std::unique_ptr<PartialMetadataInterface>(
|
||||
new FixedProperty<int32_t>(ANDROID_SENSOR_ORIENTATION, 0)));
|
||||
|
||||
// TODO(30510395): subcomponents of face detection.
|
||||
// Face detection not supported.
|
||||
AddComponent(std::unique_ptr<PartialMetadataInterface>(
|
||||
new FixedProperty<int32_t>(ANDROID_STATISTICS_INFO_MAX_FACE_COUNT, 0)));
|
||||
|
||||
/* Capabilities. */
|
||||
// The V4L2Metadata pretends to at least meet the
|
||||
// "LIMITED" and "BACKWARD_COMPATIBLE" functionality requirements.
|
||||
AddComponent(
|
||||
std::unique_ptr<PartialMetadataInterface>(new FixedProperty<uint8_t>(
|
||||
ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL,
|
||||
ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED)));
|
||||
AddComponent(std::unique_ptr<PartialMetadataInterface>(
|
||||
new FixedProperty<std::vector<uint8_t>>(
|
||||
ANDROID_REQUEST_AVAILABLE_CAPABILITIES,
|
||||
{ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE})));
|
||||
}
|
||||
|
||||
V4L2Metadata::~V4L2Metadata() { HAL_LOG_ENTER(); }
|
||||
|
|
Loading…
Reference in a new issue