| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_GLUE_MEDIA_WEB_VIDEO_RENDERER_H_ | 5 #ifndef WEBKIT_GLUE_MEDIA_WEB_VIDEO_RENDERER_H_ |
| 6 #define WEBKIT_GLUE_MEDIA_WEB_VIDEO_RENDERER_H_ | 6 #define WEBKIT_GLUE_MEDIA_WEB_VIDEO_RENDERER_H_ |
| 7 | 7 |
| 8 #include "media/base/video_frame.h" |
| 8 #include "media/filters/video_renderer_base.h" | 9 #include "media/filters/video_renderer_base.h" |
| 9 | 10 |
| 10 namespace webkit_glue { | 11 namespace webkit_glue { |
| 11 | 12 |
| 12 // A specialized version of a VideoRenderer designed to be used inside WebKit. | 13 // A specialized version of a VideoRenderer designed to be used inside WebKit. |
| 13 class WebVideoRenderer : public media::VideoRendererBase { | 14 class WebVideoRenderer : public media::VideoRendererBase { |
| 14 public: | 15 public: |
| 15 WebVideoRenderer() : media::VideoRendererBase() {} | 16 WebVideoRenderer() : media::VideoRendererBase() {} |
| 16 virtual ~WebVideoRenderer() {} | 17 virtual ~WebVideoRenderer() {} |
| 17 | 18 |
| 18 // This method is called with the same rect as the Paint() method and could | 19 // This method is called with the same rect as the Paint() method and could |
| 19 // be used by future implementations to implement an improved color space + | 20 // be used by future implementations to implement an improved color space + |
| 20 // scale code on a separate thread. Since we always do the stretch on the | 21 // scale code on a separate thread. Since we always do the stretch on the |
| 21 // same thread as the Paint method, we just ignore the call for now. | 22 // same thread as the Paint method, we just ignore the call for now. |
| 22 // | 23 // |
| 23 // Method called on the render thread. | 24 // Method called on the render thread. |
| 24 virtual void SetRect(const gfx::Rect& rect) = 0; | 25 virtual void SetRect(const gfx::Rect& rect) = 0; |
| 25 | 26 |
| 26 // Paint the current front frame on the |canvas| stretching it to fit the | 27 // Paint the current front frame on the |canvas| stretching it to fit the |
| 27 // |dest_rect|. | 28 // |dest_rect|. |
| 28 // | 29 // |
| 29 // Method called on the render thread. | 30 // Method called on the render thread. |
| 30 virtual void Paint(skia::PlatformCanvas* canvas, | 31 virtual void Paint(skia::PlatformCanvas* canvas, |
| 31 const gfx::Rect& dest_rect) = 0; | 32 const gfx::Rect& dest_rect) = 0; |
| 32 | 33 |
| 34 // Clients of this class (painter/compositor) should use GetCurrentFrame() |
| 35 // obtain ownership of VideoFrame, it should always relinquish the ownership |
| 36 // by use PutCurrentFrame(). Current frame is not guaranteed to be non-NULL. |
| 37 // It expects clients to use color-fill the background if current frame |
| 38 // is NULL. This could happen when before pipeline is pre-rolled or during |
| 39 // pause/flush/seek. |
| 40 virtual void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out) {} |
| 41 virtual void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame) {} |
| 42 |
| 33 private: | 43 private: |
| 34 DISALLOW_COPY_AND_ASSIGN(WebVideoRenderer); | 44 DISALLOW_COPY_AND_ASSIGN(WebVideoRenderer); |
| 35 }; | 45 }; |
| 36 | 46 |
| 37 } // namespace webkit_glue | 47 } // namespace webkit_glue |
| 38 | 48 |
| 39 #endif // WEBKIT_GLUE_MEDIA_WEB_VIDEO_RENDERER_H_ | 49 #endif // WEBKIT_GLUE_MEDIA_WEB_VIDEO_RENDERER_H_ |
| OLD | NEW |