| 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 // Filters are connected in a strongly typed manner, with downstream filters | 5 // Filters are connected in a strongly typed manner, with downstream filters |
| 6 // always reading data from upstream filters. Upstream filters have no clue | 6 // always reading data from upstream filters. Upstream filters have no clue |
| 7 // who is actually reading from them, and return the results via callbacks. | 7 // who is actually reading from them, and return the results via callbacks. |
| 8 // | 8 // |
| 9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer | 9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer |
| 10 // DataSource <- Demuxer < | 10 // DataSource <- Demuxer < |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 virtual int samples_per_second() = 0; | 185 virtual int samples_per_second() = 0; |
| 186 | 186 |
| 187 protected: | 187 protected: |
| 188 AudioDecoder(); | 188 AudioDecoder(); |
| 189 virtual ~AudioDecoder(); | 189 virtual ~AudioDecoder(); |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 | 192 |
| 193 class MEDIA_EXPORT VideoRenderer : public Filter { | 193 class MEDIA_EXPORT VideoRenderer : public Filter { |
| 194 public: | 194 public: |
| 195 // Used to update the pipeline's clock time. The parameter is the time that |
| 196 // the clock should not exceed. |
| 197 typedef base::Callback<void(base::TimeDelta)> VideoTimeCB; |
| 198 |
| 195 // Initialize a VideoRenderer with the given VideoDecoder, executing the | 199 // Initialize a VideoRenderer with the given VideoDecoder, executing the |
| 196 // callback upon completion. | 200 // |init_cb| upon completion. |
| 197 virtual void Initialize(VideoDecoder* decoder, const base::Closure& callback, | 201 virtual void Initialize(VideoDecoder* decoder, const base::Closure& init_cb, |
| 198 const StatisticsCallback& stats_callback) = 0; | 202 const StatisticsCallback& stats_callback, |
| 203 const VideoTimeCB& time_cb) = 0; |
| 199 | 204 |
| 200 // Returns true if this filter has received and processed an end-of-stream | 205 // Returns true if this filter has received and processed an end-of-stream |
| 201 // buffer. | 206 // buffer. |
| 202 virtual bool HasEnded() = 0; | 207 virtual bool HasEnded() = 0; |
| 203 }; | 208 }; |
| 204 | 209 |
| 205 | 210 |
| 206 class MEDIA_EXPORT AudioRenderer : public Filter { | 211 class MEDIA_EXPORT AudioRenderer : public Filter { |
| 207 public: | 212 public: |
| 213 // Used to update the pipeline's clock time. The first parameter is the |
| 214 // current time, and the second parameter is the time that the clock must not |
| 215 // exceed. |
| 216 typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> AudioTimeCB; |
| 217 |
| 208 // Initialize a AudioRenderer with the given AudioDecoder, executing the | 218 // Initialize a AudioRenderer with the given AudioDecoder, executing the |
| 209 // |init_callback| upon completion. |underflow_callback| is called when the | 219 // |init_callback| upon completion. |underflow_callback| is called when the |
| 210 // renderer runs out of data to pass to the audio card during playback. | 220 // renderer runs out of data to pass to the audio card during playback. |
| 211 // If the |underflow_callback| is called ResumeAfterUnderflow() must be called | 221 // If the |underflow_callback| is called ResumeAfterUnderflow() must be called |
| 212 // to resume playback. Pause(), Seek(), or Stop() cancels the underflow | 222 // to resume playback. Pause(), Seek(), or Stop() cancels the underflow |
| 213 // condition. | 223 // condition. |
| 214 virtual void Initialize(AudioDecoder* decoder, | 224 virtual void Initialize(AudioDecoder* decoder, |
| 215 const base::Closure& init_callback, | 225 const base::Closure& init_callback, |
| 216 const base::Closure& underflow_callback) = 0; | 226 const base::Closure& underflow_callback, |
| 227 const AudioTimeCB& time_cb) = 0; |
| 217 | 228 |
| 218 // Returns true if this filter has received and processed an end-of-stream | 229 // Returns true if this filter has received and processed an end-of-stream |
| 219 // buffer. | 230 // buffer. |
| 220 virtual bool HasEnded() = 0; | 231 virtual bool HasEnded() = 0; |
| 221 | 232 |
| 222 // Sets the output volume. | 233 // Sets the output volume. |
| 223 virtual void SetVolume(float volume) = 0; | 234 virtual void SetVolume(float volume) = 0; |
| 224 | 235 |
| 225 // Resumes playback after underflow occurs. | 236 // Resumes playback after underflow occurs. |
| 226 // |buffer_more_audio| is set to true if you want to increase the size of the | 237 // |buffer_more_audio| is set to true if you want to increase the size of the |
| 227 // decoded audio buffer. | 238 // decoded audio buffer. |
| 228 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; | 239 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; |
| 229 }; | 240 }; |
| 230 | 241 |
| 231 } // namespace media | 242 } // namespace media |
| 232 | 243 |
| 233 #endif // MEDIA_BASE_FILTERS_H_ | 244 #endif // MEDIA_BASE_FILTERS_H_ |
| OLD | NEW |