| // Copyright 2016 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module video_capture.mojom; |
| |
| import "media/capture/mojo/video_capture_types.mojom"; |
| import "services/video_capture/public/interfaces/device_descriptor.mojom"; |
| import "services/video_capture/public/interfaces/device.mojom"; |
| import "services/video_capture/public/interfaces/capture_settings.mojom"; |
| |
| enum DeviceAccessResultCode { |
| NOT_INITIALIZED, |
| SUCCESS, |
| ERROR_DEVICE_NOT_FOUND |
| }; |
| |
| // Enables access to a set of video capture devices. |
| // Typical operation is to first call EnumerateDeviceDescriptors() to obtain |
| // information about available devices. The |device_id| of the descriptors can |
| // subsequently be used to either obtain the supported formats for a device |
| // using GetSupportedFormats(), or to create an instance of |
| // video_capture.mojom.Device using CreateDevice(). |
| // The factory guarantees that no two device descriptors it returns use the |
| // same |device_id|. |
| interface DeviceFactory { |
| EnumerateDeviceDescriptors() |
| => (array<DeviceDescriptor> descriptors); |
| |
| GetSupportedFormats(string device_id) |
| => (array<I420CaptureFormat> supported_formats); |
| |
| // Provides exclusive access to the device identified by |device_id|. |
| // The access is valid until either the message pipe associated with |
| // |device_request| is closed by the client, or a subsequent call to |
| // CreateDevice() is made. When a subsequent call is made while the |
| // |device_request| from a previous call has not yet been closed, the service |
| // "revokes" that previous |device_request| (by closing the connection) and |
| // the exclusive access goes to the new |device_request|. |
| // Note: This design avoids the issue of it not being clear how soon after a |
| // |device_request| has been (asynchronously) discarded a subsequent call to |
| // CreateDevice() would succeed if it were to deny access while still |
| // in use. |
| CreateDevice(string device_id, Device& device_request) |
| => (DeviceAccessResultCode result_code); |
| }; |