Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ | |
| 6 #define CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ | |
| 7 | |
| 8 #include "base/time.h" | |
| 9 | |
| 10 namespace gfx { | |
| 11 class Rect; | |
| 12 class Size; | |
| 13 } // namespace gfx | |
| 14 | |
| 15 namespace media { | |
| 16 class VideoFrame; | |
| 17 } // namespace media | |
| 18 | |
| 19 namespace content { | |
| 20 | |
| 21 // Defines an interface for listening to events of frame presentation | |
| 22 // and to instruct the platform layer (i.e. RenderWidgetHostViewPort) to | |
| 23 // copy a frame. | |
| 24 // | |
| 25 // Further processing is possible (e.g. scale and clip) through this | |
| 26 // interface. See ShouldCaptureFrame() for details. | |
| 27 class RenderWidgetHostViewFrameSubscriber { | |
| 28 public: | |
| 29 virtual ~RenderWidgetHostViewFrameSubscriber() {} | |
| 30 | |
| 31 // Called when a new frame is going to be presented. Implementation can | |
| 32 // decide whether the current frame should be captured or not. Frame size | |
| 33 // is given such that implementor can choose to apply scaling and clipping | |
| 34 // to the frame captured. |src_size| is the size of the frame going to | |
| 35 // be presented, |src_subrect| will be set to choose clipping rectangle | |
| 36 // and |dst_subrect| will be set to choose destination rectangle. | |
| 37 // | |
| 38 // Return true if the current frame should be captured. If so, |storage| | |
| 39 // should will be set to hold an appropriately sized and allocated buffer | |
| 40 // into which to copy the frame. | |
| 41 // | |
| 42 // Destination format is determined by |storage|, currently only | |
| 43 // media::VideoFrame::RGB32 and media::VideoFrame::YV12 are supported. | |
|
ncarter (slow)
2013/02/16 02:45:22
Why support RGB32 destinations? Who is that for?
Alpha Left Google
2013/02/20 21:34:50
Dropped RGB32, we'll do YV12 in SW as fallback for
| |
| 44 // Platform layer will perform color space conversion if needed. | |
| 45 // | |
| 46 // Return false if the current frame should not be captured. | |
| 47 virtual bool ShouldCaptureFrame( | |
| 48 const gfx::Size& src_size, | |
| 49 gfx::Rect* src_subrect, | |
| 50 gfx::Rect* dst_subrect, | |
| 51 scoped_refptr<media::VideoFrame>* storage) = 0; | |
| 52 | |
| 53 // Called when a frame is captured. |frame| contains the content of | |
| 54 // a frame presented at time |timestamp| and ownership is transferred to | |
| 55 // the subscriber. | |
| 56 virtual void FrameCaptured( | |
| 57 const scoped_refptr<media::VideoFrame>& frame, | |
| 58 base::Time timestamp) = 0; | |
|
ncarter (slow)
2013/02/16 02:45:22
What happens in the event of errors? Seems like th
Alpha Left Google
2013/02/20 21:34:50
I've changed this interface to accept a boolean. T
| |
| 59 }; | |
| 60 | |
| 61 } // namespace content | |
| 62 | |
| 63 #endif // CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ | |
| OLD | NEW |