OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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_COMMON_GPU_SURFACE_CAPTURER_H_ | |
6 #define CONTENT_COMMON_GPU_SURFACE_CAPTURER_H_ | |
7 | |
8 #include "content/common/content_export.h" | |
9 #include "media/base/video_frame.h" | |
10 | |
11 namespace gfx { | |
12 | |
13 class Size; | |
14 class Rect; | |
15 | |
16 }; // namespace ui | |
Pawel Osciak
2013/08/24 01:29:31
s/;//
sheu
2013/08/26 21:30:52
Done.
| |
17 | |
18 namespace content { | |
19 | |
20 // Surface capturer interface. This interface is implemented by classes | |
21 // that perform image capturing from the backbuffer. | |
22 class CONTENT_EXPORT SurfaceCapturer { | |
23 public: | |
24 enum Error { | |
25 // Invalid argument was passed to an API method. | |
26 kInvalidArgumentError, | |
27 // A failure occurred at the GPU process or one of its dependencies. | |
28 // Examples of such failures include GPU hardware failures, GPU driver | |
29 // failures, GPU library failures, GPU process programming errors, and so | |
30 // on. | |
31 kPlatformFailureError, | |
32 }; | |
33 | |
34 class CONTENT_EXPORT Client { | |
35 public: | |
36 // Callback to notify client of parameters of the backbuffer capture. Every | |
37 // time the Client receives this callback, subsequent media::VideoFrames | |
38 // passed to Capture() should mind the new parameters. | |
Pawel Osciak
2013/08/24 01:29:31
s/Capture()/CopyCaptureToVideoFrame()/ ?
But perso
sheu
2013/08/26 21:30:52
I wanted to make the two-stage nature of the captu
| |
39 // Parameters: | |
40 // |buffer_size| is the required logical size (in pixels) of the buffer | |
41 // to capture to (corresponds to |frame->coded_size()| from in Capture(). | |
Pawel Osciak
2013/08/24 01:29:31
s/from//
sheu
2013/08/26 21:30:52
Done.
| |
42 // |visible_rect| is the visible subrect of the actual screen capture | |
43 // contents in the buffer to capture to (corresponds to | |
44 // |frame->visible_rect()| in Capture(). | |
45 virtual void NotifyCaptureParameters(const gfx::Size& buffer_size, | |
46 const gfx::Rect& visible_rect) = 0; | |
47 | |
48 // Callback to notify client that CopyCaptureToVideoFrame() has been | |
49 // completed for |frame|. After this call, the capturer will drop all its | |
50 // outstanding references to |frame|. | |
51 // Parameters: | |
52 // |frame| is the completed copied captured frame. | |
53 virtual void NotifyCopyCaptureDone( | |
Pawel Osciak
2013/08/24 01:29:31
NotifyFrameReady?
sheu
2013/08/26 21:30:52
I'd like the notification name to reflect the API
| |
54 const scoped_refptr<media::VideoFrame>& frame) = 0; | |
55 | |
56 // Error notification callback. | |
57 // Parameters: | |
58 // |error| is the error to report. | |
59 virtual void NotifyError(Error error) = 0; | |
60 | |
61 protected: | |
62 // Clients are not owned by Capturer instances and should not be deleted | |
63 // through these pointers. | |
64 virtual ~Client() {} | |
65 }; | |
66 | |
67 // Initialize the capturer to a specific configuration. | |
68 // Parameters: | |
69 // |format| is the format to capture to (corresponds to |frame->format()| in | |
70 // Capture()). | |
71 virtual void Initialize(media::VideoFrame::Format format) = 0; | |
Pawel Osciak
2013/08/24 01:29:31
I'm assuming NotifyError() if the format is unsupp
sheu
2013/08/26 21:30:52
Done.
| |
72 | |
73 // Attempt to capture a frame. This call is advisory to note to the | |
74 // SurfaceCapturer that capture should be attempted at this time; success is | |
75 // not guaranteed. The most recent captured frame is cached internally, and | |
76 // its contents returned every time CopyCaptureToVideoFrame() is called. | |
77 virtual void TryCapture() = 0; | |
Pawel Osciak
2013/08/24 01:29:31
You mean this starts capturing frames continuously
sheu
2013/08/26 21:30:52
This callback makes one frame capture attempt. Up
| |
78 | |
79 // Copy the most recent captured contents to |frame|. | |
80 // Parameters: | |
81 // |frame| is the media::VideoFrame to fill with captured contents. | |
82 virtual void CopyCaptureToVideoFrame( | |
Pawel Osciak
2013/08/24 01:29:31
What happens on error? I assume we get NotifyError
sheu
2013/08/26 21:30:52
We should be getting NotifyError always on error c
| |
83 const scoped_refptr<media::VideoFrame>& frame) = 0; | |
84 | |
85 // Destroys the capturer; all pending inputs and outputs are dropped | |
86 // immediately and the component is freed. This call may asynchronously free | |
87 // system resources, but its client-visible effects are synchronous. After | |
88 // this method returns no more callbacks will be made on the client. Deletes | |
89 // |this| unconditionally, so make sure to drop all pointers to it! | |
90 virtual void Destroy() = 0; | |
91 | |
92 virtual ~SurfaceCapturer(); | |
93 }; | |
94 | |
95 } // namespace content | |
96 | |
97 #endif // CONTENT_COMMON_GPU_SURFACE_CAPTURER_H_ | |
OLD | NEW |