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

Side by Side Diff: remoting/host/video_frame_capturer.h

Issue 10696134: remoting/host: Rename Capturer to VideoFrameCapturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 REMOTING_HOST_VIDEO_FRAME_CAPTURER_H_
6 #define REMOTING_HOST_VIDEO_FRAME_CAPTURER_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/callback.h"
11 #include "media/base/video_frame.h"
12 #include "third_party/skia/include/core/SkRegion.h"
13
14 namespace remoting {
15
16 namespace protocol {
17 class CursorShapeInfo;
18 }
19
20 class CaptureData;
21
22 // A class to perform the task of capturing the image of a window.
23 // The capture action is asynchronous to allow maximum throughput.
24 //
25 // The full capture process is as follows:
26 //
27 // (1) Start
28 // This is when pre-capture steps are executed, such as flagging the
29 // display to prevent it from sleeping during a session.
30 //
31 // (2) InvalidateRects
32 // This is an optional step where regions of the screen are marked as
33 // invalid. Some platforms (Windows, for now) won't use this and will
34 // instead calculate the diff-regions later (in step (2). Other
35 // platforms (Mac) will use this to mark all the changed regions of the
36 // screen. Some limited rect-merging (e.g., to eliminate exact
37 // duplicates) may be done here.
38 //
39 // (3) CaptureInvalidRects
40 // This is where the bits for the invalid rects are packaged up and sent
41 // to the encoder.
42 // A screen capture is performed if needed. For example, Windows requires
43 // a capture to calculate the diff from the previous screen, whereas the
44 // Mac version does not.
45 //
46 // (4) Stop
47 // This is when post-capture steps are executed, such as releasing the
48 // assertion that prevents the display from sleeping.
49 //
50 // Implementation has to ensure the following guarantees:
51 // 1. Double buffering
52 // Since data can be read while another capture action is happening.
53 class VideoFrameCapturer {
54 public:
55 // CaptureCompletedCallback is called when the capturer has completed.
56 typedef base::Callback<void(scoped_refptr<CaptureData>)>
57 CaptureCompletedCallback;
58
59 // CursorShapeChangedCallback is called when the cursor shape has changed.
60 typedef base::Callback<void(scoped_ptr<protocol::CursorShapeInfo>)>
61 CursorShapeChangedCallback;
62
63 virtual ~VideoFrameCapturer() {}
64
65 // Create platform-specific capturer.
66 static VideoFrameCapturer* Create();
67
68 #if defined(OS_LINUX)
69 // Set whether the VideoFrameCapturer should try to use X DAMAGE support if it
70 // is available. This needs to be called before the VideoFrameCapturer is
71 // created.
72 // This is used by the Virtual Me2Me host, since the XDamage extension is
73 // known to work reliably in this case.
74
75 // TODO(lambroslambrou): This currently sets a global flag, referenced during
76 // VideoFrameCapturer::Create(). This is a temporary solution, until the
77 // DesktopEnvironment class is refactored to allow applications to control
78 // the creation of various stubs (including the VideoFrameCapturer) - see
79 // http://crbug.com/104544
80 static void EnableXDamage(bool enable);
81 #endif // defined(OS_LINUX)
82
83 // Called at the beginning of a capturing session.
84 virtual void Start(
85 const CursorShapeChangedCallback& callback) = 0;
86
87 // Called at the end of a capturing session.
88 virtual void Stop() = 0;
89
90 // Called when the screen configuration is changed.
91 virtual void ScreenConfigurationChanged() = 0;
92
93 // Return the pixel format of the screen.
94 virtual media::VideoFrame::Format pixel_format() const = 0;
95
96 // Clear out the invalid region.
97 virtual void ClearInvalidRegion() = 0;
98
99 // Invalidate the specified region.
100 virtual void InvalidateRegion(const SkRegion& invalid_region) = 0;
101
102 // Invalidate the entire screen, of a given size.
103 virtual void InvalidateScreen(const SkISize& size) = 0;
104
105 // Invalidate the entire screen, using the size of the most recently
106 // captured screen.
107 virtual void InvalidateFullScreen() = 0;
108
109 // Capture the screen data associated with each of the accumulated
110 // dirty region.
111 // When the capture is complete, |callback| is called even if the dirty region
112 // is empty.
113 //
114 // It is OK to call this method while another thread is reading
115 // data of the previous capture.
116 // There can be at most one concurrent read going on when this
117 // method is called.
118 virtual void CaptureInvalidRegion(
119 const CaptureCompletedCallback& callback) = 0;
120
121 // Get the size of the most recently captured screen.
122 virtual const SkISize& size_most_recent() const = 0;
123 };
124
125 } // namespace remoting
126
127 #endif // REMOTING_HOST_VIDEO_FRAME_CAPTURER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698