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