horizonos/virtualcamera/VirtualCamera.hcameraName
: const char * |
Set camera name for the virtual camera device.
Optional, if not set, the default value is an empty string.
This camera name will be exposed through vendor tag "com.meta.extra_metadata.camera_name" key. It is used to indicate the camera name e.g. for app defined cameras. The default is an empty string. The client is expected to provide a null terminated ASCII or UTF-8 C-style string.
Signature
const char* HzVirtualCameraConfiguration::cameraName |
cameraPosition
: HzVirtualCameraPosition |
Set lens position for the virtual camera device.
Optional, if not set, the default value is CameraPosition NONE (-1).
This camera position will be exposed through "com.meta.extra_metadata.position" key. It is used to indicate the positioning (left/right) of an RGB camera on the front of the HMD. The vendor tag is only set if this is called.
Signature
HzVirtualCameraPosition HzVirtualCameraConfiguration::cameraPosition |
cameraSource
: HzVirtualCameraSource |
Set camera source for the virtual camera device.
Optional, if not set, the default value is HZ_VIRTUAL_CAMERA_SOURCE_APP_DEFINED.
CameraSource APP_DEFINED requires permission CREATE_VIRTUAL_CAMERA which is protectionLevel normal and just needs to be declared in the app manifest. CameraSource PASSTHROUGH, AVATAR and SPATIAL require permission CREATE_VIRTUAL_DEVICE which is protectionLevel signature and not available to 3P apps.
This camera source will be exposed in vendor tag "com.meta.extra_metadata.camera_source" It is used to identify the source of the video feed and enforce the corresponding permissions within camera service. Avatar and app defined camera source utilizes camera permission group, while passthrough camera source utilizes new passthrough special permission.
Signature
HzVirtualCameraSource HzVirtualCameraConfiguration::cameraSource |
cameraThumbnailUri
: const char * |
Set Content URI string for camera thumbnail of the virtual camera device.
Optional, if not set, the default value is an empty string.
This Content URI will be exposed through vendor tag "com.meta.extra_metadata.camera_thumbnail" key. It is used to indicate the Content URI for the camera thumbnail image e.g. for app defined cameras. The default is an empty string. The ContentProvider SDK must be implemented by the app to support this feature. Camera Consumer Apps can then use the Content URI together with ContentResolver SDK to fetch the thumbnail image.
Signature
const char* HzVirtualCameraConfiguration::cameraThumbnailUri |
clientData
: void * |
Set application-owned opaque pointer for the HzVirtualCameraConfiguration.
Optional, if not set (nullptr), the value passed to the callbacks will also be nullptr.
This pointer will be passed to the callbacks registered for the HzVirtualCameraConfiguration.
Signature
void* HzVirtualCameraConfiguration::clientData |
id
: const char * |
Camera id for the virtual camera device.
Optional, if not set (nullptr), the assigned id will be implementation defined.
The id can not be set for cameras of type HZ_VIRTUAL_CAMERA_SOURCE_APP_DEFINED.
The id is used to identify the virtual camera in the Camera API client. The id must be unique among all virtual cameras registered in the system. An attempt to configure the id that is already in use by another virtual camera will result in a failed call to HzVirtualCamera_create with error code HZ_VIRTUAL_CAMERA_STATUS_INTERNAL_ERROR. The client is expected to provide a null terminated ASCII or UTF-8 C-style string. For that string only alphanumeric characters are allowed.
Signature
const char* HzVirtualCameraConfiguration::id |
inputStreamConfigs
: const HzVirtualCameraInputConfiguration *const * |
Set a pointer for an array of supported input stream configurations.
At least one input configuration needs to be added so the camera can be successfully registered.
In case you register input resolutions with multiple aspect ratios, you have to make sure that the resolution with the smallest aspect ratio has bigger or equal width and height than all other input resolutions. This ensures that every possible output resolutions request via Camera API can be rendered from a single input resolution which is horizontally center cropped (height decreased) and then downscaled. Otherwise, the registration will fail with HZ_VIRTUAL_CAMERA_STATUS_INVALID_ARGUMENT.
By adding this input configuration, the caller declares that it can provide frames with the specified width, height and format. This configuration will be used to infer possible output configurations for the Camera API client listed in CameraCharacteristics.
OnStreamConfigured callback will be invoked for one of the input configurations best matching the Camera API client request.
Signature
const HzVirtualCameraInputConfiguration* const* HzVirtualCameraConfiguration::inputStreamConfigs |
inputStreamConfigsCount
: uint32_t |
Set number of elements of array containing the supported input stream configurations.
Signature
uint32_t HzVirtualCameraConfiguration::inputStreamConfigsCount |
inputTimeoutMs
: long |
Set timeout - maximal time (ms) to wait for new frame in input queue, request processing will block until timeout or until there's new frame in the input buffer queue (Surface).
Optional, if not set, the default value is 1000.
Configure how to handle timeout when waiting for new frame in input Surface. During normal operation, virtual camera will repeat previous frame if further waiting for new frame would mean violating the fps range of the request.
Setting this option allows producer app to force virtual camera to wait for new frame in input surface for up to specified timeout and configure how that timeout should be handled.
Using this option puts responsibility of delivering frames in timely manner to the virtual camera owner, as delays in processing capture requests might result in unrecoverable timeouts on framework and client side.
Signature
long HzVirtualCameraConfiguration::inputTimeoutMs |
inputTimeoutStrategy
: HzVirtualCameraInputTimeoutStrategy |
Set timeout strategy - how to handle the expiration of timeout.
Optional, if not set, the default value is HZ_VIRTUAL_CAMERA_INPUT_TIMEOUT_STRATEGY_REPEAT_FRAME_RESPECT_MIN_FPS.
Configure how to handle timeout when waiting for new frame in input Surface. During normal operation, virtual camera will repeat previous frame if further waiting for new frame would mean violating the fps range of the request.
Setting this option allows producer app to force virtual camera to wait for new frame in input surface for up to specified timeout and configure how that timeout should be handled.
Using this option puts responsibility of delivering frames in timely manner to the virtual camera owner, as delays in processing capture requests might result in unrecoverable timeouts on framework and client side.
Signature
HzVirtualCameraInputTimeoutStrategy HzVirtualCameraConfiguration::inputTimeoutStrategy |
intrinsicCalibration
: const HzVirtualCameraLensIntrinsicCalibration * |
Set intrinsic calibration for virtual camera instance.
Optional, if not set (nullptr), the respective camera metadata will be null.
This will be exposed through CameraCharacteristic.LENS_INTRINSIC_CALIBRATION key in CameraCharacteristics of virtual camera metadata. See CameraCharacteristic.LENS_INTRINSIC_CALIBRATION for details.
Signature
const HzVirtualCameraLensIntrinsicCalibration* HzVirtualCameraConfiguration::intrinsicCalibration |
intrinsicCalibrationSpatial
: const HzVirtualCameraLensIntrinsicCalibration * |
Set intrinsic calibration for the spatial (right) camera.
Optional, if not set (nullptr), the respective vendor tag metadata will not be present.
For spatial camera, the standard LENS_INTRINSIC_CALIBRATION metadata key contains the left camera's intrinsics. This field allows specifying the right camera's intrinsics, which will be exposed through vendor tag "com.meta.extra_metadata.intrinsic_calibration_spatial".
Both left and right intrinsics should incorporate any stereo rectification and vertical shift applied during spatial camera rendering.
Signature
const HzVirtualCameraLensIntrinsicCalibration* HzVirtualCameraConfiguration::intrinsicCalibrationSpatial |
lensFacing
: HzVirtualCameraLensFacing |
Set lens facing for the virtual camera device.
Optional, if not set, the default value is HZ_VIRTUAL_CAMERA_LENS_FACING_EXTERNAL.
This will be exposed through CameraCharacteristic.LENS_FACING key in CameraCharacteristics of virtual camera metadata. See CameraCharacteristic.LENS_FACING for details.
Signature
HzVirtualCameraLensFacing HzVirtualCameraConfiguration::lensFacing |
lensPose
: const HzPose * |
Set pose rotation quaternion and pose translation of virtual camera lens.
Optional, if not set (nullptr), the respective camera metadata will be null.
The pose orientation (rotation) will be exposed through CameraCharacteristic.LENS_POSE_ROTATION key in CameraCharacteristics of virtual camera metadata. See
CameraCharacteristic.LENS_POSE_ROTATION for details. When setting the pose rotation, the pose reference must be explicitly set to different than HZ_VIRTUAL_CAMERA_LENS_POSE_REFERENCE_UNDEFINED value using HzVirtualCameraConfiguration_setPoseReference, otherwise the registration
This pose position (translation) exposed through CameraCharacteristic.LENS_POSE_TRANSLATION key in CameraCharacteristics of virtual camera metadata. See
CameraCharacteristic.LENS_POSE_TRANSLATION for details. When setting the pose translation, the pose reference must be explicitly set to different than HZ_VIRTUAL_CAMERA_LENS_POSE_REFERENCE_UNDEFINED value using HzVirtualCameraConfiguration_setPoseReference, otherwise the registration will fail.
Signature
const HzPose* HzVirtualCameraConfiguration::lensPose |
lensPoseSpatial
: const HzPose * |
Set pose (rotation + translation) for the spatial (right) camera.
Optional, if not set (nullptr), the respective vendor tag metadata will not be present.
For spatial camera, the standard LENS_POSE_ROTATION and LENS_POSE_TRANSLATION metadata keys contain the left camera's pose. This field allows specifying the right camera's pose, which will be exposed through vendor tags "com.meta.extra_metadata.lens_pose_translation_spatial" and "com.meta.extra_metadata.lens_pose_rotation_spatial".
Both left and right poses should incorporate the stereo rectification rotation applied during spatial camera rendering.
Signature
const HzPose* HzVirtualCameraConfiguration::lensPoseSpatial |
onProcessCaptureRequest
: OnCaptureRequestCallback |
Set onCaptureRequest callback for the HzVirtualCamera.
Optional, this callback doesn't have to be set.
This callback is invoked every time when Camera API client requests a new frame from any output stream corresponding to the input stream referenced by the streamId.
Signature
OnCaptureRequestCallback HzVirtualCameraConfiguration::onProcessCaptureRequest |
onProcessCaptureRequestWithMetadata
: OnCaptureRequestWithMetadataCallback |
Set onCaptureRequestWithMetadata callback for the HzVirtualCamera.
Optional, this callback doesn't have to be set.
This callback is invoked every time when Camera API client requests a new frame from any output stream corresponding to the input stream referenced by the streamId. When perFrameCameraMetadataEnabled is true, this callback will receive the capture request metadata in addition to the streamId and frameId.
If both onProcessCaptureRequest and onProcessCaptureRequestWithMetadata are set, only onProcessCaptureRequestWithMetadata will be invoked.
Signature
OnCaptureRequestWithMetadataCallback HzVirtualCameraConfiguration::onProcessCaptureRequestWithMetadata |
onStreamClosed
: OnStreamClosedCallback |
Set onStreamClosed callback for the HzVirtualCamera.
This callback must be set. The callback will be invoked when stream previously received in OnStreamConfigured callback has become obsolete. ANativeWindow* passed to OnStreamConfigured callback
Repeated calls to this function will overwrite the previous callback.
Signature
OnStreamClosedCallback HzVirtualCameraConfiguration::onStreamClosed |
onStreamConfigured
: OnStreamConfiguredCallback |
Set onStreamConfigured callback for the HzVirtualCamera.
This callback must be set. The callback will be invoked when Camera API client opens the virtual camera and configures the stream(s).
Note that the ownership of the ANativeWindow* is transferred to the client and client is responsible for releasing it after receiving onStreamClosed callback using ANativeWindow_release(). Repeated calls to this function will overwrite the previous callback.
Signature
OnStreamConfiguredCallback HzVirtualCameraConfiguration::onStreamConfigured |
perFrameCameraMetadataEnabled
: bool |
Enable per-frame camera metadata in capture request callbacks.
Optional, if not set, the default value is false.
When set to true, the onProcessCaptureRequestWithMetadata callback will receive the capture request metadata from the Camera API client. This allows the virtual camera implementer to access camera settings like focus, exposure, zoom level, etc. that were requested by the application using the Camera API.
The metadata is serialized using libcamera_metadata format and can be accessed by casting to camera_metadata*.
Note: This requires setting the onProcessCaptureRequestWithMetadata callback instead of the deprecated onProcessCaptureRequest callback.
Signature
bool HzVirtualCameraConfiguration::perFrameCameraMetadataEnabled |
poseReference
: HzVirtualCameraLensPoseReference |
Set pose reference of virtual camera lens.
Optional, if not set, the default value is HZ_VIRTUAL_CAMERA_LENS_POSE_REFERENCE_UNDEFINED.
This will be exposed through CameraCharacteristic.LENS_POSE_REFERENCE key in CameraCharacteristics of virtual camera metadata. See CameraCharacteristic.LENS_POSE_REFERENCE for details.
Signature
HzVirtualCameraLensPoseReference HzVirtualCameraConfiguration::poseReference |
sensorOrientation
: HzVirtualCameraSensorOrientation |
Set sensor orientation for the HzVirtualCameraConfiguration.
Optional, if not set, the default value is HZ_VIRTUAL_CAMERA_SENSOR_ORIENTATION_0.
This will be exposed through CameraCharacteristic.SENSOR_ORIENTATION key in CameraCharacteristics of virtual camera metadata. See CameraCharacteristic.SENSOR_ORIENTATION for details.
Signature
HzVirtualCameraSensorOrientation HzVirtualCameraConfiguration::sensorOrientation |
timestampSource
: HzVirtualCameraAcquisitionTimestampSource |
Configure acquisition timestamp source for virtual camera instance.
Signature
HzVirtualCameraAcquisitionTimestampSource HzVirtualCameraConfiguration::timestampSource |
version
: uint32_t |
version of the structure, filled by HzVirtualCameraConfiguration_init
Signature
uint32_t HzVirtualCameraConfiguration::version |