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 #ifndef WEBKIT_MEDIA_VIDEO_RENDERER_IMPL_H_ | 5 #ifndef WEBKIT_MEDIA_VIDEO_RENDERER_IMPL_H_ |
6 #define WEBKIT_MEDIA_VIDEO_RENDERER_IMPL_H_ | 6 #define WEBKIT_MEDIA_VIDEO_RENDERER_IMPL_H_ |
7 | 7 |
8 #include "media/base/buffers.h" | 8 #include "media/base/buffers.h" |
9 #include "media/base/filters.h" | 9 #include "media/base/filters.h" |
10 #include "media/filters/video_renderer_base.h" | 10 #include "media/filters/video_renderer_base.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" |
| 12 #include "ui/gfx/rect.h" |
12 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
13 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
14 #include "webkit/media/web_video_renderer.h" | 15 |
| 16 class SkCanvas; |
15 | 17 |
16 namespace webkit_media { | 18 namespace webkit_media { |
17 | 19 |
| 20 class WebMediaPlayerProxy; |
| 21 |
18 // The video renderer implementation to be use by the media pipeline. It lives | 22 // The video renderer implementation to be use by the media pipeline. It lives |
19 // inside video renderer thread and also WebKit's main thread. We need to be | 23 // inside video renderer thread and also WebKit's main thread. We need to be |
20 // extra careful about members shared by two different threads, especially | 24 // extra careful about members shared by two different threads, especially |
21 // video frame buffers. | 25 // video frame buffers. |
22 class VideoRendererImpl : public WebVideoRenderer { | 26 class VideoRendererImpl : public media::VideoRendererBase { |
23 public: | 27 public: |
24 explicit VideoRendererImpl(bool pts_logging); | 28 explicit VideoRendererImpl(const scoped_refptr<WebMediaPlayerProxy>& proxy); |
25 virtual ~VideoRendererImpl(); | 29 virtual ~VideoRendererImpl(); |
26 | 30 |
27 // WebVideoRenderer implementation. | 31 // Paint the current front frame on the |canvas| stretching it to fit the |
28 virtual void SetWebMediaPlayerProxy(WebMediaPlayerProxy* proxy) OVERRIDE; | 32 // |dest_rect|. |
29 virtual void SetRect(const gfx::Rect& rect) OVERRIDE; | 33 // |
30 virtual void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect) OVERRIDE; | 34 // Method called on the render thread. |
| 35 void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect); |
31 | 36 |
32 protected: | 37 protected: |
33 // VideoRendererBase implementation. | 38 // VideoRendererBase implementation. |
34 virtual bool OnInitialize(media::VideoDecoder* decoder) OVERRIDE; | 39 virtual bool OnInitialize(media::VideoDecoder* decoder) OVERRIDE; |
35 virtual void OnStop(const base::Closure& callback) OVERRIDE; | 40 virtual void OnStop(const base::Closure& callback) OVERRIDE; |
36 virtual void OnFrameAvailable() OVERRIDE; | 41 virtual void OnFrameAvailable() OVERRIDE; |
37 | 42 |
38 private: | 43 private: |
39 // Determine the conditions to perform fast paint. Returns true if we can do | 44 // Determine the conditions to perform fast paint. Returns true if we can do |
40 // fast paint otherwise false. | 45 // fast paint otherwise false. |
(...skipping 23 matching lines...) Expand all Loading... |
64 // and it should be assumed that the value of the pointer is INVALID unless | 69 // and it should be assumed that the value of the pointer is INVALID unless |
65 // it matches the pointer returned from GetCurrentFrame(). Even then, just | 70 // it matches the pointer returned from GetCurrentFrame(). Even then, just |
66 // to make sure, we compare the timestamp to be sure the bits in the | 71 // to make sure, we compare the timestamp to be sure the bits in the |
67 // |current_frame_bitmap_| are valid. | 72 // |current_frame_bitmap_| are valid. |
68 media::VideoFrame* last_converted_frame_; | 73 media::VideoFrame* last_converted_frame_; |
69 base::TimeDelta last_converted_timestamp_; | 74 base::TimeDelta last_converted_timestamp_; |
70 | 75 |
71 // The natural size of the video. | 76 // The natural size of the video. |
72 gfx::Size natural_size_; | 77 gfx::Size natural_size_; |
73 | 78 |
74 // Whether we're logging video presentation timestamps (PTS). | |
75 bool pts_logging_; | |
76 | |
77 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); | 79 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); |
78 }; | 80 }; |
79 | 81 |
80 } // namespace webkit_media | 82 } // namespace webkit_media |
81 | 83 |
82 #endif // WEBKIT_MEDIA_VIDEO_RENDERER_IMPL_H_ | 84 #endif // WEBKIT_MEDIA_VIDEO_RENDERER_IMPL_H_ |
OLD | NEW |