Bug 1449132 [wpt PR 10194] - [css-grid] Fix resolution of percentage paddings and...
[gecko.git] / dom / media / AudioDeviceInfo.cpp
blobd9cb577a1a590dab1ccff69aa752c5d139491da2
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "AudioDeviceInfo.h"
8 NS_IMPL_ISUPPORTS(AudioDeviceInfo, nsIAudioDeviceInfo)
10 AudioDeviceInfo::AudioDeviceInfo(const nsAString& aName,
11 const nsAString& aGroupId,
12 const nsAString& aVendor,
13 uint16_t aType,
14 uint16_t aState,
15 uint16_t aPreferred,
16 uint16_t aSupportedFormat,
17 uint16_t aDefaultFormat,
18 uint32_t aMaxChannels,
19 uint32_t aDefaultRate,
20 uint32_t aMaxRate,
21 uint32_t aMinRate,
22 uint32_t aMaxLatency,
23 uint32_t aMinLatency)
24 : mName(aName)
25 , mGroupId(aGroupId)
26 , mVendor(aVendor)
27 , mType(aType)
28 , mState(aState)
29 , mPreferred(aPreferred)
30 , mSupportedFormat(aSupportedFormat)
31 , mDefaultFormat(aDefaultFormat)
32 , mMaxChannels(aMaxChannels)
33 , mDefaultRate(aDefaultRate)
34 , mMaxRate(aMaxRate)
35 , mMinRate(aMinRate)
36 , mMaxLatency(aMaxLatency)
37 , mMinLatency(aMinLatency)
39 MOZ_ASSERT(mType == TYPE_UNKNOWN ||
40 mType == TYPE_INPUT ||
41 mType == TYPE_OUTPUT, "Wrong type");
42 MOZ_ASSERT(mState == STATE_DISABLED ||
43 mState == STATE_UNPLUGGED ||
44 mState == STATE_ENABLED, "Wrong state");
45 MOZ_ASSERT(mPreferred == PREF_NONE ||
46 mPreferred == PREF_ALL ||
47 mPreferred & (PREF_MULTIMEDIA | PREF_VOICE | PREF_NOTIFICATION),
48 "Wrong preferred value");
49 MOZ_ASSERT(mSupportedFormat & (FMT_S16LE | FMT_S16BE | FMT_F32LE | FMT_F32BE),
50 "Wrong supported format");
51 MOZ_ASSERT(mDefaultFormat == FMT_S16LE ||
52 mDefaultFormat == FMT_S16BE ||
53 mDefaultFormat == FMT_F32LE ||
54 mDefaultFormat == FMT_F32BE, "Wrong default format");
57 /* readonly attribute DOMString name; */
58 NS_IMETHODIMP
59 AudioDeviceInfo::GetName(nsAString& aName)
61 aName = mName;
62 return NS_OK;
65 /* readonly attribute DOMString groupId; */
66 NS_IMETHODIMP
67 AudioDeviceInfo::GetGroupId(nsAString& aGroupId)
69 aGroupId = mGroupId;
70 return NS_OK;
73 /* readonly attribute DOMString vendor; */
74 NS_IMETHODIMP
75 AudioDeviceInfo::GetVendor(nsAString& aVendor)
77 aVendor = mVendor;
78 return NS_OK;
81 /* readonly attribute unsigned short type; */
82 NS_IMETHODIMP
83 AudioDeviceInfo::GetType(uint16_t* aType)
85 *aType = mType;
86 return NS_OK;
89 /* readonly attribute unsigned short state; */
90 NS_IMETHODIMP
91 AudioDeviceInfo::GetState(uint16_t* aState)
93 *aState = mState;
94 return NS_OK;
97 /* readonly attribute unsigned short preferred; */
98 NS_IMETHODIMP
99 AudioDeviceInfo::GetPreferred(uint16_t* aPreferred)
101 *aPreferred = mPreferred;
102 return NS_OK;
105 /* readonly attribute unsigned short supportedFormat; */
106 NS_IMETHODIMP
107 AudioDeviceInfo::GetSupportedFormat(uint16_t* aSupportedFormat)
109 *aSupportedFormat = mSupportedFormat;
110 return NS_OK;
113 /* readonly attribute unsigned short defaultFormat; */
114 NS_IMETHODIMP
115 AudioDeviceInfo::GetDefaultFormat(uint16_t* aDefaultFormat)
117 *aDefaultFormat = mDefaultFormat;
118 return NS_OK;
121 /* readonly attribute unsigned long maxChannels; */
122 NS_IMETHODIMP
123 AudioDeviceInfo::GetMaxChannels(uint32_t* aMaxChannels)
125 *aMaxChannels = mMaxChannels;
126 return NS_OK;
129 /* readonly attribute unsigned long defaultRate; */
130 NS_IMETHODIMP
131 AudioDeviceInfo::GetDefaultRate(uint32_t* aDefaultRate)
133 *aDefaultRate = mDefaultRate;
134 return NS_OK;
137 /* readonly attribute unsigned long maxRate; */
138 NS_IMETHODIMP
139 AudioDeviceInfo::GetMaxRate(uint32_t* aMaxRate)
141 *aMaxRate = mMaxRate;
142 return NS_OK;
145 /* readonly attribute unsigned long minRate; */
146 NS_IMETHODIMP
147 AudioDeviceInfo::GetMinRate(uint32_t* aMinRate)
149 *aMinRate = mMinRate;
150 return NS_OK;
153 /* readonly attribute unsigned long maxLatency; */
154 NS_IMETHODIMP
155 AudioDeviceInfo::GetMaxLatency(uint32_t* aMaxLatency)
157 *aMaxLatency = mMaxLatency;
158 return NS_OK;
161 /* readonly attribute unsigned long minLatency; */
162 NS_IMETHODIMP
163 AudioDeviceInfo::GetMinLatency(uint32_t* aMinLatency)
165 *aMinLatency = mMinLatency;
166 return NS_OK;