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