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" | |
9 #include "media/base/audio_bus.h" | 8 #include "media/base/audio_bus.h" |
10 | 9 |
11 // Low-level audio output support. To make sound there are 3 objects involved: | 10 // Low-level audio output support. To make sound there are 3 objects involved: |
12 // - AudioSource : produces audio samples on a pull model. Implements | 11 // - AudioSource : produces audio samples on a pull model. Implements |
13 // the AudioSourceCallback interface. | 12 // the AudioSourceCallback interface. |
14 // - AudioOutputStream : uses the AudioSource to render audio on a given | 13 // - AudioOutputStream : uses the AudioSource to render audio on a given |
15 // channel, format and sample frequency configuration. Data from the | 14 // channel, format and sample frequency configuration. Data from the |
16 // AudioSource is delivered in a 'pull' model. | 15 // AudioSource is delivered in a 'pull' model. |
17 // - AudioManager : factory for the AudioOutputStream objects, manager | 16 // - AudioManager : factory for the AudioOutputStream objects, manager |
18 // of the hardware resources and mixer control. | 17 // of the hardware resources and mixer control. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 class MEDIA_EXPORT AudioInputStream { | 104 class MEDIA_EXPORT AudioInputStream { |
106 public: | 105 public: |
107 class MEDIA_EXPORT AudioInputCallback { | 106 class MEDIA_EXPORT AudioInputCallback { |
108 public: | 107 public: |
109 // Called by the audio recorder when a full packet of audio data is | 108 // 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 | 109 // available. This is called from a special audio thread and the |
111 // implementation should return as soon as possible. | 110 // implementation should return as soon as possible. |
112 // TODO(henrika): should be pure virtual when old OnData() is phased out. | 111 // TODO(henrika): should be pure virtual when old OnData() is phased out. |
113 virtual void OnData(AudioInputStream* stream, | 112 virtual void OnData(AudioInputStream* stream, |
114 const AudioBus* source, | 113 const AudioBus* source, |
115 uint32 hardware_delay_bytes, | 114 uint32_t hardware_delay_bytes, |
116 double volume) {}; | 115 double volume){}; |
117 | 116 |
118 // TODO(henrika): don't use; to be removed. | 117 // TODO(henrika): don't use; to be removed. |
119 virtual void OnData(AudioInputStream* stream, | 118 virtual void OnData(AudioInputStream* stream, |
120 const uint8* src, | 119 const uint8_t* src, |
121 uint32 size, | 120 uint32_t size, |
122 uint32 hardware_delay_bytes, | 121 uint32_t hardware_delay_bytes, |
123 double volume) {}; | 122 double volume){}; |
124 | 123 |
125 // There was an error while recording audio. The audio sink cannot be | 124 // There was an error while recording audio. The audio sink cannot be |
126 // destroyed yet. No direct action needed by the AudioInputStream, but it | 125 // destroyed yet. No direct action needed by the AudioInputStream, but it |
127 // is a good place to stop accumulating sound data since is is likely that | 126 // is a good place to stop accumulating sound data since is is likely that |
128 // recording will not continue. | 127 // recording will not continue. |
129 virtual void OnError(AudioInputStream* stream) = 0; | 128 virtual void OnError(AudioInputStream* stream) = 0; |
130 | 129 |
131 protected: | 130 protected: |
132 virtual ~AudioInputCallback() {} | 131 virtual ~AudioInputCallback() {} |
133 }; | 132 }; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // Returns the Automatic Gain Control (AGC) state. | 166 // Returns the Automatic Gain Control (AGC) state. |
168 virtual bool GetAutomaticGainControl() = 0; | 167 virtual bool GetAutomaticGainControl() = 0; |
169 | 168 |
170 // Returns the current muting state for the microphone. | 169 // Returns the current muting state for the microphone. |
171 virtual bool IsMuted() = 0; | 170 virtual bool IsMuted() = 0; |
172 }; | 171 }; |
173 | 172 |
174 } // namespace media | 173 } // namespace media |
175 | 174 |
176 #endif // MEDIA_AUDIO_AUDIO_IO_H_ | 175 #endif // MEDIA_AUDIO_AUDIO_IO_H_ |
OLD | NEW |