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

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

Issue 12047101: Move screen capturers from remoting/capturer to media/video/capturer/screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/capturer/video_frame.cc ('k') | remoting/capturer/video_frame_capturer_fake.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CAPTURER_VIDEO_FRAME_CAPTURER_H_
6 #define REMOTING_CAPTURER_VIDEO_FRAME_CAPTURER_H_
7
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "base/shared_memory.h"
11 #include "third_party/skia/include/core/SkRegion.h"
12
13 namespace remoting {
14
15 class CaptureData;
16 struct MouseCursorShape;
17 class SharedBufferFactory;
18
19 // Class used to capture video frames asynchronously.
20 //
21 // The full capture sequence is as follows:
22 //
23 // (1) Start
24 // This is when pre-capture steps are executed, such as flagging the
25 // display to prevent it from sleeping during a session.
26 //
27 // (2) InvalidateRegion
28 // This is an optional step where regions of the screen are marked as
29 // invalid. Some platforms (Windows, for now) won't use this and will
30 // instead calculate the diff-regions later (in step (2). Other
31 // platforms (Mac) will use this to mark all the changed regions of the
32 // screen. Some limited rect-merging (e.g., to eliminate exact
33 // duplicates) may be done here.
34 //
35 // (3) CaptureFrame
36 // This is where the bits for the invalid rects are packaged up and sent
37 // to the encoder.
38 // A screen capture is performed if needed. For example, Windows requires
39 // a capture to calculate the diff from the previous screen, whereas the
40 // Mac version does not.
41 //
42 // (4) Stop
43 // This is when post-capture steps are executed, such as releasing the
44 // assertion that prevents the display from sleeping.
45 //
46 // Implementation has to ensure the following guarantees:
47 // 1. Double buffering
48 // Since data can be read while another capture action is happening.
49 class VideoFrameCapturer {
50 public:
51 // Provides callbacks used by the capturer to pass captured video frames and
52 // mouse cursor shapes to the processing pipeline.
53 class Delegate {
54 public:
55 // Called when a video frame has been captured. |capture_data| describes
56 // a captured frame.
57 virtual void OnCaptureCompleted(
58 scoped_refptr<CaptureData> capture_data) = 0;
59
60 // Called when the cursor shape has changed.
61 // TODO(sergeyu): Move cursor shape capturing to a separate class.
62 virtual void OnCursorShapeChanged(
63 scoped_ptr<MouseCursorShape> cursor_shape) = 0;
64
65 protected:
66 virtual ~Delegate() {}
67 };
68
69 virtual ~VideoFrameCapturer() {}
70
71 // Create platform-specific capturer.
72 static scoped_ptr<VideoFrameCapturer> Create();
73
74 // Create platform-specific capturer that uses shared memory buffers.
75 static scoped_ptr<VideoFrameCapturer> CreateWithFactory(
76 SharedBufferFactory* shared_buffer_factory);
77
78 #if defined(OS_LINUX)
79 // Set whether the VideoFrameCapturer should try to use X DAMAGE support if it
80 // is available. This needs to be called before the VideoFrameCapturer is
81 // created.
82 // This is used by the Virtual Me2Me host, since the XDamage extension is
83 // known to work reliably in this case.
84
85 // TODO(lambroslambrou): This currently sets a global flag, referenced during
86 // VideoFrameCapturer::Create(). This is a temporary solution, until the
87 // DesktopEnvironment class is refactored to allow applications to control
88 // the creation of various stubs (including the VideoFrameCapturer) - see
89 // http://crbug.com/104544
90 static void EnableXDamage(bool enable);
91 #endif // defined(OS_LINUX)
92
93 // Called at the beginning of a capturing session. |delegate| must remain
94 // valid until Stop() is called.
95 virtual void Start(Delegate* delegate) = 0;
96
97 // Called at the end of a capturing session.
98 virtual void Stop() = 0;
99
100 // Invalidates the specified region.
101 virtual void InvalidateRegion(const SkRegion& invalid_region) = 0;
102
103 // Captures the screen data associated with each of the accumulated
104 // dirty region. When the capture is complete, the delegate is notified even
105 // if the dirty region is empty.
106 //
107 // It is OK to call this method while another thread is reading
108 // data of the previous capture. There can be at most one concurrent read
109 // going on when this method is called.
110 virtual void CaptureFrame() = 0;
111 };
112
113 } // namespace remoting
114
115 #endif // REMOTING_CAPTURER_VIDEO_FRAME_CAPTURER_H_
OLDNEW
« no previous file with comments | « remoting/capturer/video_frame.cc ('k') | remoting/capturer/video_frame_capturer_fake.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698