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

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

Issue 515573003: app_shell: Do simple audio initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wrap line Created 6 years, 3 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 | « no previous file | chromeos/audio/audio_device.cc » ('j') | 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 #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 11 matching lines...) Expand all
22 AUDIO_TYPE_USB, 22 AUDIO_TYPE_USB,
23 AUDIO_TYPE_BLUETOOTH, 23 AUDIO_TYPE_BLUETOOTH,
24 AUDIO_TYPE_HDMI, 24 AUDIO_TYPE_HDMI,
25 AUDIO_TYPE_INTERNAL_SPEAKER, 25 AUDIO_TYPE_INTERNAL_SPEAKER,
26 AUDIO_TYPE_INTERNAL_MIC, 26 AUDIO_TYPE_INTERNAL_MIC,
27 AUDIO_TYPE_KEYBOARD_MIC, 27 AUDIO_TYPE_KEYBOARD_MIC,
28 AUDIO_TYPE_OTHER, 28 AUDIO_TYPE_OTHER,
29 }; 29 };
30 30
31 struct CHROMEOS_EXPORT AudioDevice { 31 struct CHROMEOS_EXPORT AudioDevice {
32 AudioDevice();
33 explicit AudioDevice(const AudioNode& node);
34 std::string ToString() const;
35
36 // Converts between the string type sent via D-Bus and AudioDeviceType.
37 // Static so they can be used by tests.
38 static std::string GetTypeString(chromeos::AudioDeviceType type);
39 static chromeos::AudioDeviceType GetAudioType(const std::string& node_type);
40
32 bool is_input; 41 bool is_input;
33 uint64 id; 42 uint64 id;
34 std::string display_name; 43 std::string display_name;
35 std::string device_name; 44 std::string device_name;
36 AudioDeviceType type; 45 AudioDeviceType type;
37 uint8 priority; 46 uint8 priority;
38 bool active; 47 bool active;
39 uint64 plugged_time; 48 uint64 plugged_time;
40
41 AudioDevice();
42 explicit AudioDevice(const AudioNode& node);
43 std::string ToString() const;
44 }; 49 };
45 50
46 typedef std::vector<AudioDevice> AudioDeviceList; 51 typedef std::vector<AudioDevice> AudioDeviceList;
47 typedef std::map<uint64, AudioDevice> AudioDeviceMap; 52 typedef std::map<uint64, AudioDevice> AudioDeviceMap;
48 53
49 struct AudioDeviceCompare { 54 struct AudioDeviceCompare {
50 // Rules used to discern which device is higher, 55 // Rules used to discern which device is higher,
51 // 1.) Device Type: 56 // 1.) Device Type:
52 // [Headphones/USB/Bluetooh > HDMI > Internal Speakers] 57 // [Headphones/USB/Bluetooh > HDMI > Internal Speakers]
53 // [External Mic/USB Mic/Bluetooth > Internal Mic] 58 // [External Mic/USB Mic/Bluetooth > Internal Mic]
54 // 2.) Device Plugged in Time: 59 // 2.) Device Plugged in Time:
55 // [Later > Earlier] 60 // [Later > Earlier]
56 bool operator()(const chromeos::AudioDevice& a, 61 bool operator()(const chromeos::AudioDevice& a,
57 const chromeos::AudioDevice& b) const { 62 const chromeos::AudioDevice& b) const {
58 if (a.priority < b.priority) { 63 if (a.priority < b.priority) {
59 return true; 64 return true;
60 } else if (b.priority < a.priority) { 65 } else if (b.priority < a.priority) {
61 return false; 66 return false;
62 } else if (a.plugged_time < b.plugged_time) { 67 } else if (a.plugged_time < b.plugged_time) {
63 return true; 68 return true;
64 } else { 69 } else {
65 return false; 70 return false;
66 } 71 }
67 } 72 }
68 }; 73 };
69 74
70 } // namespace chromeos 75 } // namespace chromeos
71 76
72 #endif // CHROMEOS_AUDIO_AUDIO_DEVICE_H_ 77 #endif // CHROMEOS_AUDIO_AUDIO_DEVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chromeos/audio/audio_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698