| 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 28 matching lines...) Expand all Loading... |
| 39 // Input device ID used to capture the default system playback stream. When | 39 // Input device ID used to capture the default system playback stream. When |
| 40 // this device ID is passed to MakeAudioInputStream() the returned | 40 // this device ID is passed to MakeAudioInputStream() the returned |
| 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 virtual ~AudioManagerBase(); | 49 ~AudioManagerBase() override; |
| 50 | 50 |
| 51 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; | 51 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; |
| 52 virtual scoped_refptr<base::SingleThreadTaskRunner> GetWorkerTaskRunner() | 52 scoped_refptr<base::SingleThreadTaskRunner> GetWorkerTaskRunner() override; |
| 53 override; | |
| 54 | 53 |
| 55 virtual base::string16 GetAudioInputDeviceModel() override; | 54 base::string16 GetAudioInputDeviceModel() override; |
| 56 | 55 |
| 57 virtual void ShowAudioInputSettings() override; | 56 void ShowAudioInputSettings() override; |
| 58 | 57 |
| 59 virtual void GetAudioInputDeviceNames( | 58 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; |
| 60 AudioDeviceNames* device_names) override; | |
| 61 | 59 |
| 62 virtual void GetAudioOutputDeviceNames( | 60 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; |
| 63 AudioDeviceNames* device_names) override; | |
| 64 | 61 |
| 65 virtual AudioOutputStream* MakeAudioOutputStream( | 62 AudioOutputStream* MakeAudioOutputStream( |
| 66 const AudioParameters& params, | 63 const AudioParameters& params, |
| 67 const std::string& device_id) override; | 64 const std::string& device_id) override; |
| 68 | 65 |
| 69 virtual AudioInputStream* MakeAudioInputStream( | 66 AudioInputStream* MakeAudioInputStream(const AudioParameters& params, |
| 70 const AudioParameters& params, const std::string& device_id) override; | 67 const std::string& device_id) override; |
| 71 | 68 |
| 72 virtual AudioOutputStream* MakeAudioOutputStreamProxy( | 69 AudioOutputStream* MakeAudioOutputStreamProxy( |
| 73 const AudioParameters& params, | 70 const AudioParameters& params, |
| 74 const std::string& device_id) override; | 71 const std::string& device_id) override; |
| 75 | 72 |
| 76 // Called internally by the audio stream when it has been closed. | 73 // Called internally by the audio stream when it has been closed. |
| 77 virtual void ReleaseOutputStream(AudioOutputStream* stream); | 74 virtual void ReleaseOutputStream(AudioOutputStream* stream); |
| 78 virtual void ReleaseInputStream(AudioInputStream* stream); | 75 virtual void ReleaseInputStream(AudioInputStream* stream); |
| 79 | 76 |
| 80 // 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 |
| 81 // name is also from |AUDIO_PCM_LINEAR|. | 78 // name is also from |AUDIO_PCM_LINEAR|. |
| 82 virtual AudioOutputStream* MakeLinearOutputStream( | 79 virtual AudioOutputStream* MakeLinearOutputStream( |
| 83 const AudioParameters& params) = 0; | 80 const AudioParameters& params) = 0; |
| 84 | 81 |
| 85 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format. | 82 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format. |
| 86 virtual AudioOutputStream* MakeLowLatencyOutputStream( | 83 virtual AudioOutputStream* MakeLowLatencyOutputStream( |
| 87 const AudioParameters& params, | 84 const AudioParameters& params, |
| 88 const std::string& device_id) = 0; | 85 const std::string& device_id) = 0; |
| 89 | 86 |
| 90 // 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 |
| 91 // name is also from |AUDIO_PCM_LINEAR|. | 88 // name is also from |AUDIO_PCM_LINEAR|. |
| 92 virtual AudioInputStream* MakeLinearInputStream( | 89 virtual AudioInputStream* MakeLinearInputStream( |
| 93 const AudioParameters& params, const std::string& device_id) = 0; | 90 const AudioParameters& params, const std::string& device_id) = 0; |
| 94 | 91 |
| 95 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. | 92 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. |
| 96 virtual AudioInputStream* MakeLowLatencyInputStream( | 93 virtual AudioInputStream* MakeLowLatencyInputStream( |
| 97 const AudioParameters& params, const std::string& device_id) = 0; | 94 const AudioParameters& params, const std::string& device_id) = 0; |
| 98 | 95 |
| 99 // Listeners will be notified on the GetTaskRunner() task runner. | 96 // Listeners will be notified on the GetTaskRunner() task runner. |
| 100 virtual void AddOutputDeviceChangeListener( | 97 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override; |
| 101 AudioDeviceListener* listener) override; | 98 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override; |
| 102 virtual void RemoveOutputDeviceChangeListener( | |
| 103 AudioDeviceListener* listener) override; | |
| 104 | 99 |
| 105 virtual AudioParameters GetDefaultOutputStreamParameters() override; | 100 AudioParameters GetDefaultOutputStreamParameters() override; |
| 106 virtual AudioParameters GetOutputStreamParameters( | 101 AudioParameters GetOutputStreamParameters( |
| 107 const std::string& device_id) override; | 102 const std::string& device_id) override; |
| 108 | 103 |
| 109 virtual AudioParameters GetInputStreamParameters( | 104 AudioParameters GetInputStreamParameters( |
| 110 const std::string& device_id) override; | 105 const std::string& device_id) override; |
| 111 | 106 |
| 112 virtual std::string GetAssociatedOutputDeviceID( | 107 std::string GetAssociatedOutputDeviceID( |
| 113 const std::string& input_device_id) override; | 108 const std::string& input_device_id) override; |
| 114 | 109 |
| 115 virtual scoped_ptr<AudioLog> CreateAudioLog( | 110 scoped_ptr<AudioLog> CreateAudioLog( |
| 116 AudioLogFactory::AudioComponent component) override; | 111 AudioLogFactory::AudioComponent component) override; |
| 117 | 112 |
| 118 virtual void SetHasKeyboardMic() override; | 113 void SetHasKeyboardMic() override; |
| 119 | 114 |
| 120 // Get number of input or output streams. | 115 // Get number of input or output streams. |
| 121 int input_stream_count() const { return num_input_streams_; } | 116 int input_stream_count() const { return num_input_streams_; } |
| 122 int output_stream_count() const { return num_output_streams_; } | 117 int output_stream_count() const { return num_output_streams_; } |
| 123 | 118 |
| 124 protected: | 119 protected: |
| 125 AudioManagerBase(AudioLogFactory* audio_log_factory); | 120 AudioManagerBase(AudioLogFactory* audio_log_factory); |
| 126 | 121 |
| 127 // 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 |
| 128 // 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() |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 190 |
| 196 // Proxy for creating AudioLog objects. | 191 // Proxy for creating AudioLog objects. |
| 197 AudioLogFactory* const audio_log_factory_; | 192 AudioLogFactory* const audio_log_factory_; |
| 198 | 193 |
| 199 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 194 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
| 200 }; | 195 }; |
| 201 | 196 |
| 202 } // namespace media | 197 } // namespace media |
| 203 | 198 |
| 204 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 199 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
| OLD | NEW |