| 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 // 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 virtual int samples_per_second() = 0; | 193 virtual int samples_per_second() = 0; |
| 194 | 194 |
| 195 protected: | 195 protected: |
| 196 AudioDecoder(); | 196 AudioDecoder(); |
| 197 virtual ~AudioDecoder(); | 197 virtual ~AudioDecoder(); |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 | 200 |
| 201 class MEDIA_EXPORT VideoRenderer : public Filter { | 201 class MEDIA_EXPORT VideoRenderer : public Filter { |
| 202 public: | 202 public: |
| 203 // Used to update the pipeline's clock time. The parameter is the time that |
| 204 // the clock should not exceed. |
| 205 typedef base::Callback<void(base::TimeDelta)> VideoTimeCB; |
| 206 |
| 203 // Initialize a VideoRenderer with the given VideoDecoder, executing the | 207 // Initialize a VideoRenderer with the given VideoDecoder, executing the |
| 204 // callback upon completion. | 208 // |init_cb| upon completion. |
| 205 virtual void Initialize(VideoDecoder* decoder, const base::Closure& callback, | 209 virtual void Initialize(VideoDecoder* decoder, const base::Closure& init_cb, |
| 206 const StatisticsCallback& stats_callback) = 0; | 210 const StatisticsCallback& stats_callback, |
| 211 const VideoTimeCB& time_cb) = 0; |
| 207 | 212 |
| 208 // Returns true if this filter has received and processed an end-of-stream | 213 // Returns true if this filter has received and processed an end-of-stream |
| 209 // buffer. | 214 // buffer. |
| 210 virtual bool HasEnded() = 0; | 215 virtual bool HasEnded() = 0; |
| 211 }; | 216 }; |
| 212 | 217 |
| 213 | 218 |
| 214 class MEDIA_EXPORT AudioRenderer : public Filter { | 219 class MEDIA_EXPORT AudioRenderer : public Filter { |
| 215 public: | 220 public: |
| 221 // Used to update the pipeline's clock time. The first parameter is the |
| 222 // current time, and the second parameter is the time that the clock must not |
| 223 // exceed. |
| 224 typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> AudioTimeCB; |
| 225 |
| 216 // Initialize a AudioRenderer with the given AudioDecoder, executing the | 226 // Initialize a AudioRenderer with the given AudioDecoder, executing the |
| 217 // |init_callback| upon completion. |underflow_callback| is called when the | 227 // |init_callback| upon completion. |underflow_callback| is called when the |
| 218 // renderer runs out of data to pass to the audio card during playback. | 228 // renderer runs out of data to pass to the audio card during playback. |
| 219 // If the |underflow_callback| is called ResumeAfterUnderflow() must be called | 229 // If the |underflow_callback| is called ResumeAfterUnderflow() must be called |
| 220 // to resume playback. Pause(), Seek(), or Stop() cancels the underflow | 230 // to resume playback. Pause(), Seek(), or Stop() cancels the underflow |
| 221 // condition. | 231 // condition. |
| 222 virtual void Initialize(AudioDecoder* decoder, | 232 virtual void Initialize(AudioDecoder* decoder, |
| 223 const base::Closure& init_callback, | 233 const base::Closure& init_callback, |
| 224 const base::Closure& underflow_callback) = 0; | 234 const base::Closure& underflow_callback, |
| 235 const AudioTimeCB& time_cb) = 0; |
| 225 | 236 |
| 226 // Returns true if this filter has received and processed an end-of-stream | 237 // Returns true if this filter has received and processed an end-of-stream |
| 227 // buffer. | 238 // buffer. |
| 228 virtual bool HasEnded() = 0; | 239 virtual bool HasEnded() = 0; |
| 229 | 240 |
| 230 // Sets the output volume. | 241 // Sets the output volume. |
| 231 virtual void SetVolume(float volume) = 0; | 242 virtual void SetVolume(float volume) = 0; |
| 232 | 243 |
| 233 // Resumes playback after underflow occurs. | 244 // Resumes playback after underflow occurs. |
| 234 // |buffer_more_audio| is set to true if you want to increase the size of the | 245 // |buffer_more_audio| is set to true if you want to increase the size of the |
| 235 // decoded audio buffer. | 246 // decoded audio buffer. |
| 236 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; | 247 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; |
| 237 }; | 248 }; |
| 238 | 249 |
| 239 } // namespace media | 250 } // namespace media |
| 240 | 251 |
| 241 #endif // MEDIA_BASE_FILTERS_H_ | 252 #endif // MEDIA_BASE_FILTERS_H_ |
| OLD | NEW |