| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 AudioDevice::AudioDevice(const AudioNode& node) { | 117 AudioDevice::AudioDevice(const AudioNode& node) { |
| 118 is_input = node.is_input; | 118 is_input = node.is_input; |
| 119 id = node.id; | 119 id = node.id; |
| 120 type = GetAudioType(node.type); | 120 type = GetAudioType(node.type); |
| 121 if (!node.name.empty() && node.name != "(default)") | 121 if (!node.name.empty() && node.name != "(default)") |
| 122 display_name = node.name; | 122 display_name = node.name; |
| 123 else | 123 else |
| 124 display_name = node.device_name; | 124 display_name = node.device_name; |
| 125 device_name = node.device_name; | 125 device_name = node.device_name; |
| 126 mic_positions = node.mic_positions; |
| 126 priority = GetDevicePriority(type, node.is_input); | 127 priority = GetDevicePriority(type, node.is_input); |
| 127 active = node.active; | 128 active = node.active; |
| 128 plugged_time = node.plugged_time; | 129 plugged_time = node.plugged_time; |
| 129 } | 130 } |
| 130 | 131 |
| 131 std::string AudioDevice::ToString() const { | 132 std::string AudioDevice::ToString() const { |
| 132 std::string result; | 133 std::string result; |
| 133 base::StringAppendF(&result, | 134 base::StringAppendF(&result, |
| 134 "is_input = %s ", | 135 "is_input = %s ", |
| 135 is_input ? "true" : "false"); | 136 is_input ? "true" : "false"); |
| 136 base::StringAppendF(&result, | 137 base::StringAppendF(&result, |
| 137 "id = 0x%" PRIx64 " ", | 138 "id = 0x%" PRIx64 " ", |
| 138 id); | 139 id); |
| 139 base::StringAppendF(&result, | 140 base::StringAppendF(&result, |
| 140 "display_name = %s ", | 141 "display_name = %s ", |
| 141 display_name.c_str()); | 142 display_name.c_str()); |
| 142 base::StringAppendF(&result, | 143 base::StringAppendF(&result, |
| 143 "device_name = %s ", | 144 "device_name = %s ", |
| 144 device_name.c_str()); | 145 device_name.c_str()); |
| 145 base::StringAppendF(&result, | 146 base::StringAppendF(&result, |
| 146 "type = %s ", | 147 "type = %s ", |
| 147 GetTypeString(type).c_str()); | 148 GetTypeString(type).c_str()); |
| 148 base::StringAppendF(&result, | 149 base::StringAppendF(&result, |
| 149 "active = %s ", | 150 "active = %s ", |
| 150 active ? "true" : "false"); | 151 active ? "true" : "false"); |
| 151 base::StringAppendF(&result, | 152 base::StringAppendF(&result, |
| 152 "plugged_time= %s ", | 153 "plugged_time= %s ", |
| 153 base::Uint64ToString(plugged_time).c_str()); | 154 base::Uint64ToString(plugged_time).c_str()); |
| 155 base::StringAppendF(&result, "mic_positions = %s ", mic_positions.c_str()); |
| 154 | 156 |
| 155 return result; | 157 return result; |
| 156 } | 158 } |
| 157 | 159 |
| 158 } // namespace chromeos | 160 } // namespace chromeos |
| OLD | NEW |