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 namespace protocol { |
| 16 class CursorShapeInfo; |
| 17 } |
| 18 |
| 19 class CaptureData; |
| 20 |
15 // A class to perform the task of capturing the image of a window. | 21 // A class to perform the task of capturing the image of a window. |
16 // The capture action is asynchronous to allow maximum throughput. | 22 // The capture action is asynchronous to allow maximum throughput. |
17 // | 23 // |
18 // The full capture process is as follows: | 24 // The full capture process is as follows: |
19 // | 25 // |
20 // (1) Start | 26 // (1) Start |
21 // This is when pre-capture steps are executed, such as flagging the | 27 // This is when pre-capture steps are executed, such as flagging the |
22 // display to prevent it from sleeping during a session. | 28 // display to prevent it from sleeping during a session. |
23 // | 29 // |
24 // (2) InvalidateRects | 30 // (2) InvalidateRects |
(...skipping 17 matching lines...) Expand all Loading... |
42 // | 48 // |
43 // Implementation has to ensure the following guarantees: | 49 // Implementation has to ensure the following guarantees: |
44 // 1. Double buffering | 50 // 1. Double buffering |
45 // Since data can be read while another capture action is happening. | 51 // Since data can be read while another capture action is happening. |
46 class Capturer { | 52 class Capturer { |
47 public: | 53 public: |
48 // CaptureCompletedCallback is called when the capturer has completed. | 54 // CaptureCompletedCallback is called when the capturer has completed. |
49 typedef base::Callback<void(scoped_refptr<CaptureData>)> | 55 typedef base::Callback<void(scoped_refptr<CaptureData>)> |
50 CaptureCompletedCallback; | 56 CaptureCompletedCallback; |
51 | 57 |
| 58 // CursorShapeChangedCallback is called when the cursor shape has changed. |
| 59 typedef base::Callback<void(scoped_ptr<protocol::CursorShapeInfo>)> |
| 60 CursorShapeChangedCallback; |
| 61 |
52 virtual ~Capturer() {}; | 62 virtual ~Capturer() {}; |
53 | 63 |
54 // Create platform-specific capturer. | 64 // Create platform-specific capturer. |
55 static Capturer* Create(); | 65 static Capturer* Create(); |
56 | 66 |
57 #if defined(OS_LINUX) | 67 #if defined(OS_LINUX) |
58 // Set whether the Capturer should try to use X DAMAGE support if it is | 68 // 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. | 69 // 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 | 70 // This is used by the Virtual Me2Me host, since the XDamage extension is |
61 // known to work reliably in this case. | 71 // known to work reliably in this case. |
62 | 72 |
63 // TODO(lambroslambrou): This currently sets a global flag, referenced during | 73 // TODO(lambroslambrou): This currently sets a global flag, referenced during |
64 // Capturer::Create(). This is a temporary solution, until the | 74 // Capturer::Create(). This is a temporary solution, until the |
65 // DesktopEnvironment class is refactored to allow applications to control | 75 // DesktopEnvironment class is refactored to allow applications to control |
66 // the creation of various stubs (including the Capturer) - see | 76 // the creation of various stubs (including the Capturer) - see |
67 // http://crbug.com/104544 | 77 // http://crbug.com/104544 |
68 static void EnableXDamage(bool enable); | 78 static void EnableXDamage(bool enable); |
69 #endif // defined(OS_LINUX) | 79 #endif // defined(OS_LINUX) |
70 | 80 |
71 // Called at the beginning of a capturing session. | 81 // Called at the beginning of a capturing session. |
72 virtual void Start() = 0; | 82 virtual void Start( |
| 83 const CursorShapeChangedCallback& callback) = 0; |
73 | 84 |
74 // Called at the end of a capturing session. | 85 // Called at the end of a capturing session. |
75 virtual void Stop() = 0; | 86 virtual void Stop() = 0; |
76 | 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 |
(...skipping 22 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 |