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 #ifndef MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 5 #ifndef MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
6 #define MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 6 #define MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // instead post a task to a common/worker thread to handle rendering. Slowing | 38 // instead post a task to a common/worker thread to handle rendering. Slowing |
39 // down the video thread may result in losing synchronization with audio. | 39 // down the video thread may result in losing synchronization with audio. |
40 // | 40 // |
41 // Setting |drop_frames_| to true causes the renderer to drop expired frames. | 41 // Setting |drop_frames_| to true causes the renderer to drop expired frames. |
42 // | 42 // |
43 // TODO(scherkus): pass the VideoFrame* to this callback and remove | 43 // TODO(scherkus): pass the VideoFrame* to this callback and remove |
44 // Get/PutCurrentFrame() http://crbug.com/108435 | 44 // Get/PutCurrentFrame() http://crbug.com/108435 |
45 VideoRendererBase(const base::Closure& paint_cb, | 45 VideoRendererBase(const base::Closure& paint_cb, |
46 const SetOpaqueCB& set_opaque_cb, | 46 const SetOpaqueCB& set_opaque_cb, |
47 bool drop_frames); | 47 bool drop_frames); |
48 virtual ~VideoRendererBase(); | |
49 | 48 |
50 // Filter implementation. | 49 // Filter implementation. |
51 virtual void Play(const base::Closure& callback) OVERRIDE; | 50 virtual void Play(const base::Closure& callback) OVERRIDE; |
52 virtual void Pause(const base::Closure& callback) OVERRIDE; | 51 virtual void Pause(const base::Closure& callback) OVERRIDE; |
53 virtual void Flush(const base::Closure& callback) OVERRIDE; | 52 virtual void Flush(const base::Closure& callback) OVERRIDE; |
54 virtual void Stop(const base::Closure& callback) OVERRIDE; | 53 virtual void Stop(const base::Closure& callback) OVERRIDE; |
55 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; | 54 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; |
56 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; | 55 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; |
57 | 56 |
58 // VideoRenderer implementation. | 57 // VideoRenderer implementation. |
59 virtual void Initialize(const scoped_refptr<VideoDecoder>& decoder, | 58 virtual void Initialize(const scoped_refptr<VideoDecoder>& decoder, |
60 const PipelineStatusCB& status_cb, | 59 const PipelineStatusCB& status_cb, |
61 const StatisticsCB& statistics_cb, | 60 const StatisticsCB& statistics_cb, |
62 const TimeCB& time_cb) OVERRIDE; | 61 const TimeCB& time_cb) OVERRIDE; |
63 virtual bool HasEnded() OVERRIDE; | 62 virtual bool HasEnded() OVERRIDE; |
64 | 63 |
65 // PlatformThread::Delegate implementation. | 64 // PlatformThread::Delegate implementation. |
66 virtual void ThreadMain() OVERRIDE; | 65 virtual void ThreadMain() OVERRIDE; |
67 | 66 |
68 // Clients of this class (painter/compositor) should use GetCurrentFrame() | 67 // Clients of this class (painter/compositor) should use GetCurrentFrame() |
69 // obtain ownership of VideoFrame, it should always relinquish the ownership | 68 // obtain ownership of VideoFrame, it should always relinquish the ownership |
70 // by use PutCurrentFrame(). Current frame is not guaranteed to be non-NULL. | 69 // by use PutCurrentFrame(). Current frame is not guaranteed to be non-NULL. |
71 // It expects clients to use color-fill the background if current frame | 70 // It expects clients to use color-fill the background if current frame |
72 // is NULL. This could happen before pipeline is pre-rolled or during | 71 // is NULL. This could happen before pipeline is pre-rolled or during |
73 // pause/flush/seek. | 72 // pause/flush/seek. |
74 void GetCurrentFrame(scoped_refptr<VideoFrame>* frame_out); | 73 void GetCurrentFrame(scoped_refptr<VideoFrame>* frame_out); |
75 void PutCurrentFrame(scoped_refptr<VideoFrame> frame); | 74 void PutCurrentFrame(scoped_refptr<VideoFrame> frame); |
76 | 75 |
| 76 protected: |
| 77 virtual ~VideoRendererBase(); |
| 78 |
77 private: | 79 private: |
78 // Callback from the video decoder delivering decoded video frames and | 80 // Callback from the video decoder delivering decoded video frames and |
79 // reporting video decoder status. | 81 // reporting video decoder status. |
80 void FrameReady(VideoDecoder::DecoderStatus status, | 82 void FrameReady(VideoDecoder::DecoderStatus status, |
81 scoped_refptr<VideoFrame> frame); | 83 scoped_refptr<VideoFrame> frame); |
82 | 84 |
83 // Helper method that schedules an asynchronous read from the decoder as long | 85 // Helper method that schedules an asynchronous read from the decoder as long |
84 // as there isn't a pending read and we have capacity. | 86 // as there isn't a pending read and we have capacity. |
85 void AttemptRead_Locked(); | 87 void AttemptRead_Locked(); |
86 | 88 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Callback to execute to inform the player if the video decoder's output is | 209 // Callback to execute to inform the player if the video decoder's output is |
208 // opaque. | 210 // opaque. |
209 SetOpaqueCB set_opaque_cb_; | 211 SetOpaqueCB set_opaque_cb_; |
210 | 212 |
211 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); | 213 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); |
212 }; | 214 }; |
213 | 215 |
214 } // namespace media | 216 } // namespace media |
215 | 217 |
216 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 218 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
OLD | NEW |