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

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

Issue 1186293003: Implement HasInputDevices in CrasAudioManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address the comments and add unittest Created 5 years, 6 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
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 #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 23 matching lines...) Expand all
34 struct CHROMEOS_EXPORT AudioDevice { 34 struct CHROMEOS_EXPORT AudioDevice {
35 AudioDevice(); 35 AudioDevice();
36 explicit AudioDevice(const AudioNode& node); 36 explicit AudioDevice(const AudioNode& node);
37 std::string ToString() const; 37 std::string ToString() const;
38 38
39 // Converts between the string type sent via D-Bus and AudioDeviceType. 39 // Converts between the string type sent via D-Bus and AudioDeviceType.
40 // Static so they can be used by tests. 40 // Static so they can be used by tests.
41 static std::string GetTypeString(chromeos::AudioDeviceType type); 41 static std::string GetTypeString(chromeos::AudioDeviceType type);
42 static chromeos::AudioDeviceType GetAudioType(const std::string& node_type); 42 static chromeos::AudioDeviceType GetAudioType(const std::string& node_type);
43 43
44 // Indicates that an input or output audio device is for simple usage like
45 // playback or recording for user. In contrast, audio device such as
46 // loopback, always on keyword recognition (AOKR), and keyboard mic are
47 // not for simple usage.
48 inline bool IsForSimpleUsage() {
Daniel Erat 2015/06/23 14:15:49 you don't need 'inline' here, and you should use l
cychiang 2015/06/24 08:11:29 Done.
49 return (type == AUDIO_TYPE_HEADPHONE ||
50 type == AUDIO_TYPE_INTERNAL_MIC ||
51 type == AUDIO_TYPE_MIC ||
52 type == AUDIO_TYPE_USB ||
53 type == AUDIO_TYPE_BLUETOOTH ||
54 type == AUDIO_TYPE_HDMI ||
55 type == AUDIO_TYPE_INTERNAL_SPEAKER);
56 }
57
44 bool is_input; 58 bool is_input;
45 uint64 id; 59 uint64 id;
46 std::string display_name; 60 std::string display_name;
47 std::string device_name; 61 std::string device_name;
48 AudioDeviceType type; 62 AudioDeviceType type;
49 uint8 priority; 63 uint8 priority;
50 bool active; 64 bool active;
51 uint64 plugged_time; 65 uint64 plugged_time;
52 }; 66 };
53 67
(...skipping 17 matching lines...) Expand all
71 return true; 85 return true;
72 } else { 86 } else {
73 return false; 87 return false;
74 } 88 }
75 } 89 }
76 }; 90 };
77 91
78 } // namespace chromeos 92 } // namespace chromeos
79 93
80 #endif // CHROMEOS_AUDIO_AUDIO_DEVICE_H_ 94 #endif // CHROMEOS_AUDIO_AUDIO_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698