OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_HOST_CAPTURER_H_ | 5 #ifndef REMOTING_HOST_CAPTURER_H_ |
6 #define REMOTING_HOST_CAPTURER_H_ | 6 #define REMOTING_HOST_CAPTURER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "remoting/base/capture_data.h" | 10 #include "media/base/video_frame.h" |
11 #include "third_party/skia/include/core/SkRegion.h" | 11 #include "third_party/skia/include/core/SkRegion.h" |
12 | 12 |
13 namespace remoting { | 13 namespace remoting { |
14 | 14 |
15 class CaptureData; | |
16 class CursorShapeData; | |
17 | |
15 // A class to perform the task of capturing the image of a window. | 18 // A class to perform the task of capturing the image of a window. |
16 // The capture action is asynchronous to allow maximum throughput. | 19 // The capture action is asynchronous to allow maximum throughput. |
17 // | 20 // |
18 // The full capture process is as follows: | 21 // The full capture process is as follows: |
19 // | 22 // |
20 // (1) Start | 23 // (1) Start |
21 // This is when pre-capture steps are executed, such as flagging the | 24 // This is when pre-capture steps are executed, such as flagging the |
22 // display to prevent it from sleeping during a session. | 25 // display to prevent it from sleeping during a session. |
23 // | 26 // |
24 // (2) InvalidateRects | 27 // (2) InvalidateRects |
(...skipping 17 matching lines...) Expand all Loading... | |
42 // | 45 // |
43 // Implementation has to ensure the following guarantees: | 46 // Implementation has to ensure the following guarantees: |
44 // 1. Double buffering | 47 // 1. Double buffering |
45 // Since data can be read while another capture action is happening. | 48 // Since data can be read while another capture action is happening. |
46 class Capturer { | 49 class Capturer { |
47 public: | 50 public: |
48 // CaptureCompletedCallback is called when the capturer has completed. | 51 // CaptureCompletedCallback is called when the capturer has completed. |
49 typedef base::Callback<void(scoped_refptr<CaptureData>)> | 52 typedef base::Callback<void(scoped_refptr<CaptureData>)> |
50 CaptureCompletedCallback; | 53 CaptureCompletedCallback; |
51 | 54 |
55 // CursorShapeChangedCallback is called when the cursor shape has changed. | |
56 typedef base::Callback<void(scoped_refptr<CursorShapeData>)> | |
57 CursorShapeChangedCallback; | |
Wez
2012/05/23 00:01:57
If you have Capturers generate protocol::CursorSha
garykac
2012/05/26 01:58:01
Changed to protocol::CursorShapeInfo and removed s
| |
58 | |
52 virtual ~Capturer() {}; | 59 virtual ~Capturer() {}; |
53 | 60 |
54 // Create platform-specific capturer. | 61 // Create platform-specific capturer. |
55 static Capturer* Create(); | 62 static Capturer* Create(); |
56 | 63 |
57 #if defined(OS_LINUX) | 64 #if defined(OS_LINUX) |
58 // Set whether the Capturer should try to use X DAMAGE support if it is | 65 // Set whether the Capturer should try to use X DAMAGE support if it is |
59 // available. This needs to be called before the Capturer is created. | 66 // available. This needs to be called before the Capturer is created. |
60 // This is used by the Virtual Me2Me host, since the XDamage extension is | 67 // This is used by the Virtual Me2Me host, since the XDamage extension is |
61 // known to work reliably in this case. | 68 // known to work reliably in this case. |
62 | 69 |
63 // TODO(lambroslambrou): This currently sets a global flag, referenced during | 70 // TODO(lambroslambrou): This currently sets a global flag, referenced during |
64 // Capturer::Create(). This is a temporary solution, until the | 71 // Capturer::Create(). This is a temporary solution, until the |
65 // DesktopEnvironment class is refactored to allow applications to control | 72 // DesktopEnvironment class is refactored to allow applications to control |
66 // the creation of various stubs (including the Capturer) - see | 73 // the creation of various stubs (including the Capturer) - see |
67 // http://crbug.com/104544 | 74 // http://crbug.com/104544 |
68 static void EnableXDamage(bool enable); | 75 static void EnableXDamage(bool enable); |
69 #endif // defined(OS_LINUX) | 76 #endif // defined(OS_LINUX) |
70 | 77 |
71 // Called at the beginning of a capturing session. | 78 // Called at the beginning of a capturing session. |
72 virtual void Start() = 0; | 79 virtual void Start() = 0; |
73 | 80 |
74 // Called at the end of a capturing session. | 81 // Called at the end of a capturing session. |
75 virtual void Stop() = 0; | 82 virtual void Stop() = 0; |
76 | 83 |
84 // Set callback to be called when the cursor shape changes. | |
85 virtual void SetCursorShapeChangedCallback( | |
86 const CursorShapeChangedCallback& callback) = 0; | |
87 | |
77 // Called when the screen configuration is changed. | 88 // Called when the screen configuration is changed. |
78 virtual void ScreenConfigurationChanged() = 0; | 89 virtual void ScreenConfigurationChanged() = 0; |
79 | 90 |
80 // Return the pixel format of the screen. | 91 // Return the pixel format of the screen. |
81 virtual media::VideoFrame::Format pixel_format() const = 0; | 92 virtual media::VideoFrame::Format pixel_format() const = 0; |
82 | 93 |
83 // Clear out the invalid region. | 94 // Clear out the invalid region. |
84 virtual void ClearInvalidRegion() = 0; | 95 virtual void ClearInvalidRegion() = 0; |
85 | 96 |
86 // Invalidate the specified region. | 97 // Invalidate the specified region. |
(...skipping 18 matching lines...) Expand all Loading... | |
105 virtual void CaptureInvalidRegion( | 116 virtual void CaptureInvalidRegion( |
106 const CaptureCompletedCallback& callback) = 0; | 117 const CaptureCompletedCallback& callback) = 0; |
107 | 118 |
108 // Get the size of the most recently captured screen. | 119 // Get the size of the most recently captured screen. |
109 virtual const SkISize& size_most_recent() const = 0; | 120 virtual const SkISize& size_most_recent() const = 0; |
110 }; | 121 }; |
111 | 122 |
112 } // namespace remoting | 123 } // namespace remoting |
113 | 124 |
114 #endif // REMOTING_HOST_CAPTURER_H_ | 125 #endif // REMOTING_HOST_CAPTURER_H_ |
OLD | NEW |