| 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 video_capture.mojom; | 5 module video_capture.mojom; |
| 6 | 6 |
| 7 import "media/capture/mojo/video_capture_types.mojom"; | 7 import "media/capture/mojo/video_capture_types.mojom"; |
| 8 import "services/video_capture/public/interfaces/device_descriptor.mojom"; | |
| 9 import "services/video_capture/public/interfaces/device.mojom"; | 8 import "services/video_capture/public/interfaces/device.mojom"; |
| 10 import "services/video_capture/public/interfaces/capture_settings.mojom"; | |
| 11 | 9 |
| 12 enum DeviceAccessResultCode { | 10 enum DeviceAccessResultCode { |
| 13 NOT_INITIALIZED, | 11 NOT_INITIALIZED, |
| 14 SUCCESS, | 12 SUCCESS, |
| 15 ERROR_DEVICE_NOT_FOUND | 13 ERROR_DEVICE_NOT_FOUND |
| 16 }; | 14 }; |
| 17 | 15 |
| 18 // Enables access to a set of video capture devices. | 16 // Enables access to a set of video capture devices. |
| 19 // Typical operation is to first call EnumerateDeviceDescriptors() to obtain | 17 // Typical operation is to first call GetDeviceInfos() to obtain |
| 20 // information about available devices. The |device_id| of the descriptors can | 18 // information about available devices. The |device_id| of the infos can |
| 21 // subsequently be used to either obtain the supported formats for a device | 19 // subsequently be used to create an instance of |
| 22 // using GetSupportedFormats(), or to create an instance of | |
| 23 // video_capture.mojom.Device using CreateDevice(). | 20 // video_capture.mojom.Device using CreateDevice(). |
| 24 // The factory guarantees that no two device descriptors it returns use the | 21 // The factory guarantees that no two device infos it returns use the |
| 25 // same |device_id|. | 22 // same |device_id|. |
| 26 interface DeviceFactory { | 23 interface DeviceFactory { |
| 27 EnumerateDeviceDescriptors() | 24 GetDeviceInfos() |
| 28 => (array<DeviceDescriptor> descriptors); | 25 => (array<media.mojom.VideoCaptureDeviceInfo> device_infos); |
| 29 | |
| 30 GetSupportedFormats(string device_id) | |
| 31 => (array<I420CaptureFormat> supported_formats); | |
| 32 | 26 |
| 33 // Provides exclusive access to the device identified by |device_id|. | 27 // Provides exclusive access to the device identified by |device_id|. |
| 34 // The access is valid until either the message pipe associated with | 28 // The access is valid until either the message pipe associated with |
| 35 // |device_request| is closed by the client, or a subsequent call to | 29 // |device_request| is closed by the client, or a subsequent call to |
| 36 // CreateDevice() is made. When a subsequent call is made while the | 30 // CreateDevice() is made. When a subsequent call is made while the |
| 37 // |device_request| from a previous call has not yet been closed, the service | 31 // |device_request| from a previous call has not yet been closed, the service |
| 38 // "revokes" that previous |device_request| (by closing the connection) and | 32 // "revokes" that previous |device_request| (by closing the connection) and |
| 39 // the exclusive access goes to the new |device_request|. | 33 // the exclusive access goes to the new |device_request|. |
| 40 // Note: This design avoids the issue of it not being clear how soon after a | 34 // Note: This design avoids the issue of it not being clear how soon after a |
| 41 // |device_request| has been (asynchronously) discarded a subsequent call to | 35 // |device_request| has been (asynchronously) discarded a subsequent call to |
| 42 // CreateDevice() would succeed if it were to deny access while still | 36 // CreateDevice() would succeed if it were to deny access while still |
| 43 // in use. | 37 // in use. |
| 44 CreateDevice(string device_id, Device& device_request) | 38 CreateDevice(string device_id, Device& device_request) |
| 45 => (DeviceAccessResultCode result_code); | 39 => (DeviceAccessResultCode result_code); |
| 46 }; | 40 }; |
| OLD | NEW |