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_IO_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_IO_H_ |
6 #define MEDIA_AUDIO_AUDIO_IO_H_ | 6 #define MEDIA_AUDIO_AUDIO_IO_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "media/audio/audio_buffers_state.h" | 9 #include "media/audio/audio_buffers_state.h" |
10 #include "media/base/audio_bus.h" | 10 #include "media/base/audio_bus.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 }; | 102 }; |
103 | 103 |
104 // Models an audio sink receiving recorded audio from the audio driver. | 104 // Models an audio sink receiving recorded audio from the audio driver. |
105 class MEDIA_EXPORT AudioInputStream { | 105 class MEDIA_EXPORT AudioInputStream { |
106 public: | 106 public: |
107 class MEDIA_EXPORT AudioInputCallback { | 107 class MEDIA_EXPORT AudioInputCallback { |
108 public: | 108 public: |
109 // Called by the audio recorder when a full packet of audio data is | 109 // Called by the audio recorder when a full packet of audio data is |
110 // available. This is called from a special audio thread and the | 110 // available. This is called from a special audio thread and the |
111 // implementation should return as soon as possible. | 111 // implementation should return as soon as possible. |
112 virtual void OnData(AudioInputStream* stream, const uint8* src, | 112 // TODO(henrika): should be pure virtual when old OnData() is phased out. |
113 uint32 size, uint32 hardware_delay_bytes, | 113 virtual void OnData(AudioInputStream* stream, |
114 double volume) = 0; | 114 const AudioBus* source, |
| 115 uint32 hardware_delay_bytes, |
| 116 double volume) {}; |
| 117 |
| 118 // TODO(henrika): don't use; to be removed. |
| 119 virtual void OnData(AudioInputStream* stream, |
| 120 const uint8* src, |
| 121 uint32 size, |
| 122 uint32 hardware_delay_bytes, |
| 123 double volume) {}; |
115 | 124 |
116 // There was an error while recording audio. The audio sink cannot be | 125 // There was an error while recording audio. The audio sink cannot be |
117 // destroyed yet. No direct action needed by the AudioInputStream, but it | 126 // destroyed yet. No direct action needed by the AudioInputStream, but it |
118 // is a good place to stop accumulating sound data since is is likely that | 127 // is a good place to stop accumulating sound data since is is likely that |
119 // recording will not continue. | 128 // recording will not continue. |
120 virtual void OnError(AudioInputStream* stream) = 0; | 129 virtual void OnError(AudioInputStream* stream) = 0; |
121 | 130 |
122 protected: | 131 protected: |
123 virtual ~AudioInputCallback() {} | 132 virtual ~AudioInputCallback() {} |
124 }; | 133 }; |
(...skipping 30 matching lines...) Expand all Loading... |
155 // Sets the Automatic Gain Control (AGC) state. | 164 // Sets the Automatic Gain Control (AGC) state. |
156 virtual void SetAutomaticGainControl(bool enabled) = 0; | 165 virtual void SetAutomaticGainControl(bool enabled) = 0; |
157 | 166 |
158 // Returns the Automatic Gain Control (AGC) state. | 167 // Returns the Automatic Gain Control (AGC) state. |
159 virtual bool GetAutomaticGainControl() = 0; | 168 virtual bool GetAutomaticGainControl() = 0; |
160 }; | 169 }; |
161 | 170 |
162 } // namespace media | 171 } // namespace media |
163 | 172 |
164 #endif // MEDIA_AUDIO_AUDIO_IO_H_ | 173 #endif // MEDIA_AUDIO_AUDIO_IO_H_ |
OLD | NEW |