OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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_CAPTURER_MAC_H_ | |
6 #define REMOTING_HOST_CAPTURER_MAC_H_ | |
7 | |
8 #include "remoting/host/capturer.h" | |
9 #include "remoting/host/capturer_helper.h" | |
10 #include <ApplicationServices/ApplicationServices.h> | |
11 #include <OpenGL/OpenGL.h> | |
12 #include "base/memory/scoped_ptr.h" | |
13 | |
14 namespace remoting { | |
15 | |
16 // A class to perform capturing for mac. | |
17 class CapturerMac : public Capturer { | |
18 public: | |
19 CapturerMac(); | |
20 virtual ~CapturerMac(); | |
21 | |
22 // Capturer interface. | |
23 virtual void ScreenConfigurationChanged(); | |
24 virtual media::VideoFrame::Format pixel_format() const; | |
25 virtual void ClearInvalidRects(); | |
26 virtual void InvalidateRects(const InvalidRects& inval_rects); | |
27 virtual void InvalidateScreen(const gfx::Size& size); | |
28 virtual void InvalidateFullScreen(); | |
29 virtual void CaptureInvalidRects(CaptureCompletedCallback* callback); | |
30 virtual const gfx::Size& size_most_recent() const; | |
31 | |
32 private: | |
33 void CaptureRects(const InvalidRects& rects, | |
34 CaptureCompletedCallback* callback); | |
35 | |
36 void ScreenRefresh(CGRectCount count, const CGRect *rect_array); | |
37 void ScreenUpdateMove(CGScreenUpdateMoveDelta delta, | |
38 size_t count, | |
39 const CGRect *rect_array); | |
40 static void ScreenRefreshCallback(CGRectCount count, | |
41 const CGRect *rect_array, | |
42 void *user_parameter); | |
43 static void ScreenUpdateMoveCallback(CGScreenUpdateMoveDelta delta, | |
44 size_t count, | |
45 const CGRect *rect_array, | |
46 void *user_parameter); | |
47 static void DisplaysReconfiguredCallback(CGDirectDisplayID display, | |
48 CGDisplayChangeSummaryFlags flags, | |
49 void *user_parameter); | |
50 | |
51 void ReleaseBuffers(); | |
52 CGLContextObj cgl_context_; | |
53 static const int kNumBuffers = 2; | |
54 scoped_array<uint8> buffers_[kNumBuffers]; | |
55 scoped_array<uint8> flip_buffer_; | |
56 | |
57 // A thread-safe list of invalid rectangles, and the size of the most | |
58 // recently captured screen. | |
59 CapturerHelper helper_; | |
60 | |
61 // Screen size. | |
62 int width_; | |
63 int height_; | |
64 | |
65 int bytes_per_row_; | |
66 | |
67 // The current buffer with valid data for reading. | |
68 int current_buffer_; | |
69 | |
70 // Format of pixels returned in buffer. | |
71 media::VideoFrame::Format pixel_format_; | |
72 | |
73 DISALLOW_COPY_AND_ASSIGN(CapturerMac); | |
74 }; | |
75 | |
76 } // namespace remoting | |
77 | |
78 #endif // REMOTING_HOST_CAPTURER_MAC_H_ | |
OLD | NEW |