xref: /aosp_15_r20/external/webrtc/modules/audio_device/audio_device_name.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef MODULES_AUDIO_DEVICE_AUDIO_DEVICE_NAME_H_
12 #define MODULES_AUDIO_DEVICE_AUDIO_DEVICE_NAME_H_
13 
14 #include <deque>
15 #include <string>
16 
17 #include "absl/strings/string_view.h"
18 
19 namespace webrtc {
20 
21 struct AudioDeviceName {
22   // Represents a default device. Note that, on Windows there are two different
23   // types of default devices (Default and Default Communication). They can
24   // either be two different physical devices or be two different roles for one
25   // single device. Hence, this id must be combined with a "role parameter" on
26   // Windows to uniquely identify a default device.
27   static const char kDefaultDeviceId[];
28 
29   AudioDeviceName() = default;
30   AudioDeviceName(absl::string_view device_name, absl::string_view unique_id);
31 
32   ~AudioDeviceName() = default;
33 
34   // Support copy and move.
35   AudioDeviceName(const AudioDeviceName& other) = default;
36   AudioDeviceName(AudioDeviceName&&) = default;
37   AudioDeviceName& operator=(const AudioDeviceName&) = default;
38   AudioDeviceName& operator=(AudioDeviceName&&) = default;
39 
40   bool IsValid();
41 
42   std::string device_name;  // Friendly name of the device.
43   std::string unique_id;    // Unique identifier for the device.
44 };
45 
46 typedef std::deque<AudioDeviceName> AudioDeviceNames;
47 
48 }  // namespace webrtc
49 
50 #endif  // MODULES_AUDIO_DEVICE_AUDIO_DEVICE_NAME_H_
51