| 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 // VideoRendererBase creates its own thread for the sole purpose of timing frame | 5 // VideoRendererBase creates its own thread for the sole purpose of timing frame |
| 6 // presentation. It handles reading from the decoder and stores the results in | 6 // presentation. It handles reading from the decoder and stores the results in |
| 7 // a queue of decoded frames, calling OnFrameAvailable() on subclasses to notify | 7 // a queue of decoded frames, calling OnFrameAvailable() on subclasses to notify |
| 8 // when a frame is ready to display. | 8 // when a frame is ready to display. |
| 9 // | 9 // |
| 10 // The media filter methods Initialize(), Stop(), SetPlaybackRate() and Seek() | 10 // The media filter methods Initialize(), Stop(), SetPlaybackRate() and Seek() |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // TODO(scherkus): to avoid subclasses, consider using a peer/delegate interface | 30 // TODO(scherkus): to avoid subclasses, consider using a peer/delegate interface |
| 31 // and pass in a reference to the constructor. | 31 // and pass in a reference to the constructor. |
| 32 class MEDIA_EXPORT VideoRendererBase | 32 class MEDIA_EXPORT VideoRendererBase |
| 33 : public VideoRenderer, | 33 : public VideoRenderer, |
| 34 public base::PlatformThread::Delegate { | 34 public base::PlatformThread::Delegate { |
| 35 public: | 35 public: |
| 36 VideoRendererBase(); | 36 VideoRendererBase(); |
| 37 virtual ~VideoRendererBase(); | 37 virtual ~VideoRendererBase(); |
| 38 | 38 |
| 39 // Filter implementation. | 39 // Filter implementation. |
| 40 virtual void Play(const base::Closure& callback); | 40 virtual void Play(const base::Closure& callback) OVERRIDE; |
| 41 virtual void Pause(const base::Closure& callback); | 41 virtual void Pause(const base::Closure& callback) OVERRIDE; |
| 42 virtual void Flush(const base::Closure& callback); | 42 virtual void Flush(const base::Closure& callback) OVERRIDE; |
| 43 virtual void Stop(const base::Closure& callback); | 43 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 44 virtual void SetPlaybackRate(float playback_rate); | 44 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; |
| 45 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb); | 45 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb) OVERRIDE; |
| 46 | 46 |
| 47 // VideoRenderer implementation. | 47 // VideoRenderer implementation. |
| 48 virtual void Initialize(VideoDecoder* decoder, | 48 virtual void Initialize(VideoDecoder* decoder, |
| 49 const base::Closure& callback, | 49 const base::Closure& callback, |
| 50 const StatisticsCallback& stats_callback); | 50 const StatisticsCallback& stats_callback) OVERRIDE; |
| 51 virtual bool HasEnded(); | 51 virtual bool HasEnded() OVERRIDE; |
| 52 | 52 |
| 53 // PlatformThread::Delegate implementation. | 53 // PlatformThread::Delegate implementation. |
| 54 virtual void ThreadMain(); | 54 virtual void ThreadMain() OVERRIDE; |
| 55 | 55 |
| 56 // Clients of this class (painter/compositor) should use GetCurrentFrame() | 56 // Clients of this class (painter/compositor) should use GetCurrentFrame() |
| 57 // obtain ownership of VideoFrame, it should always relinquish the ownership | 57 // obtain ownership of VideoFrame, it should always relinquish the ownership |
| 58 // by use PutCurrentFrame(). Current frame is not guaranteed to be non-NULL. | 58 // by use PutCurrentFrame(). Current frame is not guaranteed to be non-NULL. |
| 59 // It expects clients to use color-fill the background if current frame | 59 // It expects clients to use color-fill the background if current frame |
| 60 // is NULL. This could happen before pipeline is pre-rolled or during | 60 // is NULL. This could happen before pipeline is pre-rolled or during |
| 61 // pause/flush/seek. | 61 // pause/flush/seek. |
| 62 void GetCurrentFrame(scoped_refptr<VideoFrame>* frame_out); | 62 void GetCurrentFrame(scoped_refptr<VideoFrame>* frame_out); |
| 63 void PutCurrentFrame(scoped_refptr<VideoFrame> frame); | 63 void PutCurrentFrame(scoped_refptr<VideoFrame> frame); |
| 64 | 64 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 base::TimeDelta seek_timestamp_; | 206 base::TimeDelta seek_timestamp_; |
| 207 | 207 |
| 208 VideoDecoder::ReadCB read_cb_; | 208 VideoDecoder::ReadCB read_cb_; |
| 209 | 209 |
| 210 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); | 210 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); |
| 211 }; | 211 }; |
| 212 | 212 |
| 213 } // namespace media | 213 } // namespace media |
| 214 | 214 |
| 215 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 215 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
| OLD | NEW |