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_OUTPUT_CONTROLLER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
6 #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
7 | 7 |
8 #include "base/atomic_ref_count.h" | 8 #include "base/atomic_ref_count.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // now that it can handle synchronized I/O. | 79 // now that it can handle synchronized I/O. |
80 class SyncReader { | 80 class SyncReader { |
81 public: | 81 public: |
82 virtual ~SyncReader() {} | 82 virtual ~SyncReader() {} |
83 | 83 |
84 // Notify the synchronous reader the number of bytes in the | 84 // Notify the synchronous reader the number of bytes in the |
85 // AudioOutputController not yet played. This is used by SyncReader to | 85 // AudioOutputController not yet played. This is used by SyncReader to |
86 // prepare more data and perform synchronization. | 86 // prepare more data and perform synchronization. |
87 virtual void UpdatePendingBytes(uint32 bytes) = 0; | 87 virtual void UpdatePendingBytes(uint32 bytes) = 0; |
88 | 88 |
89 // Attempt to completely fill |dest|, return the actual number of frames | 89 // Attempts to completely fill |dest|, zeroing |dest| if the request can not |
90 // that could be read. |source| may optionally be provided for input data. | 90 // be fulfilled (due to timeout). |source| may optionally be provided for |
91 // If |block| is specified, the Read() will block until data is available | 91 // input data. |
92 // or a timeout is reached. | 92 virtual void Read(const AudioBus* source, AudioBus* dest) = 0; |
93 virtual int Read(bool block, const AudioBus* source, AudioBus* dest) = 0; | |
94 | 93 |
95 // Close this synchronous reader. | 94 // Close this synchronous reader. |
96 virtual void Close() = 0; | 95 virtual void Close() = 0; |
97 }; | 96 }; |
98 | 97 |
99 // Factory method for creating an AudioOutputController. | 98 // Factory method for creating an AudioOutputController. |
100 // This also creates and opens an AudioOutputStream on the audio manager | 99 // This also creates and opens an AudioOutputStream on the audio manager |
101 // thread, and if this is successful, the |event_handler| will receive an | 100 // thread, and if this is successful, the |event_handler| will receive an |
102 // OnCreated() call from the same audio manager thread. |audio_manager| must | 101 // OnCreated() call from the same audio manager thread. |audio_manager| must |
103 // outlive AudioOutputController. | 102 // outlive AudioOutputController. |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 244 |
246 // Periodic callback to report power levels during playback. | 245 // Periodic callback to report power levels during playback. |
247 base::CancelableClosure power_poll_callback_; | 246 base::CancelableClosure power_poll_callback_; |
248 | 247 |
249 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); | 248 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); |
250 }; | 249 }; |
251 | 250 |
252 } // namespace media | 251 } // namespace media |
253 | 252 |
254 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 253 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
OLD | NEW |