Index: remoting/host/capturer_mac.cc |
diff --git a/remoting/host/capturer_mac.cc b/remoting/host/capturer_mac.cc |
index d13a5f56e11c65d2f4af9ea0ae06dfcbcd331c9d..72192da273cdd092eecc21d3bb316576c7a3317e 100644 |
--- a/remoting/host/capturer_mac.cc |
+++ b/remoting/host/capturer_mac.cc |
@@ -2,15 +2,81 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "base/logging.h" |
-#include "remoting/host/capturer_mac.h" |
+#include "remoting/host/capturer.h" |
+ |
+#include <ApplicationServices/ApplicationServices.h> |
+#include <OpenGL/OpenGL.h> |
Lambros
2011/04/01 15:54:00
Nit: alphabetize
dmac
2011/04/01 21:15:07
Done.
|
+#include <OpenGL/CGLMacro.h> |
#include <stddef.h> |
-#include <OpenGL/CGLMacro.h> |
+#include "base/logging.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "remoting/host/capturer_helper.h" |
namespace remoting { |
+namespace { |
+// A class to perform capturing for mac. |
+class CapturerMac : public Capturer { |
+ public: |
+ CapturerMac(); |
+ virtual ~CapturerMac(); |
+ |
+ // Capturer interface. |
+ virtual void ScreenConfigurationChanged() OVERRIDE; |
+ virtual media::VideoFrame::Format pixel_format() const OVERRIDE; |
+ virtual void ClearInvalidRects() OVERRIDE; |
+ virtual void InvalidateRects(const InvalidRects& inval_rects) OVERRIDE; |
+ virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE; |
+ virtual void InvalidateFullScreen() OVERRIDE; |
+ virtual void CaptureInvalidRects(CaptureCompletedCallback* callback) OVERRIDE; |
+ virtual const gfx::Size& size_most_recent() const OVERRIDE; |
+ |
+ private: |
+ void CaptureRects(const InvalidRects& rects, |
+ CaptureCompletedCallback* callback); |
+ |
+ void ScreenRefresh(CGRectCount count, const CGRect *rect_array); |
+ void ScreenUpdateMove(CGScreenUpdateMoveDelta delta, |
+ size_t count, |
+ const CGRect *rect_array); |
+ static void ScreenRefreshCallback(CGRectCount count, |
+ const CGRect *rect_array, |
+ void *user_parameter); |
+ static void ScreenUpdateMoveCallback(CGScreenUpdateMoveDelta delta, |
+ size_t count, |
+ const CGRect *rect_array, |
+ void *user_parameter); |
+ static void DisplaysReconfiguredCallback(CGDirectDisplayID display, |
+ CGDisplayChangeSummaryFlags flags, |
+ void *user_parameter); |
+ |
+ void ReleaseBuffers(); |
+ CGLContextObj cgl_context_; |
+ static const int kNumBuffers = 2; |
+ scoped_array<uint8> buffers_[kNumBuffers]; |
+ scoped_array<uint8> flip_buffer_; |
+ |
+ // A thread-safe list of invalid rectangles, and the size of the most |
+ // recently captured screen. |
+ CapturerHelper helper_; |
+ |
+ // Screen size. |
+ int width_; |
+ int height_; |
+ |
+ int bytes_per_row_; |
+ |
+ // The current buffer with valid data for reading. |
+ int current_buffer_; |
+ |
+ // Format of pixels returned in buffer. |
+ media::VideoFrame::Format pixel_format_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CapturerMac); |
+}; |
+ |
CapturerMac::CapturerMac() |
: cgl_context_(NULL), |
width_(0), |
@@ -195,6 +261,8 @@ void CapturerMac::DisplaysReconfiguredCallback( |
} |
} |
+} // namespace |
+ |
// static |
Capturer* Capturer::Create() { |
return new CapturerMac(); |