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 <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 virtual AudioParameters GetInputStreamParameters( | 109 virtual AudioParameters GetInputStreamParameters( |
110 const std::string& device_id) OVERRIDE; | 110 const std::string& device_id) OVERRIDE; |
111 | 111 |
112 virtual std::string GetAssociatedOutputDeviceID( | 112 virtual std::string GetAssociatedOutputDeviceID( |
113 const std::string& input_device_id) OVERRIDE; | 113 const std::string& input_device_id) OVERRIDE; |
114 | 114 |
115 virtual scoped_ptr<AudioLog> CreateAudioLog( | 115 virtual scoped_ptr<AudioLog> CreateAudioLog( |
116 AudioLogFactory::AudioComponent component) OVERRIDE; | 116 AudioLogFactory::AudioComponent component) OVERRIDE; |
117 | 117 |
| 118 // Get number of input or output streams. |
| 119 int input_stream_count() const { return num_input_streams_; } |
| 120 int output_stream_count() const { return num_output_streams_; } |
| 121 |
118 protected: | 122 protected: |
119 AudioManagerBase(AudioLogFactory* audio_log_factory); | 123 AudioManagerBase(AudioLogFactory* audio_log_factory); |
120 | 124 |
121 // Shuts down the audio thread and releases all the audio output dispatchers | 125 // Shuts down the audio thread and releases all the audio output dispatchers |
122 // on the audio thread. All audio streams should be freed before Shutdown() | 126 // on the audio thread. All audio streams should be freed before Shutdown() |
123 // is called. This must be called in the destructor of every AudioManagerBase | 127 // is called. This must be called in the destructor of every AudioManagerBase |
124 // implementation. | 128 // implementation. |
125 void Shutdown(); | 129 void Shutdown(); |
126 | 130 |
127 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } | 131 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } |
(...skipping 15 matching lines...) Expand all Loading... |
143 // If |output_device_id| is empty, the implementation must treat that as | 147 // If |output_device_id| is empty, the implementation must treat that as |
144 // a request for the default output device. | 148 // a request for the default output device. |
145 virtual AudioParameters GetPreferredOutputStreamParameters( | 149 virtual AudioParameters GetPreferredOutputStreamParameters( |
146 const std::string& output_device_id, | 150 const std::string& output_device_id, |
147 const AudioParameters& input_params) = 0; | 151 const AudioParameters& input_params) = 0; |
148 | 152 |
149 // Returns the ID of the default audio output device. | 153 // Returns the ID of the default audio output device. |
150 // Implementations that don't yet support this should return an empty string. | 154 // Implementations that don't yet support this should return an empty string. |
151 virtual std::string GetDefaultOutputDeviceID(); | 155 virtual std::string GetDefaultOutputDeviceID(); |
152 | 156 |
153 // Get number of input or output streams. | |
154 int input_stream_count() { return num_input_streams_; } | |
155 int output_stream_count() { return num_output_streams_; } | |
156 | |
157 private: | 157 private: |
158 struct DispatcherParams; | 158 struct DispatcherParams; |
159 typedef ScopedVector<DispatcherParams> AudioOutputDispatchers; | 159 typedef ScopedVector<DispatcherParams> AudioOutputDispatchers; |
160 | 160 |
161 class CompareByParams; | 161 class CompareByParams; |
162 | 162 |
163 // Called by Shutdown(). | 163 // Called by Shutdown(). |
164 void ShutdownOnAudioThread(); | 164 void ShutdownOnAudioThread(); |
165 | 165 |
166 // Max number of open output streams, modified by | 166 // Max number of open output streams, modified by |
(...skipping 26 matching lines...) Expand all Loading... |
193 | 193 |
194 // Proxy for creating AudioLog objects. | 194 // Proxy for creating AudioLog objects. |
195 AudioLogFactory* const audio_log_factory_; | 195 AudioLogFactory* const audio_log_factory_; |
196 | 196 |
197 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 197 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
198 }; | 198 }; |
199 | 199 |
200 } // namespace media | 200 } // namespace media |
201 | 201 |
202 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 202 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
OLD | NEW |