OLD | NEW |
1 // Copyright (c) 2010 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 // The video renderer implementation to be use by the media pipeline. It lives | 5 // The video renderer implementation to be use by the media pipeline. It lives |
6 // inside video renderer thread and also WebKit's main thread. We need to be | 6 // inside video renderer thread and also WebKit's main thread. We need to be |
7 // extra careful about members shared by two different threads, especially | 7 // extra careful about members shared by two different threads, especially |
8 // video frame buffers. | 8 // video frame buffers. |
9 | 9 |
10 #ifndef WEBKIT_GLUE_MEDIA_VIDEO_RENDERER_IMPL_H_ | 10 #ifndef WEBKIT_GLUE_MEDIA_VIDEO_RENDERER_IMPL_H_ |
11 #define WEBKIT_GLUE_MEDIA_VIDEO_RENDERER_IMPL_H_ | 11 #define WEBKIT_GLUE_MEDIA_VIDEO_RENDERER_IMPL_H_ |
(...skipping 11 matching lines...) Expand all Loading... |
23 namespace webkit_glue { | 23 namespace webkit_glue { |
24 | 24 |
25 class VideoRendererImpl : public WebVideoRenderer { | 25 class VideoRendererImpl : public WebVideoRenderer { |
26 public: | 26 public: |
27 explicit VideoRendererImpl(bool pts_logging); | 27 explicit VideoRendererImpl(bool pts_logging); |
28 virtual ~VideoRendererImpl(); | 28 virtual ~VideoRendererImpl(); |
29 | 29 |
30 // WebVideoRenderer implementation. | 30 // WebVideoRenderer implementation. |
31 virtual void SetWebMediaPlayerImplProxy(WebMediaPlayerImpl::Proxy* proxy); | 31 virtual void SetWebMediaPlayerImplProxy(WebMediaPlayerImpl::Proxy* proxy); |
32 virtual void SetRect(const gfx::Rect& rect); | 32 virtual void SetRect(const gfx::Rect& rect); |
33 virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect); | 33 virtual void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect); |
34 virtual void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out); | 34 virtual void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out); |
35 virtual void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame); | 35 virtual void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame); |
36 | 36 |
37 protected: | 37 protected: |
38 // Method called by VideoRendererBase during initialization. | 38 // Method called by VideoRendererBase during initialization. |
39 virtual bool OnInitialize(media::VideoDecoder* decoder); | 39 virtual bool OnInitialize(media::VideoDecoder* decoder); |
40 | 40 |
41 // Method called by the VideoRendererBase when stopping. | 41 // Method called by the VideoRendererBase when stopping. |
42 virtual void OnStop(media::FilterCallback* callback); | 42 virtual void OnStop(media::FilterCallback* callback); |
43 | 43 |
44 // Method called by the VideoRendererBase when a frame is available. | 44 // Method called by the VideoRendererBase when a frame is available. |
45 virtual void OnFrameAvailable(); | 45 virtual void OnFrameAvailable(); |
46 | 46 |
47 private: | 47 private: |
48 // Determine the conditions to perform fast paint. Returns true if we can do | 48 // Determine the conditions to perform fast paint. Returns true if we can do |
49 // fast paint otherwise false. | 49 // fast paint otherwise false. |
50 bool CanFastPaint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect); | 50 bool CanFastPaint(SkCanvas* canvas, const gfx::Rect& dest_rect); |
51 | 51 |
52 // Slow paint does a YUV => RGB, and scaled blit in two separate operations. | 52 // Slow paint does a YUV => RGB, and scaled blit in two separate operations. |
53 void SlowPaint(media::VideoFrame* video_frame, | 53 void SlowPaint(media::VideoFrame* video_frame, |
54 skia::PlatformCanvas* canvas, | 54 SkCanvas* canvas, |
55 const gfx::Rect& dest_rect); | 55 const gfx::Rect& dest_rect); |
56 | 56 |
57 // Fast paint does YUV => RGB, scaling, blitting all in one step into the | 57 // Fast paint does YUV => RGB, scaling, blitting all in one step into the |
58 // canvas. It's not always safe and appropriate to perform fast paint. | 58 // canvas. It's not always safe and appropriate to perform fast paint. |
59 // CanFastPaint() is used to determine the conditions. | 59 // CanFastPaint() is used to determine the conditions. |
60 void FastPaint(media::VideoFrame* video_frame, | 60 void FastPaint(media::VideoFrame* video_frame, |
61 skia::PlatformCanvas* canvas, | 61 SkCanvas* canvas, |
62 const gfx::Rect& dest_rect); | 62 const gfx::Rect& dest_rect); |
63 | 63 |
64 void TransformToSkIRect(const SkMatrix& matrix, const gfx::Rect& src_rect, | 64 void TransformToSkIRect(const SkMatrix& matrix, const gfx::Rect& src_rect, |
65 SkIRect* dest_rect); | 65 SkIRect* dest_rect); |
66 | 66 |
67 // Pointer to our parent object that is called to request repaints. | 67 // Pointer to our parent object that is called to request repaints. |
68 scoped_refptr<WebMediaPlayerImpl::Proxy> proxy_; | 68 scoped_refptr<WebMediaPlayerImpl::Proxy> proxy_; |
69 | 69 |
70 // An RGB bitmap used to convert the video frames. | 70 // An RGB bitmap used to convert the video frames. |
71 SkBitmap bitmap_; | 71 SkBitmap bitmap_; |
(...skipping 13 matching lines...) Expand all Loading... |
85 | 85 |
86 // Whether we're logging video presentation timestamps (PTS). | 86 // Whether we're logging video presentation timestamps (PTS). |
87 bool pts_logging_; | 87 bool pts_logging_; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); | 89 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); |
90 }; | 90 }; |
91 | 91 |
92 } // namespace webkit_glue | 92 } // namespace webkit_glue |
93 | 93 |
94 #endif // WEBKIT_GLUE_MEDIA_VIDEO_RENDERER_IMPL_H_ | 94 #endif // WEBKIT_GLUE_MEDIA_VIDEO_RENDERER_IMPL_H_ |
OLD | NEW |