diff options
Diffstat (limited to 'chromium/media/capture/video/chromeos/mojom')
4 files changed, 111 insertions, 11 deletions
diff --git a/chromium/media/capture/video/chromeos/mojom/camera3.mojom b/chromium/media/capture/video/chromeos/mojom/camera3.mojom index 5e7e6ded75d..dd99ed86dde 100644 --- a/chromium/media/capture/video/chromeos/mojom/camera3.mojom +++ b/chromium/media/capture/video/chromeos/mojom/camera3.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Next min version: 3 +// Next min version: 4 module cros.mojom; @@ -28,10 +28,6 @@ const uint32 GRALLOC_USAGE_FORCE_I420 = 0x10000000; // into a new HAL request for Zero-Shutter Lag (ZSL). See crrev.com/c/1877636 // for the CL that does the aforementioned things. const uint32 GRALLOC_USAGE_STILL_CAPTURE = 0x20000000; -// Flag to indicate ZSL is enabled for this session. Returned in the updated -// stream configuration returned from configure_streams(). Refer to -// crrev.com/c/2055927 which returns this flag. -const uint32 GRALLOC_USAGE_ZERO_SHUTTER_LAG_ENABLED = 0x40000000; [Extensible] enum HalPixelFormat { @@ -102,7 +98,8 @@ enum Camera3BufferStatus { CAMERA3_BUFFER_STATUS_ERROR = 1, }; -// Structure that contains needed information about a camera buffer. +// Structure that contains needed information about a camera buffer that could +// be used to map in userspace. struct CameraBufferHandle { uint64 buffer_id; array<handle> fds; @@ -112,6 +109,7 @@ struct CameraBufferHandle { uint32 height; array<uint32> strides; array<uint32> offsets; + [MinVersion=3] array<uint32>? sizes; }; struct Camera3StreamBuffer { @@ -253,7 +251,7 @@ interface Camera3CallbackOps { // // 7. Close() closes the camera device. // -// Next method ID: 8 +// Next method ID: 9 interface Camera3DeviceOps { // Initialize() is called once after the camera device is opened to register // the Camera3CallbackOps handle. @@ -309,4 +307,12 @@ interface Camera3DeviceOps { // Close() is called to close the camera device. Close@7() => (int32 result); + + // ConfigureStreamsAndGetAllocatedBuffers() is called every time the client + // needs to set up new set of streams. Also allocated buffers for clients that + // do not have capabilities to allocate DMA-bufs. + [MinVersion=3] + ConfigureStreamsAndGetAllocatedBuffers@8(Camera3StreamConfiguration config) => + (int32 result, Camera3StreamConfiguration? updated_config, + map<uint64, array<Camera3StreamBuffer>> allocated_buffers); }; diff --git a/chromium/media/capture/video/chromeos/mojom/camera_app.mojom b/chromium/media/capture/video/chromeos/mojom/camera_app.mojom index 7bc0da4e710..59df9f820bd 100644 --- a/chromium/media/capture/video/chromeos/mojom/camera_app.mojom +++ b/chromium/media/capture/video/chromeos/mojom/camera_app.mojom @@ -53,6 +53,11 @@ interface CameraAppDeviceProvider { // and camera app. Currently only devices running camera HAL v3 support this // feature. IsSupported() => (bool is_supported); + + // Add/Remove a virtual device for recording stream according to |enabled|. + // The virtual device has the same config as |device_id| except facing + // attribute. + SetMultipleStreamsEnabled(string device_id, bool enabled) => (bool success); }; // Inner interface that used to communicate between browser process (Remote) and @@ -68,6 +73,11 @@ interface CameraAppDeviceBridge { // and camera app. Currently only devices running camera HAL v3 support this // feature. IsSupported() => (bool is_supported); + + // Add/Remove a virtual device for recording stream according to |enabled|. + // The virtual device has the same config as |device_id| except facing + // attribute. + SetMultipleStreamsEnabled(string device_id, bool enabled) => (bool success); }; // Interface for communication between Chrome Camera App (Remote) and camera diff --git a/chromium/media/capture/video/chromeos/mojom/camera_common.mojom b/chromium/media/capture/video/chromeos/mojom/camera_common.mojom index 7c0847267d6..f26bcd95d1b 100644 --- a/chromium/media/capture/video/chromeos/mojom/camera_common.mojom +++ b/chromium/media/capture/video/chromeos/mojom/camera_common.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Next min version: 3 +// Next min version: 4 module cros.mojom; @@ -13,6 +13,9 @@ enum CameraFacing { CAMERA_FACING_BACK = 0, CAMERA_FACING_FRONT = 1, CAMERA_FACING_EXTERNAL = 2, + CAMERA_FACING_VIRTUAL_BACK = 3, + CAMERA_FACING_VIRTUAL_FRONT = 4, + CAMERA_FACING_VIRTUAL_EXTERNAL = 5, }; struct CameraResourceCost { @@ -101,6 +104,7 @@ interface CameraModule { // Gets various info about the camera specified by |camera_id|. GetCameraInfo@2(int32 camera_id) => (int32 result, CameraInfo? camera_info); + // [Deprecated in version 3] // Registers the CameraModuleCallbacks interface with the camera HAL. SetCallbacks@3(pending_remote<CameraModuleCallbacks> callbacks) => (int32 result); @@ -122,4 +126,11 @@ interface CameraModule { [MinVersion=2] GetVendorTagOps@6(pending_receiver<VendorTagOps> vendor_tag_ops_request) => (); + + // Registers the CameraModuleCallbacks associated interface with the camera + // HAL. TODO(b/169324225): Migrate all camera HAL clients to use this. + [MinVersion=3] + SetCallbacksAssociated@7( + pending_associated_remote<CameraModuleCallbacks> callbacks) + => (int32 result); }; diff --git a/chromium/media/capture/video/chromeos/mojom/cros_camera_service.mojom b/chromium/media/capture/video/chromeos/mojom/cros_camera_service.mojom index 03f5a00fdac..dec0a5017ff 100644 --- a/chromium/media/capture/video/chromeos/mojom/cros_camera_service.mojom +++ b/chromium/media/capture/video/chromeos/mojom/cros_camera_service.mojom @@ -2,13 +2,44 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Next min version: 4 +// Next min version: 6 module cros.mojom; import "components/chromeos_camera/common/jpeg_encode_accelerator.mojom"; import "components/chromeos_camera/common/mjpeg_decode_accelerator.mojom"; import "media/capture/video/chromeos/mojom/camera_common.mojom"; +import "mojo/public/mojom/base/unguessable_token.mojom"; + +// CameraClientType indicates the type of a CameraHalClient. +// It should be kept in sync with the ChromeOSCameraClientType enum in +// tools/metrics/histograms/enums.xml +[Extensible] +enum CameraClientType{ + UNKNOWN = 0, + TESTING = 1, + CHROME = 2, + ANDROID = 3, + PLUGINVM = 4, + ASH_CHROME = 5, + LACROS_CHROME = 6, +}; + +// CameraPrivacySwitchState indicates the state of the camera privacy switch. +enum CameraPrivacySwitchState{ + // For devices which can only read the privacy switch status while the camera + // is streaming, it is possible that the state of privacy switch is currently + // unknown. + UNKNOWN = 0, + + // State when the privacy switch is on, which means the black frames will be + // delivered when streaming. + ON = 1, + + // State when the privacy switch is off, which means camera should stream + // normally. + OFF = 2, +}; // The CrOS camera HAL v3 Mojo dispatcher. The dispatcher acts as a proxy and // waits for the server and the clients to register. There can only be one @@ -17,12 +48,14 @@ import "media/capture/video/chromeos/mojom/camera_common.mojom"; // channel to the server and pass the established Mojo channel to the client in // order to set up a Mojo channel between the client and the server. // -// Next method ID: 4 +// Next method ID: 6 interface CameraHalDispatcher { + // [Deprecated in version 4] // A CameraHalServer calls RegisterServer to register itself with the // dispatcher. RegisterServer@0(pending_remote<CameraHalServer> server); + // [Deprecated in version 4] // A CameraHalClient calls RegisterClient to register itself with the // dispatcher. RegisterClient@1(pending_remote<CameraHalClient> client); @@ -35,6 +68,25 @@ interface CameraHalDispatcher { // Get JpegEncodeAccelerator from dispatcher. [MinVersion=2] GetJpegEncodeAccelerator@3( pending_receiver<chromeos_camera.mojom.JpegEncodeAccelerator> jea_receiver); + + // A CameraHalServer calls RegisterServerWithToken to register itself with the + // dispatcher. CameraHalDispatcher would authenticate the server with the + // supplied |auth_token|. |callbacks| is fired by CameraHalServer to notify + // CameraHalDispatcher about CameraHalClient updates, for example when a + // CameraHalClient opens or closes a camera device. + [MinVersion=4] RegisterServerWithToken@4( + pending_remote<CameraHalServer> server, + mojo_base.mojom.UnguessableToken auth_token) => + (int32 result, pending_remote<CameraHalServerCallbacks> callbacks); + + // A CameraHalClient calls RegisterClient to register itself with the + // dispatcher. CameraHalDispatcher would authenticate the client with the + // given |type| and |auth_token|. + [MinVersion=4] RegisterClientWithToken@5( + pending_remote<CameraHalClient> client, + CameraClientType type, + mojo_base.mojom.UnguessableToken auth_token) => (int32 result); + }; // The CrOS camera HAL v3 Mojo server. @@ -45,13 +97,34 @@ interface CameraHalServer { // HAL v3 adapter. Upon successfully binding of |camera_module_request|, the // caller will have a established Mojo channel to the camera HAL v3 adapter // process. - CreateChannel@0(pending_receiver<CameraModule> camera_module_request); + CreateChannel@0(pending_receiver<CameraModule> camera_module_request, + [MinVersion=4] CameraClientType type); // Enable or disable tracing. [MinVersion=3] SetTracingEnabled@1(bool enabled); }; +// CameraHalServerCallbacks is an interface for CameraHalServer to notify +// CameraHalDispatcher for any changes on the server side, for example when a +// CameraHalClient opens or closes a camera device. +// +// Next method ID: 2 +interface CameraHalServerCallbacks { + // Fired when a CameraHalClient opens or closes a camera device. When a + // CameraHalClient loses mojo connection to CameraHalServer, CameraHalServer + // would also use this to notify that cameras are closed (not being used). + CameraDeviceActivityChange@0(int32 camera_id, + bool opened, + CameraClientType type); + + // Fired when the camera privacy switch status is changed. If the device has + // such switch, this callback will be fired immediately for once to notify its + // current status when the callbacks are registered. + [MinVersion=5] + CameraPrivacySwitchStateChange@1(CameraPrivacySwitchState state); +}; + // The CrOS camera HAL v3 Mojo client. // // Next method ID: 1 |