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

Unified Diff: content/common/gpu/surface_capturer.h

Issue 22935009: Add content::SurfaceCapturer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screencast_stride
Patch Set: cff149b4 WIP Created 7 years, 4 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/common/gpu/surface_capturer.h
diff --git a/content/common/gpu/surface_capturer.h b/content/common/gpu/surface_capturer.h
new file mode 100644
index 0000000000000000000000000000000000000000..52ab5df624e303ea1017ce789b0ca626ec0e0188
--- /dev/null
+++ b/content/common/gpu/surface_capturer.h
@@ -0,0 +1,82 @@
+// Copyright (c) 2013 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_COMMON_GPU_SURFACE_CAPTURER_H_
+#define CONTENT_COMMON_GPU_SURFACE_CAPTURER_H_
+
+#include "content/common/content_export.h"
+#include "media/base/video_frame.h"
+
+namespace gfx {
+
+class Size;
+class Rect;
+
+}; // namespace ui
+
+namespace content {
+
+// Surface capturer interface. This interface is implemented by classes
+// that perform image capturing from the backbuffer.
+class CONTENT_EXPORT SurfaceCapturer {
+ public:
+ enum Error {
+ // Invalid argument was passed to an API method.
+ kInvalidArgumentError,
+ // A failure occurred at the GPU process or one of its dependencies.
+ // Examples of such failures include GPU hardware failures, GPU driver
+ // failures, GPU library failures, GPU process programming errors, and so
+ // on.
+ kPlatformFailureError,
+ };
+
+ class CONTENT_EXPORT Client {
+ public:
+ // Callback to notify client of parameters of the backbuffer capture. Every
+ // time the Client receivce this callback, subsequent media::VideoFrames
+ // passed to Capture() should mind the new parameters.
+ // Parameters:
+ // |buffer_size| is the required logical size (in pixels) of the buffer
+ // to capture to (corresponds to |frame->coded_size()| from in Capture().
+ // |visible_rect| is the visible subrect of the actual screen capture
+ // contents in the buffer to capture to (corresponds to
+ // |frame->visible_rect()| in Capture().
+ virtual void NotifyCaptureParameters(const gfx::Size& buffer_size,
+ const gfx::Rect& visible_rect) = 0;
+
+ // Error notification callback.
+ // Parameters:
+ // |error| is the error to report.
+ virtual void NotifyError(Error error) = 0;
+
+ protected:
+ // Clients are not owned by Capturer instances and should not be deleted
+ // through these pointers.
+ virtual ~Client() {}
+ };
+
+ // Initialize the capturer to a specific configuration.
+ // Parameters:
+ // |format| is the format to capture to (corresponds to |frame->format()| in
+ // Capture()).
+ virtual void Initialize(media::VideoFrame::Format format) = 0;
+
+ // Capture a frame.
+ // Parameters:
+ // |frame| is the frame holding the buffer to capture to.
+ virtual void Capture(const scoped_refptr<media::VideoFrame>& frame) = 0;
+
+ // Destroys the capturer; all pending inputs and outputs are dropped
+ // immediately and the component is freed. This call may asynchronously free
+ // system resources, but its client-visible effects are synchronous. After
+ // this method returns no more callbacks will be made on the client. Deletes
+ // |this| unconditionally, so make sure to drop all pointers to it!
+ virtual void Destroy() = 0;
+
+ virtual ~SurfaceCapturer();
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_GPU_SURFACE_CAPTURER_H_

Powered by Google App Engine
This is Rietveld 408576698