Chromium Code Reviews| Index: content/port/browser/render_widget_host_view_frame_subscriber.h |
| diff --git a/content/port/browser/render_widget_host_view_frame_subscriber.h b/content/port/browser/render_widget_host_view_frame_subscriber.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c3c21334e6def3c055f0f42f114b3fb7c9c95df4 |
| --- /dev/null |
| +++ b/content/port/browser/render_widget_host_view_frame_subscriber.h |
| @@ -0,0 +1,75 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ |
| +#define CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/time.h" |
| + |
| +namespace gfx { |
| +class Rect; |
| +class Size; |
| +} // namespace gfx |
| + |
| +namespace media { |
| +class VideoFrame; |
| +} // namespace media |
| + |
| +namespace content { |
| + |
| +// Defines an interface for listening to events of frame presentation and to |
| +// instruct the platform layer (i.e. RenderWidgetHostViewPort) to copy a frame. |
| +// |
| +// Further processing is possible (e.g. scale and clip) through this |
| +// interface. See ShouldCaptureFrame() for details. |
| +// |
| +// Objects of this class live on the UI thread. |
|
piman
2013/02/22 20:45:47
How will this work on non-aura windows?
Alpha Left Google
2013/02/22 21:05:38
Present has to go through UI thread somehow, we pl
piman
2013/02/22 21:18:54
No, it doesn't in the general case. On windows, th
|
| +class RenderWidgetHostViewFrameSubscriber { |
| + public: |
| + virtual ~RenderWidgetHostViewFrameSubscriber() {} |
| + |
| + // Called when a captured frame is available or the frame is no longer |
| + // needed by the platform layer. |
| + // |
| + // If |frame_captured| is true then frame provided contains valid content and |
| + // |timestamp| is the time when the frame was painted. |
| + // |
| + // If |frame_captured| is false then the content in frame provided is |
| + // invalid. There was an error during the process of frame capture or the |
| + // platform layer is shutting down. |timestamp| is also invalid in this case. |
| + typedef base::Callback<void( |
| + bool /* frame_captured */, |
| + base::Time /* timestamp */)> DeliverFrameCallback; |
| + |
| + // Called when a new frame is going to be presented. Implementation can |
| + // decide whether the current frame should be captured or not. Frame size |
| + // is given such that implementor can choose to apply scaling and clipping |
| + // to the frame captured. |src_size| is the size of the frame going to be |
| + // presented, |src_subrect| will be set to choose clipping rectangle and |
| + // |dst_subrect| will be set to choose destination rectangle. |
| + // |
| + // Return true if the current frame should be captured. If so, |storage| |
| + // should will be set to hold an appropriately sized and allocated buffer |
| + // into which to copy the frame. |
| + // |
| + // Destination format is determined by |storage|, currently only |
| + // media::VideoFrame::YV12 is supported. Platform layer will perform color |
| + // space conversion if needed. |
|
piman
2013/02/22 20:45:47
So, that leaves the RWHV responsible for doing the
Alpha Left Google
2013/02/22 21:05:38
Without our team we went back and forth with this.
piman
2013/02/22 21:18:54
"simplyfy" = maybe for you, but really it means mo
|
| + // |
| + // When the frame is available |callback| will be called. It is up to the |
| + // platform layer to decide when to deliver a captured frame. |
| + // |
| + // Return false if the current frame should not be captured. |
| + virtual bool ShouldCaptureFrame( |
| + const gfx::Size& src_size, |
| + gfx::Rect* src_subrect, |
| + gfx::Rect* dst_subrect, |
|
piman
2013/02/22 20:45:47
do we really need dst_subrect, or simply dst_size?
Alpha Left Google
2013/02/22 21:05:38
Yes because of letter boxing. Implementation of Fr
piman
2013/02/22 21:18:54
Not sure I understand... why would we want to carr
|
| + scoped_refptr<media::VideoFrame>* storage, |
| + DeliverFrameCallback* callback) = 0; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ |