Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: extensions/common/api/audio.idl

Issue 2578473002: chrome.audio API: treat mute as system wide property (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/common/api/audio.idl
diff --git a/extensions/common/api/audio.idl b/extensions/common/api/audio.idl
index 36a1124bd3b66b81339248e984c368cb6b9e5885..ac14fa4dae7d34cef1bc260d43e86beaee7711d3 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;
jennyz 2017/01/10 00:47:53 Changing the existing protocol might break the old
tbarzic 2017/01/11 00:47:03 this one should be backward compatible - it's only
// 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 MuteChangedEvent {
+ // 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 state 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.
jennyz 2017/01/10 00:47:53 No need to indent 4 spaces in the above line.
tbarzic 2017/01/11 00:47:03 Done.
+ 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,9 +134,9 @@ namespace audio {
static void OnLevelChanged(DOMString id, long level);
// 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.
- static void OnMuteChanged(boolean isInput, boolean isMuted);
+ // Note that mute state is system-wide and the new value applies to every
+ // audio device with specified stream type.
+ static void onMuteChanged(MuteChangedEvent event);
jennyz 2017/01/10 00:47:53 This changed the existing event's protocol. This m
tbarzic 2017/01/11 00:47:03 yes, that comes back to the question for which mni
// Fired when audio devices change, either new devices being added, or
// existing devices being removed.

Powered by Google App Engine
This is Rietveld 408576698