| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb); | 40 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb); |
| 41 | 41 |
| 42 // AudioRenderer implementation. | 42 // AudioRenderer implementation. |
| 43 virtual void Initialize(AudioDecoder* decoder, FilterCallback* callback); | 43 virtual void Initialize(AudioDecoder* decoder, FilterCallback* callback); |
| 44 virtual bool HasEnded(); | 44 virtual bool HasEnded(); |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 // Subclasses should return true if they were able to initialize, false | 47 // Subclasses should return true if they were able to initialize, false |
| 48 // otherwise. | 48 // otherwise. |
| 49 virtual bool OnInitialize(const AudioDecoderConfig& config) = 0; | 49 virtual bool OnInitialize(int bits_per_channel, |
| 50 ChannelLayout channel_layout, |
| 51 int sample_rate) = 0; |
| 50 | 52 |
| 51 // Called by Stop(). Subclasses should perform any necessary cleanup during | 53 // Called by Stop(). Subclasses should perform any necessary cleanup during |
| 52 // this time, such as stopping any running threads. | 54 // this time, such as stopping any running threads. |
| 53 virtual void OnStop() = 0; | 55 virtual void OnStop() = 0; |
| 54 | 56 |
| 55 // Called when a AudioDecoder completes decoding and decrements | 57 // Called when a AudioDecoder completes decoding and decrements |
| 56 // |pending_reads_|. | 58 // |pending_reads_|. |
| 57 virtual void ConsumeAudioSamples(scoped_refptr<Buffer> buffer_in); | 59 virtual void ConsumeAudioSamples(scoped_refptr<Buffer> buffer_in); |
| 58 | 60 |
| 59 // Fills the given buffer with audio data by delegating to its |algorithm_|. | 61 // Fills the given buffer with audio data by delegating to its |algorithm_|. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 FilterStatusCB seek_cb_; | 130 FilterStatusCB seek_cb_; |
| 129 | 131 |
| 130 base::TimeDelta seek_timestamp_; | 132 base::TimeDelta seek_timestamp_; |
| 131 | 133 |
| 132 DISALLOW_COPY_AND_ASSIGN(AudioRendererBase); | 134 DISALLOW_COPY_AND_ASSIGN(AudioRendererBase); |
| 133 }; | 135 }; |
| 134 | 136 |
| 135 } // namespace media | 137 } // namespace media |
| 136 | 138 |
| 137 #endif // MEDIA_FILTERS_AUDIO_RENDERER_BASE_H_ | 139 #endif // MEDIA_FILTERS_AUDIO_RENDERER_BASE_H_ |
| OLD | NEW |