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 media.mojom; | 5 module media.mojom; |
6 | 6 |
7 import "media/mojo/interfaces/audio_parameters.mojom"; | 7 import "media/mojo/interfaces/audio_parameters.mojom"; |
| 8 import "url/mojo/origin.mojom"; |
8 | 9 |
9 // This interface handles audio output stream operations. | 10 // TODO: typemap to native OutputDeviceStatus. |
10 // It allows to close a stream. | 11 enum OutputDeviceStatus { |
11 // TODO(rchtara): Add methods that allow the interaction with audio output | 12 OUTPUT_DEVICE_STATUS_OK, |
12 // streams: Play, Pause and SetVolume to this interface. | 13 OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND, |
13 // See crbug.com/606707 for more details. | 14 OUTPUT_DEVICE_STATUS_ERROR_NOT_AUTHORIZED, |
14 interface AudioOutputStream { | 15 OUTPUT_DEVICE_STATUS_ERROR_TIMED_OUT, |
15 Close(); | 16 OUTPUT_DEVICE_STATUS_ERROR_INTERNAL, |
| 17 OUTPUT_DEVICE_STATUS_LAST = OUTPUT_DEVICE_STATUS_ERROR_INTERNAL, |
16 }; | 18 }; |
17 | 19 |
18 // This interface manages audio output streams. | 20 // On error, the message pipe is closed. |
19 // It allows to create an AudioOutputStream. | 21 // To close the stream, just close the message pipe. |
20 // TODO(rchtara): Add a method to request device authorization to this | |
21 // interface. | |
22 // See crbug.com/606707 for more details. | |
23 interface AudioOutput { | 22 interface AudioOutput { |
24 // TODO(rchtara): Remove |stream_id| from AudioOutput::CreateStream when all | 23 Start(AudioParameters params) => |
25 // the stream operations are mojofied. | 24 (handle<shared_buffer> shared_buffer, |
26 CreateStream( | 25 handle socket_descriptor); |
27 int32 stream_id, | 26 Play(); |
28 AudioParameters params) => | 27 Pause(); |
29 (int32 stream_id, | 28 SetVolume(double volume); |
30 AudioOutputStream? stream, | 29 }; |
31 handle<shared_buffer>? shared_buffer, | 30 |
32 handle? socket_descriptor); | 31 interface AudioOutputService { |
33 }; | 32 // Used to request a device. |
| 33 // An AudioOutputRequest may be supplied, in which case it will |
| 34 // be bound to an AudioOutput implementation or closed (in case of an error). |
| 35 // TODO better name. |
| 36 RequestDeviceAuthorization( |
| 37 // TODO: in implementation, use base::IsValueInRangeForNumericType<int> |
| 38 // before casting these back to int. |
| 39 int64 render_frame_id, |
| 40 int64 session_id, |
| 41 string device_id, |
| 42 AudioOutput&? audio_output, |
| 43 url.mojom.Origin origin) => |
| 44 (// TODO make this a struct? |
| 45 OutputDeviceStatus state, |
| 46 AudioParameters output_params, |
| 47 string matched_device_id); |
| 48 }; |
OLD | NEW |