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 #ifndef CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ | 5 #ifndef CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ |
6 #define CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ | 6 #define CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <queue> | 10 #include <queue> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "chromeos/audio/audio_device.h" | 17 #include "chromeos/audio/audio_device.h" |
18 #include "chromeos/audio/audio_devices_pref_handler.h" | 18 #include "chromeos/audio/audio_devices_pref_handler.h" |
19 #include "chromeos/audio/audio_pref_observer.h" | 19 #include "chromeos/audio/audio_pref_observer.h" |
20 #include "chromeos/dbus/audio_node.h" | 20 #include "chromeos/dbus/audio_node.h" |
21 #include "chromeos/dbus/cras_audio_client.h" | 21 #include "chromeos/dbus/cras_audio_client.h" |
22 #include "chromeos/dbus/session_manager_client.h" | 22 #include "chromeos/dbus/session_manager_client.h" |
23 #include "chromeos/dbus/volume_state.h" | 23 #include "chromeos/dbus/volume_state.h" |
24 | 24 |
25 namespace chromeos { | 25 namespace chromeos { |
26 | 26 |
27 class AudioDevicesPrefHandler; | 27 class AudioDevicesPrefHandler; |
28 | 28 |
29 enum class VideoFacingMode { | |
30 NONE = 0, | |
31 // Video device is facing the user. I.e. front camera. | |
32 USER, | |
33 // Video device is facing the environment. I.e. back camera. | |
34 ENVIRONMENT | |
35 }; | |
jennyz
2017/01/26 00:26:11
Why do we need this enum here? Isn't it defined in
shenghao
2017/01/29 10:21:01
We can't include //media/base/video_facing.h due t
| |
36 | |
37 class VideoCaptureObserver { | |
38 public: | |
39 virtual void OnVideoCaptureStarted(VideoFacingMode facing) = 0; | |
40 virtual void OnVideoCaptureStopped(VideoFacingMode facing) = 0; | |
41 }; | |
42 | |
29 class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer, | 43 class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer, |
30 public AudioPrefObserver, | 44 public AudioPrefObserver, |
31 public SessionManagerClient::Observer { | 45 public SessionManagerClient::Observer, |
46 public VideoCaptureObserver { | |
jennyz
2017/01/26 00:26:12
Need to "#include media/base/video_facing.h".
shenghao
2017/01/29 10:21:01
We can't include //media/base/video_facing.h due t
| |
32 public: | 47 public: |
33 typedef std::priority_queue<AudioDevice, | 48 typedef std:: |
34 std::vector<AudioDevice>, | 49 priority_queue<AudioDevice, std::vector<AudioDevice>, AudioDeviceCompare> |
35 AudioDeviceCompare> AudioDevicePriorityQueue; | 50 AudioDevicePriorityQueue; |
jennyz
2017/01/26 00:26:12
Why change this line?
shenghao
2017/01/29 10:21:01
This is changed by "git cl format"
| |
36 typedef std::vector<uint64_t> NodeIdList; | 51 typedef std::vector<uint64_t> NodeIdList; |
37 | 52 |
38 // Volume change reasons that are not user-initiated. | 53 // Volume change reasons that are not user-initiated. |
39 enum AutomatedVolumeChangeReason { | 54 enum AutomatedVolumeChangeReason { |
40 // Indicates it is from initializing audio state. | 55 // Indicates it is from initializing audio state. |
41 VOLUME_CHANGE_INITIALIZING_AUDIO_STATE, | 56 VOLUME_CHANGE_INITIALIZING_AUDIO_STATE, |
42 | 57 |
43 // Indicates it is from restoring volume in maximimize mode screenshot. | 58 // Indicates it is from restoring volume in maximimize mode screenshot. |
44 VOLUME_CHANGE_MAXIMIZE_MODE_SCREENSHOT, | 59 VOLUME_CHANGE_MAXIMIZE_MODE_SCREENSHOT, |
45 }; | 60 }; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 | 111 |
97 // Destroys the global instance. | 112 // Destroys the global instance. |
98 static void Shutdown(); | 113 static void Shutdown(); |
99 | 114 |
100 // Returns true if the global instance is initialized. | 115 // Returns true if the global instance is initialized. |
101 static bool IsInitialized(); | 116 static bool IsInitialized(); |
102 | 117 |
103 // Gets the global instance. Initialize must be called first. | 118 // Gets the global instance. Initialize must be called first. |
104 static CrasAudioHandler* Get(); | 119 static CrasAudioHandler* Get(); |
105 | 120 |
121 void OnVideoCaptureStarted(VideoFacingMode facing) override; | |
jennyz
2017/01/26 00:26:12
Add a line above like:
// media::VideoCaptureObser
shenghao
2017/01/29 10:21:01
It doesn't override media::VideoCaptureObserver. I
| |
122 void OnVideoCaptureStopped(VideoFacingMode facing) override; | |
123 | |
106 // Adds an audio observer. | 124 // Adds an audio observer. |
107 void AddAudioObserver(AudioObserver* observer); | 125 void AddAudioObserver(AudioObserver* observer); |
108 | 126 |
109 // Removes an audio observer. | 127 // Removes an audio observer. |
110 void RemoveAudioObserver(AudioObserver* observer); | 128 void RemoveAudioObserver(AudioObserver* observer); |
111 | 129 |
112 // Returns true if keyboard mic exists. | 130 // Returns true if keyboard mic exists. |
113 bool HasKeyboardMic(); | 131 bool HasKeyboardMic(); |
114 | 132 |
115 // Returns true if audio output is muted for the system. | 133 // Returns true if audio output is muted for the system. |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 uint64_t init_node_id_; | 496 uint64_t init_node_id_; |
479 | 497 |
480 base::WeakPtrFactory<CrasAudioHandler> weak_ptr_factory_; | 498 base::WeakPtrFactory<CrasAudioHandler> weak_ptr_factory_; |
481 | 499 |
482 DISALLOW_COPY_AND_ASSIGN(CrasAudioHandler); | 500 DISALLOW_COPY_AND_ASSIGN(CrasAudioHandler); |
483 }; | 501 }; |
484 | 502 |
485 } // namespace chromeos | 503 } // namespace chromeos |
486 | 504 |
487 #endif // CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ | 505 #endif // CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ |
OLD | NEW |