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