OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 // Creates the input stream for the |AUDIO_PCM_LINEAR| format. The legacy | 77 // Creates the input stream for the |AUDIO_PCM_LINEAR| format. The legacy |
78 // name is also from |AUDIO_PCM_LINEAR|. | 78 // name is also from |AUDIO_PCM_LINEAR|. |
79 virtual AudioInputStream* MakeLinearInputStream( | 79 virtual AudioInputStream* MakeLinearInputStream( |
80 const AudioParameters& params, const std::string& device_id) = 0; | 80 const AudioParameters& params, const std::string& device_id) = 0; |
81 | 81 |
82 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. | 82 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. |
83 virtual AudioInputStream* MakeLowLatencyInputStream( | 83 virtual AudioInputStream* MakeLowLatencyInputStream( |
84 const AudioParameters& params, const std::string& device_id) = 0; | 84 const AudioParameters& params, const std::string& device_id) = 0; |
85 | 85 |
86 // Returns the preferred hardware audio output parameters for opening output | 86 // Returns the preferred hardware audio output parameters for opening output |
87 // streams in the |AUDIO_PCM_LOW_LATENCY| format. | 87 // streams. If the users inject a valid |input_params|, each AudioManager |
88 // TODO(dalecurtis): Retrieve the |channel_layout| value from hardware instead | 88 // will decide if they should return the values from |input_params| or the |
89 // of accepting the value. | 89 // default hardware values. If the |input_params| is invalid, it will return |
90 // TODO(dalecurtis): Each AudioManager should implement their own version, see | 90 // the default hardware audio parameters. |
91 // http://crbug.com/137326 | 91 virtual AudioParameters GetPreferredOutputStreamParameters( |
DaleCurtis
2013/03/05 01:40:53
Move to protected? Ditto for implementations.
no longer working on chromium
2013/03/05 10:09:35
Done.
| |
92 virtual AudioParameters GetPreferredLowLatencyOutputStreamParameters( | 92 const AudioParameters& input_params) = 0; |
93 const AudioParameters& input_params); | |
94 | 93 |
95 // Listeners will be notified on the AudioManager::GetMessageLoop() loop. | 94 // Listeners will be notified on the AudioManager::GetMessageLoop() loop. |
96 virtual void AddOutputDeviceChangeListener( | 95 virtual void AddOutputDeviceChangeListener( |
97 AudioDeviceListener* listener) OVERRIDE; | 96 AudioDeviceListener* listener) OVERRIDE; |
98 virtual void RemoveOutputDeviceChangeListener( | 97 virtual void RemoveOutputDeviceChangeListener( |
99 AudioDeviceListener* listener) OVERRIDE; | 98 AudioDeviceListener* listener) OVERRIDE; |
100 | 99 |
100 virtual AudioParameters GetDefaultOutputStreamParameters() OVERRIDE; | |
101 virtual AudioParameters GetInputStreamParameters( | |
102 const std::string& device_id) OVERRIDE; | |
103 | |
101 protected: | 104 protected: |
102 AudioManagerBase(); | 105 AudioManagerBase(); |
103 | 106 |
104 // TODO(dalecurtis): This must change to map both input and output parameters | 107 // TODO(dalecurtis): This must change to map both input and output parameters |
105 // to a single dispatcher, otherwise on a device state change we'll just get | 108 // to a single dispatcher, otherwise on a device state change we'll just get |
106 // the exact same invalid dispatcher. | 109 // the exact same invalid dispatcher. |
107 typedef std::map<std::pair<AudioParameters, AudioParameters>, | 110 typedef std::map<std::pair<AudioParameters, AudioParameters>, |
108 scoped_refptr<AudioOutputDispatcher> > | 111 scoped_refptr<AudioOutputDispatcher> > |
109 AudioOutputDispatchersMap; | 112 AudioOutputDispatchersMap; |
110 | 113 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 // tasks which run on the audio thread even after Shutdown() has been started | 160 // tasks which run on the audio thread even after Shutdown() has been started |
158 // and GetMessageLoop() starts returning NULL. | 161 // and GetMessageLoop() starts returning NULL. |
159 scoped_refptr<base::MessageLoopProxy> message_loop_; | 162 scoped_refptr<base::MessageLoopProxy> message_loop_; |
160 | 163 |
161 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 164 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
162 }; | 165 }; |
163 | 166 |
164 } // namespace media | 167 } // namespace media |
165 | 168 |
166 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 169 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
OLD | NEW |