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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 namespace media { | 50 namespace media { |
51 | 51 |
52 class MEDIA_EXPORT AudioOutputStream { | 52 class MEDIA_EXPORT AudioOutputStream { |
53 public: | 53 public: |
54 // Audio sources must implement AudioSourceCallback. This interface will be | 54 // Audio sources must implement AudioSourceCallback. This interface will be |
55 // called in a random thread which very likely is a high priority thread. Do | 55 // called in a random thread which very likely is a high priority thread. Do |
56 // not rely on using this thread TLS or make calls that alter the thread | 56 // not rely on using this thread TLS or make calls that alter the thread |
57 // itself such as creating Windows or initializing COM. | 57 // itself such as creating Windows or initializing COM. |
58 class MEDIA_EXPORT AudioSourceCallback { | 58 class MEDIA_EXPORT AudioSourceCallback { |
59 public: | 59 public: |
60 // Provide more data by fully filling |audio_bus|. The source will return | 60 // Provide more data by fully filling |dest|. The source will return |
61 // the number of frames it filled. |buffers_state| contains current state | 61 // the number of frames it filled. |buffers_state| contains current state |
62 // of the buffers, and can be used by the source to calculate delay. | 62 // of the buffers, and can be used by the source to calculate delay. |
63 virtual int OnMoreData(AudioBus* audio_bus, | 63 virtual int OnMoreData(AudioBus* dest, |
64 AudioBuffersState buffers_state) = 0; | 64 AudioBuffersState buffers_state) = 0; |
65 | 65 |
66 virtual int OnMoreIOData(AudioBus* source, | |
henrika (OOO until Aug 14)
2012/09/11 21:44:48
Comment?
| |
67 AudioBus* dest, | |
68 AudioBuffersState buffers_state) = 0; | |
69 | |
66 // There was an error while playing a buffer. Audio source cannot be | 70 // There was an error while playing a buffer. Audio source cannot be |
67 // destroyed yet. No direct action needed by the AudioStream, but it is | 71 // destroyed yet. No direct action needed by the AudioStream, but it is |
68 // a good place to stop accumulating sound data since is is likely that | 72 // a good place to stop accumulating sound data since is is likely that |
69 // playback will not continue. |code| is an error code that is platform | 73 // playback will not continue. |code| is an error code that is platform |
70 // specific. | 74 // specific. |
71 virtual void OnError(AudioOutputStream* stream, int code) = 0; | 75 virtual void OnError(AudioOutputStream* stream, int code) = 0; |
72 | 76 |
73 // Waits till data becomes available. Used when buffering data starting | 77 // Waits till data becomes available. Used when buffering data starting |
74 // new audio stream. | 78 // new audio stream. |
75 // Polling is not the best approach, but incorporating messaging loop | 79 // Polling is not the best approach, but incorporating messaging loop |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 // Sets the Automatic Gain Control (AGC) state. | 174 // Sets the Automatic Gain Control (AGC) state. |
171 virtual void SetAutomaticGainControl(bool enabled) = 0; | 175 virtual void SetAutomaticGainControl(bool enabled) = 0; |
172 | 176 |
173 // Returns the Automatic Gain Control (AGC) state. | 177 // Returns the Automatic Gain Control (AGC) state. |
174 virtual bool GetAutomaticGainControl() = 0; | 178 virtual bool GetAutomaticGainControl() = 0; |
175 }; | 179 }; |
176 | 180 |
177 } // namespace media | 181 } // namespace media |
178 | 182 |
179 #endif // MEDIA_AUDIO_AUDIO_IO_H_ | 183 #endif // MEDIA_AUDIO_AUDIO_IO_H_ |
OLD | NEW |