OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_AUDIO_AUDIO_DEVICE_H_ | 5 #ifndef CHROMEOS_AUDIO_AUDIO_DEVICE_H_ |
6 #define CHROMEOS_AUDIO_AUDIO_DEVICE_H_ | 6 #define CHROMEOS_AUDIO_AUDIO_DEVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 bool is_input; | 58 bool is_input; |
59 uint64 id; | 59 uint64 id; |
60 std::string display_name; | 60 std::string display_name; |
61 std::string device_name; | 61 std::string device_name; |
62 AudioDeviceType type; | 62 AudioDeviceType type; |
63 uint8 priority; | 63 uint8 priority; |
64 bool active; | 64 bool active; |
65 uint64 plugged_time; | 65 uint64 plugged_time; |
| 66 std::string mic_positions; |
66 }; | 67 }; |
67 | 68 |
68 typedef std::vector<AudioDevice> AudioDeviceList; | 69 typedef std::vector<AudioDevice> AudioDeviceList; |
69 typedef std::map<uint64, AudioDevice> AudioDeviceMap; | 70 typedef std::map<uint64, AudioDevice> AudioDeviceMap; |
70 | 71 |
71 struct AudioDeviceCompare { | 72 struct AudioDeviceCompare { |
72 // Rules used to discern which device is higher, | 73 // Rules used to discern which device is higher, |
73 // 1.) Device Type: | 74 // 1.) Device Type: |
74 // [Headphones/USB/Bluetooh > HDMI > Internal Speakers] | 75 // [Headphones/USB/Bluetooh > HDMI > Internal Speakers] |
75 // [External Mic/USB Mic/Bluetooth > Internal Mic] | 76 // [External Mic/USB Mic/Bluetooth > Internal Mic] |
76 // 2.) Device Plugged in Time: | 77 // 2.) Device Plugged in Time: |
77 // [Later > Earlier] | 78 // [Later > Earlier] |
78 bool operator()(const chromeos::AudioDevice& a, | 79 bool operator()(const chromeos::AudioDevice& a, |
79 const chromeos::AudioDevice& b) const { | 80 const chromeos::AudioDevice& b) const { |
80 if (a.priority < b.priority) { | 81 if (a.priority < b.priority) { |
81 return true; | 82 return true; |
82 } else if (b.priority < a.priority) { | 83 } else if (b.priority < a.priority) { |
83 return false; | 84 return false; |
84 } else if (a.plugged_time < b.plugged_time) { | 85 } else if (a.plugged_time < b.plugged_time) { |
85 return true; | 86 return true; |
86 } else { | 87 } else { |
87 return false; | 88 return false; |
88 } | 89 } |
89 } | 90 } |
90 }; | 91 }; |
91 | 92 |
92 } // namespace chromeos | 93 } // namespace chromeos |
93 | 94 |
94 #endif // CHROMEOS_AUDIO_AUDIO_DEVICE_H_ | 95 #endif // CHROMEOS_AUDIO_AUDIO_DEVICE_H_ |
OLD | NEW |