Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Unified Diff: content/port/browser/render_widget_host_view_frame_subscriber.h

Issue 12277023: Define frame subscription interface and implementation on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git fetch Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..de1ee089a1ee234200c67bddb52c55009f5a2178
--- /dev/null
+++ b/content/port/browser/render_widget_host_view_frame_subscriber.h
@@ -0,0 +1,70 @@
+// 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 color space conversion)
+// through this interface. See ShouldCaptureFrame() for details.
+//
+// It is platform dependent which thread this object lives on, but it is
+// guaranteed to be used on a single thread.
+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(
+ base::Time /* timestamp */,
+ bool /* frame_captured */)> DeliverFrameCallback;
+
+ // Called when a new frame is going to be presented. Implementation can
+ // decide whether the current frame should be captured or not.
+ //
+ // 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. The platform presenter will perform scaling
+ // and color space conversion to fit into the output frame.
+ //
+ // Destination format is determined by |storage|, currently only
+ // media::VideoFrame::YV12 is supported. Platform layer will perform color
+ // space conversion if needed.
+ //
+ // 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(
+ scoped_refptr<media::VideoFrame>* storage,
+ DeliverFrameCallback* callback) = 0;
+};
+
+} // namespace content
+
+#endif // CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | content/port/browser/render_widget_host_view_port.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698