Merge "camera.device@3.4: Add MOTION_TRACKING template enums"
This commit is contained in:
commit
2414a91a36
9 changed files with 151 additions and 26 deletions
|
@ -738,8 +738,14 @@ void CameraDeviceSession::ResultBatcher::processCaptureResult(CaptureResult& res
|
|||
// Methods from ::android::hardware::camera::device::V3_2::ICameraDeviceSession follow.
|
||||
Return<void> CameraDeviceSession::constructDefaultRequestSettings(
|
||||
RequestTemplate type, ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) {
|
||||
Status status = initStatus();
|
||||
CameraMetadata outMetadata;
|
||||
Status status = constructDefaultRequestSettingsRaw( (int) type, &outMetadata);
|
||||
_hidl_cb(status, outMetadata);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Status CameraDeviceSession::constructDefaultRequestSettingsRaw(int type, CameraMetadata *outMetadata) {
|
||||
Status status = initStatus();
|
||||
const camera_metadata_t *rawRequest;
|
||||
if (status == Status::OK) {
|
||||
ATRACE_BEGIN("camera3->construct_default_request_settings");
|
||||
|
@ -761,15 +767,14 @@ Return<void> CameraDeviceSession::constructDefaultRequestSettings(
|
|||
defaultBoost, 1);
|
||||
const camera_metadata_t *metaBuffer =
|
||||
mOverridenRequest.getAndLock();
|
||||
convertToHidl(metaBuffer, &outMetadata);
|
||||
convertToHidl(metaBuffer, outMetadata);
|
||||
mOverridenRequest.unlock(metaBuffer);
|
||||
} else {
|
||||
convertToHidl(rawRequest, &outMetadata);
|
||||
convertToHidl(rawRequest, outMetadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
_hidl_cb(status, outMetadata);
|
||||
return Void();
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -112,7 +112,9 @@ protected:
|
|||
Return<Status> flush();
|
||||
Return<void> close();
|
||||
|
||||
//Helper methods
|
||||
// Helper methods
|
||||
Status constructDefaultRequestSettingsRaw(int type, CameraMetadata *outMetadata);
|
||||
|
||||
bool preProcessConfigurationLocked(const StreamConfiguration& requestedConfiguration,
|
||||
camera3_stream_configuration_t *stream_list /*out*/,
|
||||
hidl_vec<camera3_stream_t*> *streams /*out*/);
|
||||
|
|
|
@ -22,6 +22,7 @@ hidl_interface {
|
|||
"HalStream",
|
||||
"HalStreamConfiguration",
|
||||
"PhysicalCameraSetting",
|
||||
"RequestTemplate",
|
||||
"Stream",
|
||||
"StreamConfiguration",
|
||||
],
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package android.hardware.camera.device@3.4;
|
||||
|
||||
import android.hardware.camera.common@1.0::Status;
|
||||
import @3.2::CameraMetadata;
|
||||
import @3.3::ICameraDeviceSession;
|
||||
import @3.3::HalStreamConfiguration;
|
||||
import @3.2::BufferCache;
|
||||
|
@ -29,6 +30,43 @@ import @3.2::BufferCache;
|
|||
*/
|
||||
interface ICameraDeviceSession extends @3.3::ICameraDeviceSession {
|
||||
|
||||
/**
|
||||
* constructDefaultRequestSettings_3_4:
|
||||
*
|
||||
* Create capture settings for standard camera use cases. Supports the
|
||||
* new template enums added in @3.4.
|
||||
*
|
||||
* The device must return a settings buffer that is configured to meet the
|
||||
* requested use case, which must be one of the CAMERA3_TEMPLATE_*
|
||||
* enums. All request control fields must be included.
|
||||
*
|
||||
* Performance requirements:
|
||||
*
|
||||
* This must be a non-blocking call. The HAL should return from this call
|
||||
* in 1ms, and must return from this call in 5ms.
|
||||
*
|
||||
* Return values:
|
||||
* @return status Status code for the operation, one of:
|
||||
* OK:
|
||||
* On a successful construction of default settings.
|
||||
* INTERNAL_ERROR:
|
||||
* An unexpected internal error occurred, and the default settings
|
||||
* are not available.
|
||||
* ILLEGAL_ARGUMENT:
|
||||
* The camera HAL does not support the input template type
|
||||
* CAMERA_DISCONNECTED:
|
||||
* An external camera device has been disconnected, and is no longer
|
||||
* available. This camera device interface is now stale, and a new
|
||||
* instance must be acquired if the device is reconnected. All
|
||||
* subsequent calls on this interface must return
|
||||
* CAMERA_DISCONNECTED.
|
||||
* @return requestTemplate The default capture request settings for the requested
|
||||
* use case, or an empty metadata structure if status is not OK.
|
||||
*
|
||||
*/
|
||||
constructDefaultRequestSettings_3_4(RequestTemplate type) generates
|
||||
(Status status, @3.2::CameraMetadata requestTemplate);
|
||||
|
||||
/**
|
||||
* configureStreams_3_4:
|
||||
*
|
||||
|
|
|
@ -40,6 +40,14 @@ CameraDeviceSession::CameraDeviceSession(
|
|||
CameraDeviceSession::~CameraDeviceSession() {
|
||||
}
|
||||
|
||||
Return<void> CameraDeviceSession::constructDefaultRequestSettings_3_4(
|
||||
RequestTemplate type, ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) {
|
||||
V3_2::CameraMetadata outMetadata;
|
||||
Status status = constructDefaultRequestSettingsRaw( (int) type, &outMetadata);
|
||||
_hidl_cb(status, outMetadata);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> CameraDeviceSession::configureStreams_3_4(
|
||||
const StreamConfiguration& requestedConfiguration,
|
||||
ICameraDeviceSession::configureStreams_3_4_cb _hidl_cb) {
|
||||
|
|
|
@ -178,33 +178,53 @@ void ExternalCameraDeviceSession::dumpState(const native_handle_t*) {
|
|||
}
|
||||
|
||||
Return<void> ExternalCameraDeviceSession::constructDefaultRequestSettings(
|
||||
V3_2::RequestTemplate type,
|
||||
V3_2::ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) {
|
||||
V3_2::CameraMetadata outMetadata;
|
||||
Status status = constructDefaultRequestSettingsRaw(
|
||||
static_cast<RequestTemplate>(type), &outMetadata);
|
||||
_hidl_cb(status, outMetadata);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> ExternalCameraDeviceSession::constructDefaultRequestSettings_3_4(
|
||||
RequestTemplate type,
|
||||
ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) {
|
||||
ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) {
|
||||
V3_2::CameraMetadata outMetadata;
|
||||
Status status = constructDefaultRequestSettingsRaw(type, &outMetadata);
|
||||
_hidl_cb(status, outMetadata);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Status ExternalCameraDeviceSession::constructDefaultRequestSettingsRaw(RequestTemplate type,
|
||||
V3_2::CameraMetadata *outMetadata) {
|
||||
CameraMetadata emptyMd;
|
||||
Status status = initStatus();
|
||||
if (status != Status::OK) {
|
||||
_hidl_cb(status, emptyMd);
|
||||
return Void();
|
||||
return status;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case RequestTemplate::PREVIEW:
|
||||
case RequestTemplate::STILL_CAPTURE:
|
||||
case RequestTemplate::VIDEO_RECORD:
|
||||
case RequestTemplate::VIDEO_SNAPSHOT:
|
||||
_hidl_cb(Status::OK, mDefaultRequests[static_cast<int>(type)]);
|
||||
case RequestTemplate::VIDEO_SNAPSHOT: {
|
||||
*outMetadata = mDefaultRequests[type];
|
||||
break;
|
||||
}
|
||||
case RequestTemplate::MANUAL:
|
||||
case RequestTemplate::ZERO_SHUTTER_LAG:
|
||||
// Don't support MANUAL or ZSL template
|
||||
_hidl_cb(Status::ILLEGAL_ARGUMENT, emptyMd);
|
||||
case RequestTemplate::MOTION_TRACKING_PREVIEW:
|
||||
case RequestTemplate::MOTION_TRACKING_BEST:
|
||||
// Don't support MANUAL, ZSL, MOTION_TRACKING_* templates
|
||||
status = Status::ILLEGAL_ARGUMENT;
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s: unknown request template type %d", __FUNCTION__, static_cast<int>(type));
|
||||
_hidl_cb(Status::ILLEGAL_ARGUMENT, emptyMd);
|
||||
status = Status::ILLEGAL_ARGUMENT;
|
||||
break;
|
||||
}
|
||||
return Void();
|
||||
return status;
|
||||
}
|
||||
|
||||
Return<void> ExternalCameraDeviceSession::configureStreams(
|
||||
|
@ -1767,21 +1787,21 @@ status_t ExternalCameraDeviceSession::initDefaultRequests() {
|
|||
const uint8_t controlMode = ANDROID_CONTROL_MODE_AUTO;
|
||||
UPDATE(md, ANDROID_CONTROL_MODE, &controlMode, 1);
|
||||
|
||||
for (int type = static_cast<int>(RequestTemplate::PREVIEW);
|
||||
type <= static_cast<int>(RequestTemplate::VIDEO_SNAPSHOT); type++) {
|
||||
auto requestTemplates = hidl_enum_iterator<RequestTemplate>();
|
||||
for (RequestTemplate type : requestTemplates) {
|
||||
::android::hardware::camera::common::V1_0::helper::CameraMetadata mdCopy = md;
|
||||
uint8_t intent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;
|
||||
switch (type) {
|
||||
case static_cast<int>(RequestTemplate::PREVIEW):
|
||||
case RequestTemplate::PREVIEW:
|
||||
intent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;
|
||||
break;
|
||||
case static_cast<int>(RequestTemplate::STILL_CAPTURE):
|
||||
case RequestTemplate::STILL_CAPTURE:
|
||||
intent = ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE;
|
||||
break;
|
||||
case static_cast<int>(RequestTemplate::VIDEO_RECORD):
|
||||
case RequestTemplate::VIDEO_RECORD:
|
||||
intent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD;
|
||||
break;
|
||||
case static_cast<int>(RequestTemplate::VIDEO_SNAPSHOT):
|
||||
case RequestTemplate::VIDEO_SNAPSHOT:
|
||||
intent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT;
|
||||
break;
|
||||
default:
|
||||
|
@ -1987,4 +2007,3 @@ int AllocatedFrame::getCroppedLayout(const IMapper::Rect& rect, YCbCrLayout* out
|
|||
} // namespace camera
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
|
|
|
@ -73,6 +73,9 @@ protected:
|
|||
// Methods from v3.3 and earlier will trampoline to inherited implementation
|
||||
|
||||
// New methods for v3.4
|
||||
Return<void> constructDefaultRequestSettings_3_4(
|
||||
RequestTemplate type,
|
||||
ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb);
|
||||
|
||||
Return<void> configureStreams_3_4(
|
||||
const StreamConfiguration& requestedConfiguration,
|
||||
|
@ -139,6 +142,12 @@ private:
|
|||
return mParent->close();
|
||||
}
|
||||
|
||||
virtual Return<void> constructDefaultRequestSettings_3_4(
|
||||
RequestTemplate type,
|
||||
ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) override {
|
||||
return mParent->constructDefaultRequestSettings_3_4(type, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> configureStreams_3_3(
|
||||
const V3_2::StreamConfiguration& requestedConfiguration,
|
||||
configureStreams_3_3_cb _hidl_cb) override {
|
||||
|
|
|
@ -51,7 +51,7 @@ using ::android::hardware::camera::device::V3_2::ErrorCode;
|
|||
using ::android::hardware::camera::device::V3_2::ICameraDeviceCallback;
|
||||
using ::android::hardware::camera::device::V3_2::MsgType;
|
||||
using ::android::hardware::camera::device::V3_2::NotifyMsg;
|
||||
using ::android::hardware::camera::device::V3_2::RequestTemplate;
|
||||
using ::android::hardware::camera::device::V3_4::RequestTemplate;
|
||||
using ::android::hardware::camera::device::V3_2::Stream;
|
||||
using ::android::hardware::camera::device::V3_4::StreamConfiguration;
|
||||
using ::android::hardware::camera::device::V3_2::StreamConfigurationMode;
|
||||
|
@ -172,7 +172,11 @@ protected:
|
|||
// Methods from ::android::hardware::camera::device::V3_2::ICameraDeviceSession follow
|
||||
|
||||
Return<void> constructDefaultRequestSettings(
|
||||
RequestTemplate,
|
||||
V3_2::RequestTemplate,
|
||||
ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb);
|
||||
|
||||
Return<void> constructDefaultRequestSettings_3_4(
|
||||
RequestTemplate type,
|
||||
ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb);
|
||||
|
||||
Return<void> configureStreams(
|
||||
|
@ -227,6 +231,9 @@ protected:
|
|||
std::vector<HalStreamBuffer> buffers;
|
||||
};
|
||||
|
||||
Status constructDefaultRequestSettingsRaw(RequestTemplate type,
|
||||
V3_2::CameraMetadata *outMetadata);
|
||||
|
||||
static std::vector<SupportedV4L2Format> sortFormats(
|
||||
const std::vector<SupportedV4L2Format>&);
|
||||
static CroppingType initCroppingType(const std::vector<SupportedV4L2Format>&);
|
||||
|
@ -363,7 +370,7 @@ protected:
|
|||
// Protect against invokeProcessCaptureResultCallback()
|
||||
Mutex mProcessCaptureResultLock;
|
||||
|
||||
std::unordered_map<int, CameraMetadata> mDefaultRequests;
|
||||
std::unordered_map<RequestTemplate, CameraMetadata> mDefaultRequests;
|
||||
/* End of members not changed after initialize() */
|
||||
|
||||
private:
|
||||
|
@ -408,6 +415,12 @@ private:
|
|||
return mParent->close();
|
||||
}
|
||||
|
||||
virtual Return<void> constructDefaultRequestSettings_3_4(
|
||||
RequestTemplate type,
|
||||
ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) override {
|
||||
return mParent->constructDefaultRequestSettings_3_4(type, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> configureStreams_3_3(
|
||||
const V3_2::StreamConfiguration& requestedConfiguration,
|
||||
configureStreams_3_3_cb _hidl_cb) override {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package android.hardware.camera.device@3.4;
|
||||
|
||||
import @3.2::types;
|
||||
import @3.2::RequestTemplate;
|
||||
import @3.2::StreamConfigurationMode;
|
||||
import @3.2::Stream;
|
||||
import @3.3::HalStream;
|
||||
|
@ -61,6 +61,36 @@ struct Stream {
|
|||
string physicalCameraId;
|
||||
};
|
||||
|
||||
/**
|
||||
* New request templates, extending the @3.2 RequestTemplate
|
||||
*/
|
||||
enum RequestTemplate : @3.2::RequestTemplate {
|
||||
/**
|
||||
* A template for selecting camera parameters that match TEMPLATE_PREVIEW as closely as
|
||||
* possible while improving the camera output for motion tracking use cases.
|
||||
*
|
||||
* This template is best used by applications that are frequently switching between motion
|
||||
* tracking use cases and regular still capture use cases, to minimize the IQ changes
|
||||
* when swapping use cases.
|
||||
*
|
||||
* This template is guaranteed to be supported on camera devices that support the
|
||||
* REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING capability.
|
||||
*/
|
||||
MOTION_TRACKING_PREVIEW = 7,
|
||||
|
||||
/**
|
||||
* A template for selecting camera parameters that maximize the quality of camera output for
|
||||
* motion tracking use cases.
|
||||
*
|
||||
* This template is best used by applications dedicated to motion tracking applications,
|
||||
* which aren't concerned about fast switches between motion tracking and other use cases.
|
||||
*
|
||||
* This template is guaranteed to be supported on camera devices that support the
|
||||
* REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING capability.
|
||||
*/
|
||||
MOTION_TRACKING_BEST = 8,
|
||||
};
|
||||
|
||||
/**
|
||||
* StreamConfiguration:
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue