Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 module mojom; | 5 module mojom; |
| 6 | 6 |
| 7 import "media/capture/mojo/video_capture_types.mojom"; | 7 import "media/capture/mojo/video_capture_types.mojom"; |
| 8 import "media/mojo/interfaces/audio_parameters.mojom"; | |
| 8 import "url/mojo/origin.mojom"; | 9 import "url/mojo/origin.mojom"; |
| 9 | 10 |
| 10 [Native] | 11 [Native] |
| 11 enum MediaDeviceType; | 12 enum MediaDeviceType; |
| 12 | 13 |
| 13 [Native] | 14 [Native] |
| 14 struct MediaDeviceInfo; | 15 struct MediaDeviceInfo; |
| 15 | 16 |
| 16 // The values for this enum match the ones defined in | 17 // The values for this enum match the ones defined in |
| 17 // https://w3c.github.io/mediacapture-main/#def-constraint-facingMode | 18 // https://w3c.github.io/mediacapture-main/#def-constraint-facingMode |
| 18 // with the addition of NONE, which would map to the empty string in | 19 // with the addition of NONE, which would map to the empty string in |
| 19 // JavaScript. | 20 // JavaScript. |
| 20 enum FacingMode { | 21 enum FacingMode { |
| 21 NONE, | 22 NONE, |
| 22 USER, | 23 USER, |
| 23 ENVIRONMENT, | 24 ENVIRONMENT, |
| 24 LEFT, | 25 LEFT, |
| 25 RIGHT | 26 RIGHT |
| 26 }; | 27 }; |
| 27 | 28 |
| 28 struct VideoInputDeviceCapabilities { | 29 struct VideoInputDeviceCapabilities { |
| 29 string device_id; | 30 string device_id; |
| 30 array<media.mojom.VideoCaptureFormat> formats; | 31 array<media.mojom.VideoCaptureFormat> formats; |
| 31 FacingMode facing_mode; | 32 FacingMode facing_mode; |
| 32 }; | 33 }; |
| 33 | 34 |
| 35 struct AudioInputDeviceCapabilities { | |
| 36 string device_id; | |
| 37 media.mojom.AudioParameters parameters; | |
| 38 }; | |
| 39 | |
| 34 // This object lives in the browser and is responsible for processing device | 40 // This object lives in the browser and is responsible for processing device |
| 35 // enumeration requests and managing subscriptions for device-change | 41 // enumeration requests and managing subscriptions for device-change |
| 36 // notifications. | 42 // notifications. |
| 37 interface MediaDevicesDispatcherHost { | 43 interface MediaDevicesDispatcherHost { |
| 38 // The reply always contains NUM_MEDIA_DEVICE_TYPES elements. | 44 // The reply always contains NUM_MEDIA_DEVICE_TYPES elements. |
| 39 // The result is indexed by device type as defined in | 45 // The result is indexed by device type as defined in |
| 40 // content/common/media/media_devices.h. | 46 // content/common/media/media_devices.h. |
| 41 EnumerateDevices(bool request_audio_input, | 47 EnumerateDevices(bool request_audio_input, |
| 42 bool request_video_input, | 48 bool request_video_input, |
| 43 bool request_audio_output, | 49 bool request_audio_output, |
| 44 url.mojom.Origin security_origin) | 50 url.mojom.Origin security_origin) |
| 45 => (array<array<MediaDeviceInfo>> enumeration); | 51 => (array<array<MediaDeviceInfo>> enumeration); |
| 46 | 52 |
| 47 // Returns a list of video devices and their capabilities. | 53 // Returns a list of video devices and their capabilities. |
| 48 // If there is a user-preferred device, it is the first in the result. | 54 // If there is a user-preferred device, it is the first in the result. |
| 49 // The result of this function is intended for the implementation details | 55 // The result of this function is intended for the implementation details |
| 50 // of algorithms such as settings selection for getUserMedia. | 56 // of algorithms such as settings selection for getUserMedia. |
| 51 // Do not expose the data contained in result of this function to JavaScript. | 57 // Do not expose the data contained in the result of this function to |
| 58 // JavaScript. | |
| 52 GetVideoInputCapabilities(url.mojom.Origin security_origin) | 59 GetVideoInputCapabilities(url.mojom.Origin security_origin) |
| 53 => (array<VideoInputDeviceCapabilities> video_input_device_capabilities); | 60 => (array<VideoInputDeviceCapabilities> video_input_device_capabilities); |
| 54 | 61 |
| 62 // Returns a list of audio input devices and their capabilities. | |
| 63 // If there is a user-preferred device, it is the first in the result. | |
| 64 // Otherwise, the system-default device is the first in the result. | |
| 65 // The result of this function is intended for the implementation details | |
| 66 // of algorithms such as settings selection for getUserMedia. | |
| 67 // Do not expose the data contained in the result of this function to | |
| 68 // JavaScript. | |
| 69 GetAudioInputCapabilities(url.mojom.Origin security_origin) | |
|
Mike West
2017/05/09 09:30:37
Do you need to pass in an origin? Shouldn't the br
Guido Urdaneta
2017/05/09 09:43:33
This is how it was done in older IPC-based messagi
| |
| 70 => (array<AudioInputDeviceCapabilities> audio_input_device_capabilities); | |
| 71 | |
| 55 // Creates a subscription for device-change notifications for the calling | 72 // Creates a subscription for device-change notifications for the calling |
| 56 // frame/security origin. It is the responsibility of the caller to send | 73 // frame/security origin. It is the responsibility of the caller to send |
| 57 // |subscription_id| values that are unique per device type. | 74 // |subscription_id| values that are unique per device type. |
| 58 // Requests to create a subscription with an ID that already exists for type | 75 // Requests to create a subscription with an ID that already exists for type |
| 59 // |type| are invalid and result in a renderer crash. | 76 // |type| are invalid and result in a renderer crash. |
| 60 SubscribeDeviceChangeNotifications(MediaDeviceType type, | 77 SubscribeDeviceChangeNotifications(MediaDeviceType type, |
| 61 uint32 subscription_id, | 78 uint32 subscription_id, |
| 62 url.mojom.Origin security_origin); | 79 url.mojom.Origin security_origin); |
| 63 | 80 |
| 64 // Removes a subscription to device-change notifications for the calling | 81 // Removes a subscription to device-change notifications for the calling |
| 65 // frame. The caller is responsible for sending |subscription_id| values that | 82 // frame. The caller is responsible for sending |subscription_id| values that |
| 66 // that refer to existing subscriptions for type |type|. Requests to remove | 83 // that refer to existing subscriptions for type |type|. Requests to remove |
| 67 // a nonexisting subscription with are invalid and result in a renderer crash. | 84 // a nonexisting subscription with are invalid and result in a renderer crash. |
| 68 UnsubscribeDeviceChangeNotifications(MediaDeviceType type, | 85 UnsubscribeDeviceChangeNotifications(MediaDeviceType type, |
| 69 uint32 subscription_id); | 86 uint32 subscription_id); |
| 70 }; | 87 }; |
| 71 | 88 |
| 72 // This object lives in the renderer process and is used by the browser process | 89 // This object lives in the renderer process and is used by the browser process |
| 73 // to pass device-change notifications to the renderer. | 90 // to pass device-change notifications to the renderer. |
| 74 interface MediaDevicesListener { | 91 interface MediaDevicesListener { |
| 75 // Called to notify a change in the set of devices of type |type| for | 92 // Called to notify a change in the set of devices of type |type| for |
| 76 // subscription |subscription_id|. |device_infos| contains the new list of | 93 // subscription |subscription_id|. |device_infos| contains the new list of |
| 77 // devices of type |type|, with device and group IDs obfuscated according to | 94 // devices of type |type|, with device and group IDs obfuscated according to |
| 78 // the subscription's security origin. | 95 // the subscription's security origin. |
| 79 OnDevicesChanged(MediaDeviceType type, | 96 OnDevicesChanged(MediaDeviceType type, |
| 80 uint32 subscription_id, | 97 uint32 subscription_id, |
| 81 array<MediaDeviceInfo> device_infos); | 98 array<MediaDeviceInfo> device_infos); |
| 82 }; | 99 }; |
| OLD | NEW |