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 #include "chromeos/audio/audio_device.h" | 5 #include "chromeos/audio/audio_device.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 case AUDIO_TYPE_MIC: | 21 case AUDIO_TYPE_MIC: |
22 case AUDIO_TYPE_USB: | 22 case AUDIO_TYPE_USB: |
23 case AUDIO_TYPE_BLUETOOTH: | 23 case AUDIO_TYPE_BLUETOOTH: |
24 return 3; | 24 return 3; |
25 case AUDIO_TYPE_HDMI: | 25 case AUDIO_TYPE_HDMI: |
26 return 2; | 26 return 2; |
27 case AUDIO_TYPE_INTERNAL_SPEAKER: | 27 case AUDIO_TYPE_INTERNAL_SPEAKER: |
28 case AUDIO_TYPE_INTERNAL_MIC: | 28 case AUDIO_TYPE_INTERNAL_MIC: |
29 return 1; | 29 return 1; |
30 case AUDIO_TYPE_KEYBOARD_MIC: | 30 case AUDIO_TYPE_KEYBOARD_MIC: |
| 31 case AUDIO_TYPE_AOKR: |
31 case AUDIO_TYPE_OTHER: | 32 case AUDIO_TYPE_OTHER: |
32 default: | 33 default: |
33 return 0; | 34 return 0; |
34 } | 35 } |
35 } | 36 } |
36 | 37 |
37 } // namespace | 38 } // namespace |
38 | 39 |
39 // static | 40 // static |
40 std::string AudioDevice::GetTypeString(AudioDeviceType type) { | 41 std::string AudioDevice::GetTypeString(AudioDeviceType type) { |
41 switch (type) { | 42 switch (type) { |
42 case AUDIO_TYPE_HEADPHONE: | 43 case AUDIO_TYPE_HEADPHONE: |
43 return "HEADPHONE"; | 44 return "HEADPHONE"; |
44 case AUDIO_TYPE_MIC: | 45 case AUDIO_TYPE_MIC: |
45 return "MIC"; | 46 return "MIC"; |
46 case AUDIO_TYPE_USB: | 47 case AUDIO_TYPE_USB: |
47 return "USB"; | 48 return "USB"; |
48 case AUDIO_TYPE_BLUETOOTH: | 49 case AUDIO_TYPE_BLUETOOTH: |
49 return "BLUETOOTH"; | 50 return "BLUETOOTH"; |
50 case AUDIO_TYPE_HDMI: | 51 case AUDIO_TYPE_HDMI: |
51 return "HDMI"; | 52 return "HDMI"; |
52 case AUDIO_TYPE_INTERNAL_SPEAKER: | 53 case AUDIO_TYPE_INTERNAL_SPEAKER: |
53 return "INTERNAL_SPEAKER"; | 54 return "INTERNAL_SPEAKER"; |
54 case AUDIO_TYPE_INTERNAL_MIC: | 55 case AUDIO_TYPE_INTERNAL_MIC: |
55 return "INTERNAL_MIC"; | 56 return "INTERNAL_MIC"; |
56 case AUDIO_TYPE_KEYBOARD_MIC: | 57 case AUDIO_TYPE_KEYBOARD_MIC: |
57 return "KEYBOARD_MIC"; | 58 return "KEYBOARD_MIC"; |
| 59 case AUDIO_TYPE_AOKR: |
| 60 return "AOKR"; |
58 case AUDIO_TYPE_OTHER: | 61 case AUDIO_TYPE_OTHER: |
59 default: | 62 default: |
60 return "OTHER"; | 63 return "OTHER"; |
61 } | 64 } |
62 } | 65 } |
63 | 66 |
64 // static | 67 // static |
65 AudioDeviceType AudioDevice::GetAudioType( | 68 AudioDeviceType AudioDevice::GetAudioType( |
66 const std::string& node_type) { | 69 const std::string& node_type) { |
67 if (node_type.find("HEADPHONE") != std::string::npos) | 70 if (node_type.find("HEADPHONE") != std::string::npos) |
68 return AUDIO_TYPE_HEADPHONE; | 71 return AUDIO_TYPE_HEADPHONE; |
69 else if (node_type.find("INTERNAL_MIC") != std::string::npos) | 72 else if (node_type.find("INTERNAL_MIC") != std::string::npos) |
70 return AUDIO_TYPE_INTERNAL_MIC; | 73 return AUDIO_TYPE_INTERNAL_MIC; |
71 else if (node_type.find("KEYBOARD_MIC") != std::string::npos) | 74 else if (node_type.find("KEYBOARD_MIC") != std::string::npos) |
72 return AUDIO_TYPE_KEYBOARD_MIC; | 75 return AUDIO_TYPE_KEYBOARD_MIC; |
73 else if (node_type.find("MIC") != std::string::npos) | 76 else if (node_type.find("MIC") != std::string::npos) |
74 return AUDIO_TYPE_MIC; | 77 return AUDIO_TYPE_MIC; |
75 else if (node_type.find("USB") != std::string::npos) | 78 else if (node_type.find("USB") != std::string::npos) |
76 return AUDIO_TYPE_USB; | 79 return AUDIO_TYPE_USB; |
77 else if (node_type.find("BLUETOOTH") != std::string::npos) | 80 else if (node_type.find("BLUETOOTH") != std::string::npos) |
78 return AUDIO_TYPE_BLUETOOTH; | 81 return AUDIO_TYPE_BLUETOOTH; |
79 else if (node_type.find("HDMI") != std::string::npos) | 82 else if (node_type.find("HDMI") != std::string::npos) |
80 return AUDIO_TYPE_HDMI; | 83 return AUDIO_TYPE_HDMI; |
81 else if (node_type.find("INTERNAL_SPEAKER") != std::string::npos) | 84 else if (node_type.find("INTERNAL_SPEAKER") != std::string::npos) |
82 return AUDIO_TYPE_INTERNAL_SPEAKER; | 85 return AUDIO_TYPE_INTERNAL_SPEAKER; |
| 86 else if (node_type.find("AOKR") != std::string::npos) |
| 87 return AUDIO_TYPE_AOKR; |
83 else | 88 else |
84 return AUDIO_TYPE_OTHER; | 89 return AUDIO_TYPE_OTHER; |
85 } | 90 } |
86 | 91 |
87 AudioDevice::AudioDevice() | 92 AudioDevice::AudioDevice() |
88 : is_input(false), | 93 : is_input(false), |
89 id(0), | 94 id(0), |
90 display_name(""), | 95 display_name(""), |
91 type(AUDIO_TYPE_OTHER), | 96 type(AUDIO_TYPE_OTHER), |
92 priority(0), | 97 priority(0), |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 "active = %s ", | 134 "active = %s ", |
130 active ? "true" : "false"); | 135 active ? "true" : "false"); |
131 base::StringAppendF(&result, | 136 base::StringAppendF(&result, |
132 "plugged_time= %s ", | 137 "plugged_time= %s ", |
133 base::Uint64ToString(plugged_time).c_str()); | 138 base::Uint64ToString(plugged_time).c_str()); |
134 | 139 |
135 return result; | 140 return result; |
136 } | 141 } |
137 | 142 |
138 } // namespace chromeos | 143 } // namespace chromeos |
OLD | NEW |