Chromium Code Reviews| Index: extensions/common/api/audio.idl |
| diff --git a/extensions/common/api/audio.idl b/extensions/common/api/audio.idl |
| index 36a1124bd3b66b81339248e984c368cb6b9e5885..f1b7582e1838dfa3decacaeb935440b9aba8d8b6 100644 |
| --- a/extensions/common/api/audio.idl |
| +++ b/extensions/common/api/audio.idl |
| @@ -7,6 +7,12 @@ |
| // system. This API is currently only implemented for ChromeOS. |
| namespace audio { |
| + // Type of stream an audio device provides. |
| + enum StreamType { |
| + INPUT, |
| + OUTPUT |
| + }; |
| + |
| dictionary OutputDeviceInfo { |
| // The unique identifier of the audio output device. |
| DOMString id; |
| @@ -36,8 +42,10 @@ namespace audio { |
| dictionary AudioDeviceInfo { |
| // The unique identifier of the audio device. |
| DOMString id; |
| + // Stream type associated with this device (input or output). |
| + StreamType streamType; |
| // True for input device; false for output device. |
| - boolean isInput; |
| + [deprecated="Use |streamType|."] boolean isInput; |
| // Type of the device, including "INTERNAL_SPEAKER", "INTERNAL_MIC", |
| // "HEADPHONE", "USB", "BLUETOOTH", "HDMI", "MIC", "KEYBOARD_MIC", |
| // "AOKR", and "OTHER". |
| @@ -58,7 +66,7 @@ namespace audio { |
| dictionary DeviceProperties { |
| // True if this is muted. |
| - boolean isMuted; |
| + [deprecated="Use $(ref:setMute) to set mute state."] boolean? isMuted; |
| // If this is an output device then this field indicates the output volume. |
| // If this is an input device then this field is ignored. |
| double? volume; |
| @@ -67,31 +75,54 @@ namespace audio { |
| double? gain; |
| }; |
| + dictionary MuteStateChangedEvent { |
| + // Type of the stream for which mute value has changed. The updated mute |
| + // value applies to all devices with this stream type. |
| + StreamType streamType; |
| + |
| + // Value to which mute steate changed. |
| + boolean value; |
| + }; |
| + |
| callback GetInfoCallback = void(OutputDeviceInfo[] outputInfo, |
| InputDeviceInfo[] inputInfo); |
| - callback SetActiveDevicesCallback = void(); |
| - callback SetPropertiesCallback = void(); |
| + callback GetMuteCallback = void(boolean value); |
| + callback EmptyCallback = void(); |
| interface Functions { |
| // Gets the information of all audio output and input devices. |
| static void getInfo(GetInfoCallback callback); |
| - // Sets the active devices to the devices specified by |ids|. |
| - // It can pass in the "complete" active device id list of either input |
| - // devices, or output devices, or both. If only input device ids are passed |
| - // in, it will only change the input devices' active status, output devices will |
| - // NOT be changed; similarly for the case if only output devices are passed. |
| - // If the devices specified in |new_active_ids| are already active, they will |
| - // remain active. Otherwise, the old active devices will be de-activated |
| - // before we activate the new devices with the same type(input/output). |
| - static void setActiveDevices(DOMString[] ids, |
| - SetActiveDevicesCallback callback); |
| + // Sets the active devices to the devices specified by |ids|. |
| + // It can pass in the "complete" active device id list of either input |
| + // devices, or output devices, or both. If only input device ids are passed |
| + // in, it will only change the input devices' active status, output devices |
| + // will NOT be changed; similarly for the case if only output devices are |
| + // passed. If the devices specified in |new_active_ids| are already active, |
| + // they will remain active. Otherwise, the old active devices will be |
| + // de-activated before we activate the new devices with the same |
| + // type(input/output). |
| + static void setActiveDevices(DOMString[] ids, EmptyCallback callback); |
| // Sets the properties for the input or output device. |
| static void setProperties(DOMString id, |
| DeviceProperties properties, |
| - SetPropertiesCallback callback); |
| - }; |
| + EmptyCallback callback); |
| + |
| + // Gets system-wide mute state for the specified stream type. |
| + // |streamType|: Stream type for which mute state should be fetched. |
| + // |callback|: Callback reporting whether mute is set or not for specified |
| + // stream type. |
| + static void getMute(StreamType streamType, GetMuteCallback callback); |
| + |
| + // Sets mute state for a stream type. The mute state will apply to all audio |
| + // devices with the specified audio stream type. |
| + // |streamType|: Stream type for which mute status should be set. |
| + // |value|: New mute value. |
| + static void setMute(StreamType streamType, |
| + boolean value, |
| + EmptyCallback callback); |
| + }; |
| interface Events { |
| // Fired when anything changes to the audio device configuration. |
| @@ -103,8 +134,14 @@ namespace audio { |
| static void OnLevelChanged(DOMString id, long level); |
| // Fired when the mute state of the audio input or output changes. |
| + // Note that mute state is system-wide and the new value applies to every |
| + // audio device with specified stream type. |
| + static void onMuteStateChanged(MuteStateChangedEvent event); |
| + |
| + // Fired when the mute state of the audio input or output changes. |
| // |isInput|: true indicating audio input; false indicating audio output. |
| // |isMuted|: new value of mute state. |
| + [deprecated="Use $(ref:onMuteStateChanged)."] |
|
tbarzic
2016/12/22 01:29:56
Do you know if this one is used at all - it doesn'
jennyz
2017/01/10 00:47:53
Better ask mnilsson.
|
| static void OnMuteChanged(boolean isInput, boolean isMuted); |
| // Fired when audio devices change, either new devices being added, or |