| 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 30 matching lines...) Expand all Loading... |
| 41 // AudioInputStream will be capturing audio currently being played on the | 41 // AudioInputStream will be capturing audio currently being played on the |
| 42 // default playback device. At the moment this feature is supported only on | 42 // default playback device. At the moment this feature is supported only on |
| 43 // some platforms. AudioInputStream::Intialize() will return an error on | 43 // some platforms. AudioInputStream::Intialize() will return an error on |
| 44 // platforms that don't support it. GetInputStreamParameters() must be used | 44 // platforms that don't support it. GetInputStreamParameters() must be used |
| 45 // to get the parameters of the loopback device before creating a loopback | 45 // to get the parameters of the loopback device before creating a loopback |
| 46 // stream, otherwise stream initialization may fail. | 46 // stream, otherwise stream initialization may fail. |
| 47 static const char kLoopbackInputDeviceId[]; | 47 static const char kLoopbackInputDeviceId[]; |
| 48 | 48 |
| 49 ~AudioManagerBase() override; | 49 ~AudioManagerBase() override; |
| 50 | 50 |
| 51 // AudioManager: | |
| 52 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; | 51 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; |
| 53 scoped_refptr<base::SingleThreadTaskRunner> GetWorkerTaskRunner() override; | 52 scoped_refptr<base::SingleThreadTaskRunner> GetWorkerTaskRunner() override; |
| 53 |
| 54 base::string16 GetAudioInputDeviceModel() override; | 54 base::string16 GetAudioInputDeviceModel() override; |
| 55 |
| 55 void ShowAudioInputSettings() override; | 56 void ShowAudioInputSettings() override; |
| 57 |
| 56 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; | 58 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; |
| 59 |
| 57 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; | 60 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; |
| 61 |
| 58 AudioOutputStream* MakeAudioOutputStream( | 62 AudioOutputStream* MakeAudioOutputStream( |
| 59 const AudioParameters& params, | 63 const AudioParameters& params, |
| 60 const std::string& device_id) override; | 64 const std::string& device_id) override; |
| 65 |
| 61 AudioInputStream* MakeAudioInputStream(const AudioParameters& params, | 66 AudioInputStream* MakeAudioInputStream(const AudioParameters& params, |
| 62 const std::string& device_id) override; | 67 const std::string& device_id) override; |
| 68 |
| 63 AudioOutputStream* MakeAudioOutputStreamProxy( | 69 AudioOutputStream* MakeAudioOutputStreamProxy( |
| 64 const AudioParameters& params, | 70 const AudioParameters& params, |
| 65 const std::string& device_id) override; | 71 const std::string& device_id) override; |
| 66 | 72 |
| 67 // Listeners will be notified on the GetTaskRunner() task runner. | |
| 68 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override; | |
| 69 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override; | |
| 70 | |
| 71 AudioParameters GetDefaultOutputStreamParameters() override; | |
| 72 AudioParameters GetOutputStreamParameters( | |
| 73 const std::string& device_id) override; | |
| 74 AudioParameters GetInputStreamParameters( | |
| 75 const std::string& device_id) override; | |
| 76 std::string GetAssociatedOutputDeviceID( | |
| 77 const std::string& input_device_id) override; | |
| 78 scoped_ptr<AudioLog> CreateAudioLog( | |
| 79 AudioLogFactory::AudioComponent component) override; | |
| 80 void SetHasKeyboardMic() override; | |
| 81 | |
| 82 // AudioManagerBase: | |
| 83 | |
| 84 // Called internally by the audio stream when it has been closed. | 73 // Called internally by the audio stream when it has been closed. |
| 85 virtual void ReleaseOutputStream(AudioOutputStream* stream); | 74 virtual void ReleaseOutputStream(AudioOutputStream* stream); |
| 86 virtual void ReleaseInputStream(AudioInputStream* stream); | 75 virtual void ReleaseInputStream(AudioInputStream* stream); |
| 87 | 76 |
| 88 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy | 77 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy |
| 89 // name is also from |AUDIO_PCM_LINEAR|. | 78 // name is also from |AUDIO_PCM_LINEAR|. |
| 90 virtual AudioOutputStream* MakeLinearOutputStream( | 79 virtual AudioOutputStream* MakeLinearOutputStream( |
| 91 const AudioParameters& params) = 0; | 80 const AudioParameters& params) = 0; |
| 92 | 81 |
| 93 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format. | 82 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format. |
| 94 virtual AudioOutputStream* MakeLowLatencyOutputStream( | 83 virtual AudioOutputStream* MakeLowLatencyOutputStream( |
| 95 const AudioParameters& params, | 84 const AudioParameters& params, |
| 96 const std::string& device_id) = 0; | 85 const std::string& device_id) = 0; |
| 97 | 86 |
| 98 // Creates the input stream for the |AUDIO_PCM_LINEAR| format. The legacy | 87 // Creates the input stream for the |AUDIO_PCM_LINEAR| format. The legacy |
| 99 // name is also from |AUDIO_PCM_LINEAR|. | 88 // name is also from |AUDIO_PCM_LINEAR|. |
| 100 virtual AudioInputStream* MakeLinearInputStream( | 89 virtual AudioInputStream* MakeLinearInputStream( |
| 101 const AudioParameters& params, const std::string& device_id) = 0; | 90 const AudioParameters& params, const std::string& device_id) = 0; |
| 102 | 91 |
| 103 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. | 92 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. |
| 104 virtual AudioInputStream* MakeLowLatencyInputStream( | 93 virtual AudioInputStream* MakeLowLatencyInputStream( |
| 105 const AudioParameters& params, const std::string& device_id) = 0; | 94 const AudioParameters& params, const std::string& device_id) = 0; |
| 106 | 95 |
| 96 // Listeners will be notified on the GetTaskRunner() task runner. |
| 97 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override; |
| 98 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override; |
| 99 |
| 100 AudioParameters GetDefaultOutputStreamParameters() override; |
| 101 AudioParameters GetOutputStreamParameters( |
| 102 const std::string& device_id) override; |
| 103 |
| 104 AudioParameters GetInputStreamParameters( |
| 105 const std::string& device_id) override; |
| 106 |
| 107 std::string GetAssociatedOutputDeviceID( |
| 108 const std::string& input_device_id) override; |
| 109 |
| 110 scoped_ptr<AudioLog> CreateAudioLog( |
| 111 AudioLogFactory::AudioComponent component) override; |
| 112 |
| 113 void SetHasKeyboardMic() override; |
| 114 |
| 107 // Get number of input or output streams. | 115 // Get number of input or output streams. |
| 108 int input_stream_count() const { return num_input_streams_; } | 116 int input_stream_count() const { return num_input_streams_; } |
| 109 int output_stream_count() const { return num_output_streams_; } | 117 int output_stream_count() const { return num_output_streams_; } |
| 110 | 118 |
| 111 protected: | 119 protected: |
| 112 AudioManagerBase(AudioLogFactory* audio_log_factory); | 120 AudioManagerBase(AudioLogFactory* audio_log_factory); |
| 113 | 121 |
| 114 // Shuts down the audio thread and releases all the audio output dispatchers | 122 // Shuts down the audio thread and releases all the audio output dispatchers |
| 115 // on the audio thread. All audio streams should be freed before Shutdown() | 123 // on the audio thread. All audio streams should be freed before Shutdown() |
| 116 // is called. This must be called in the destructor of every AudioManagerBase | 124 // is called. This must be called in the destructor of every AudioManagerBase |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 190 |
| 183 // Proxy for creating AudioLog objects. | 191 // Proxy for creating AudioLog objects. |
| 184 AudioLogFactory* const audio_log_factory_; | 192 AudioLogFactory* const audio_log_factory_; |
| 185 | 193 |
| 186 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 194 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
| 187 }; | 195 }; |
| 188 | 196 |
| 189 } // namespace media | 197 } // namespace media |
| 190 | 198 |
| 191 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 199 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
| OLD | NEW |