| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // AudioRendererBase takes care of the tricky queuing work and provides simple | 5 // AudioRendererBase takes care of the tricky queuing work and provides simple |
| 6 // methods for subclasses to peek and poke at audio data. In addition to | 6 // methods for subclasses to peek and poke at audio data. In addition to |
| 7 // AudioRenderer interface methods this classes doesn't implement, subclasses | 7 // AudioRenderer interface methods this classes doesn't implement, subclasses |
| 8 // must also implement the following methods: | 8 // must also implement the following methods: |
| 9 // OnInitialized | 9 // OnInitialized |
| 10 // OnStop | 10 // OnStop |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 // Called by Initialize(). |media_format| is the format of the AudioDecoder. | 49 // Called by Initialize(). |media_format| is the format of the AudioDecoder. |
| 50 // Subclasses should return true if they were able to initialize, false | 50 // Subclasses should return true if they were able to initialize, false |
| 51 // otherwise. | 51 // otherwise. |
| 52 virtual bool OnInitialize(const MediaFormat& media_format) = 0; | 52 virtual bool OnInitialize(const MediaFormat& media_format) = 0; |
| 53 | 53 |
| 54 // Called by Stop(). Subclasses should perform any necessary cleanup during | 54 // Called by Stop(). Subclasses should perform any necessary cleanup during |
| 55 // this time, such as stopping any running threads. | 55 // this time, such as stopping any running threads. |
| 56 virtual void OnStop() = 0; | 56 virtual void OnStop() = 0; |
| 57 | 57 |
| 58 // Called when a AudioDecoder::Read() completes and decrements | 58 // Called when a AudioDecoder completes decoding and decrements |
| 59 // |pending_reads_|. | 59 // |pending_reads_|. |
| 60 virtual void OnReadComplete(Buffer* buffer_in); | 60 virtual void OnFillBufferDone(scoped_refptr<Buffer> buffer_in); |
| 61 | 61 |
| 62 // Fills the given buffer with audio data by delegating to its |algorithm_|. | 62 // Fills the given buffer with audio data by delegating to its |algorithm_|. |
| 63 // FillBuffer() also takes care of updating the clock. Returns the number of | 63 // FillBuffer() also takes care of updating the clock. Returns the number of |
| 64 // bytes copied into |dest|, which may be less than or equal to |len|. | 64 // bytes copied into |dest|, which may be less than or equal to |len|. |
| 65 // | 65 // |
| 66 // If this method is returns less bytes than |len| (including zero), it could | 66 // If this method is returns less bytes than |len| (including zero), it could |
| 67 // be a sign that the pipeline is stalled or unable to stream the data fast | 67 // be a sign that the pipeline is stalled or unable to stream the data fast |
| 68 // enough. In such scenarios, the callee should zero out unused portions | 68 // enough. In such scenarios, the callee should zero out unused portions |
| 69 // of their buffer to playback silence. | 69 // of their buffer to playback silence. |
| 70 // | 70 // |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // Filter callbacks. | 134 // Filter callbacks. |
| 135 scoped_ptr<FilterCallback> pause_callback_; | 135 scoped_ptr<FilterCallback> pause_callback_; |
| 136 scoped_ptr<FilterCallback> seek_callback_; | 136 scoped_ptr<FilterCallback> seek_callback_; |
| 137 | 137 |
| 138 DISALLOW_COPY_AND_ASSIGN(AudioRendererBase); | 138 DISALLOW_COPY_AND_ASSIGN(AudioRendererBase); |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 } // namespace media | 141 } // namespace media |
| 142 | 142 |
| 143 #endif // MEDIA_FILTERS_AUDIO_RENDERER_BASE_H_ | 143 #endif // MEDIA_FILTERS_AUDIO_RENDERER_BASE_H_ |
| OLD | NEW |