Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: chromeos/audio/audio_device.cc

Issue 1116643005: Do not display CRAS loopback devices on UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/audio/audio_device.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
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_AOKR:
32 case AUDIO_TYPE_POST_MIX_LOOPBACK:
33 case AUDIO_TYPE_POST_DSP_LOOPBACK:
32 case AUDIO_TYPE_OTHER: 34 case AUDIO_TYPE_OTHER:
33 default: 35 default:
34 return 0; 36 return 0;
35 } 37 }
36 } 38 }
37 39
38 } // namespace 40 } // namespace
39 41
40 // static 42 // static
41 std::string AudioDevice::GetTypeString(AudioDeviceType type) { 43 std::string AudioDevice::GetTypeString(AudioDeviceType type) {
42 switch (type) { 44 switch (type) {
43 case AUDIO_TYPE_HEADPHONE: 45 case AUDIO_TYPE_HEADPHONE:
44 return "HEADPHONE"; 46 return "HEADPHONE";
45 case AUDIO_TYPE_MIC: 47 case AUDIO_TYPE_MIC:
46 return "MIC"; 48 return "MIC";
47 case AUDIO_TYPE_USB: 49 case AUDIO_TYPE_USB:
48 return "USB"; 50 return "USB";
49 case AUDIO_TYPE_BLUETOOTH: 51 case AUDIO_TYPE_BLUETOOTH:
50 return "BLUETOOTH"; 52 return "BLUETOOTH";
51 case AUDIO_TYPE_HDMI: 53 case AUDIO_TYPE_HDMI:
52 return "HDMI"; 54 return "HDMI";
53 case AUDIO_TYPE_INTERNAL_SPEAKER: 55 case AUDIO_TYPE_INTERNAL_SPEAKER:
54 return "INTERNAL_SPEAKER"; 56 return "INTERNAL_SPEAKER";
55 case AUDIO_TYPE_INTERNAL_MIC: 57 case AUDIO_TYPE_INTERNAL_MIC:
56 return "INTERNAL_MIC"; 58 return "INTERNAL_MIC";
57 case AUDIO_TYPE_KEYBOARD_MIC: 59 case AUDIO_TYPE_KEYBOARD_MIC:
58 return "KEYBOARD_MIC"; 60 return "KEYBOARD_MIC";
59 case AUDIO_TYPE_AOKR: 61 case AUDIO_TYPE_AOKR:
60 return "AOKR"; 62 return "AOKR";
63 case AUDIO_TYPE_POST_MIX_LOOPBACK:
64 return "POST_MIX_LOOPBACK";
65 case AUDIO_TYPE_POST_DSP_LOOPBACK:
66 return "POST_DSP_LOOPBACK";
61 case AUDIO_TYPE_OTHER: 67 case AUDIO_TYPE_OTHER:
62 default: 68 default:
63 return "OTHER"; 69 return "OTHER";
64 } 70 }
65 } 71 }
66 72
67 // static 73 // static
68 AudioDeviceType AudioDevice::GetAudioType( 74 AudioDeviceType AudioDevice::GetAudioType(
69 const std::string& node_type) { 75 const std::string& node_type) {
70 if (node_type.find("HEADPHONE") != std::string::npos) 76 if (node_type.find("HEADPHONE") != std::string::npos)
71 return AUDIO_TYPE_HEADPHONE; 77 return AUDIO_TYPE_HEADPHONE;
72 else if (node_type.find("INTERNAL_MIC") != std::string::npos) 78 else if (node_type.find("INTERNAL_MIC") != std::string::npos)
73 return AUDIO_TYPE_INTERNAL_MIC; 79 return AUDIO_TYPE_INTERNAL_MIC;
74 else if (node_type.find("KEYBOARD_MIC") != std::string::npos) 80 else if (node_type.find("KEYBOARD_MIC") != std::string::npos)
75 return AUDIO_TYPE_KEYBOARD_MIC; 81 return AUDIO_TYPE_KEYBOARD_MIC;
76 else if (node_type.find("MIC") != std::string::npos) 82 else if (node_type.find("MIC") != std::string::npos)
77 return AUDIO_TYPE_MIC; 83 return AUDIO_TYPE_MIC;
78 else if (node_type.find("USB") != std::string::npos) 84 else if (node_type.find("USB") != std::string::npos)
79 return AUDIO_TYPE_USB; 85 return AUDIO_TYPE_USB;
80 else if (node_type.find("BLUETOOTH") != std::string::npos) 86 else if (node_type.find("BLUETOOTH") != std::string::npos)
81 return AUDIO_TYPE_BLUETOOTH; 87 return AUDIO_TYPE_BLUETOOTH;
82 else if (node_type.find("HDMI") != std::string::npos) 88 else if (node_type.find("HDMI") != std::string::npos)
83 return AUDIO_TYPE_HDMI; 89 return AUDIO_TYPE_HDMI;
84 else if (node_type.find("INTERNAL_SPEAKER") != std::string::npos) 90 else if (node_type.find("INTERNAL_SPEAKER") != std::string::npos)
85 return AUDIO_TYPE_INTERNAL_SPEAKER; 91 return AUDIO_TYPE_INTERNAL_SPEAKER;
86 else if (node_type.find("AOKR") != std::string::npos) 92 else if (node_type.find("AOKR") != std::string::npos)
87 return AUDIO_TYPE_AOKR; 93 return AUDIO_TYPE_AOKR;
94 else if (node_type.find("POST_MIX_LOOPBACK") != std::string::npos)
95 return AUDIO_TYPE_POST_MIX_LOOPBACK;
96 else if (node_type.find("POST_DSP_LOOPBACK") != std::string::npos)
97 return AUDIO_TYPE_POST_DSP_LOOPBACK;
88 else 98 else
89 return AUDIO_TYPE_OTHER; 99 return AUDIO_TYPE_OTHER;
90 } 100 }
91 101
92 AudioDevice::AudioDevice() 102 AudioDevice::AudioDevice()
93 : is_input(false), 103 : is_input(false),
94 id(0), 104 id(0),
95 display_name(""), 105 display_name(""),
96 type(AUDIO_TYPE_OTHER), 106 type(AUDIO_TYPE_OTHER),
97 priority(0), 107 priority(0),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 "active = %s ", 144 "active = %s ",
135 active ? "true" : "false"); 145 active ? "true" : "false");
136 base::StringAppendF(&result, 146 base::StringAppendF(&result,
137 "plugged_time= %s ", 147 "plugged_time= %s ",
138 base::Uint64ToString(plugged_time).c_str()); 148 base::Uint64ToString(plugged_time).c_str());
139 149
140 return result; 150 return result;
141 } 151 }
142 152
143 } // namespace chromeos 153 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/audio/audio_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698