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 #ifndef MOZILLA_AudioDeviceInfo_H
7 #define MOZILLA_AudioDeviceInfo_H
9 #include "nsIAudioDeviceInfo.h"
10 #include "CubebUtils.h"
11 #include "mozilla/Maybe.h"
13 // This is mapped to the cubeb_device_info.
14 class AudioDeviceInfo final
: public nsIAudioDeviceInfo
{
16 NS_DECL_THREADSAFE_ISUPPORTS
17 NS_DECL_NSIAUDIODEVICEINFO
19 using AudioDeviceID
= mozilla::CubebUtils::AudioDeviceID
;
21 AudioDeviceInfo(const AudioDeviceID aID
, const nsAString
& aName
,
22 const nsAString
& aGroupId
, const nsAString
& aVendor
,
23 uint16_t aType
, uint16_t aState
, uint16_t aPreferred
,
24 uint16_t aSupportedFormat
, uint16_t aDefaultFormat
,
25 uint32_t aMaxChannels
, uint32_t aDefaultRate
,
26 uint32_t aMaxRate
, uint32_t aMinRate
, uint32_t aMaxLatency
,
27 uint32_t aMinLatency
);
28 explicit AudioDeviceInfo(cubeb_device_info
* aInfo
);
30 AudioDeviceID
DeviceID() const;
31 const nsString
& Name() const;
32 uint32_t DefaultRate() const { return mDefaultRate
; }
33 uint32_t MaxChannels() const;
34 uint32_t Type() const;
35 uint32_t State() const;
36 const nsString
& GroupID() const;
37 bool Preferred() const;
40 virtual ~AudioDeviceInfo() = default;
42 const AudioDeviceID mDeviceId
;
44 const nsString mGroupId
;
45 const nsString mVendor
;
47 const uint16_t mState
;
48 const uint16_t mPreferred
;
49 const uint16_t mSupportedFormat
;
50 const uint16_t mDefaultFormat
;
51 const uint32_t mMaxChannels
;
52 const uint32_t mDefaultRate
;
53 const uint32_t mMaxRate
;
54 const uint32_t mMinRate
;
55 const uint32_t mMaxLatency
;
56 const uint32_t mMinLatency
;
59 #endif // MOZILLA_AudioDeviceInfo_H