OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/modules/desktop_capture/screen_capturer.h" | 11 #include "webrtc/modules/desktop_capture/screen_capturer.h" |
12 | 12 |
13 #include <stddef.h> | 13 #include <stddef.h> |
14 | 14 |
15 #include <memory> | 15 #include <memory> |
16 #include <set> | 16 #include <set> |
| 17 #include <utility> |
17 | 18 |
18 #include <ApplicationServices/ApplicationServices.h> | 19 #include <ApplicationServices/ApplicationServices.h> |
19 #include <Cocoa/Cocoa.h> | 20 #include <Cocoa/Cocoa.h> |
20 #include <dlfcn.h> | 21 #include <dlfcn.h> |
21 #include <OpenGL/CGLMacro.h> | 22 #include <OpenGL/CGLMacro.h> |
22 #include <OpenGL/OpenGL.h> | 23 #include <OpenGL/OpenGL.h> |
23 | 24 |
24 #include "webrtc/base/checks.h" | 25 #include "webrtc/base/checks.h" |
25 #include "webrtc/base/constructormagic.h" | 26 #include "webrtc/base/constructormagic.h" |
26 #include "webrtc/base/macutils.h" | 27 #include "webrtc/base/macutils.h" |
27 #include "webrtc/base/timeutils.h" | 28 #include "webrtc/base/timeutils.h" |
28 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" | 29 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
29 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 30 #include "webrtc/modules/desktop_capture/desktop_frame.h" |
30 #include "webrtc/modules/desktop_capture/desktop_geometry.h" | 31 #include "webrtc/modules/desktop_capture/desktop_geometry.h" |
31 #include "webrtc/modules/desktop_capture/desktop_region.h" | 32 #include "webrtc/modules/desktop_capture/desktop_region.h" |
32 #include "webrtc/modules/desktop_capture/mac/desktop_configuration.h" | 33 #include "webrtc/modules/desktop_capture/mac/desktop_configuration.h" |
33 #include "webrtc/modules/desktop_capture/mac/desktop_configuration_monitor.h" | 34 #include "webrtc/modules/desktop_capture/mac/desktop_configuration_monitor.h" |
34 #include "webrtc/modules/desktop_capture/mac/scoped_pixel_buffer_object.h" | 35 #include "webrtc/modules/desktop_capture/mac/scoped_pixel_buffer_object.h" |
35 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h" | 36 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h" |
| 37 #include "webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h" |
36 #include "webrtc/modules/desktop_capture/screen_capturer_helper.h" | 38 #include "webrtc/modules/desktop_capture/screen_capturer_helper.h" |
37 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" | 39 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
38 #include "webrtc/system_wrappers/include/logging.h" | 40 #include "webrtc/system_wrappers/include/logging.h" |
39 | 41 |
40 namespace webrtc { | 42 namespace webrtc { |
41 | 43 |
42 namespace { | 44 namespace { |
43 | 45 |
44 // Definitions used to dynamic-link to deprecated OS 10.6 functions. | 46 // Definitions used to dynamic-link to deprecated OS 10.6 functions. |
45 const char* kApplicationServicesLibraryName = | 47 const char* kApplicationServicesLibraryName = |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 return frame; | 932 return frame; |
931 } | 933 } |
932 | 934 |
933 } // namespace | 935 } // namespace |
934 | 936 |
935 // static | 937 // static |
936 ScreenCapturer* ScreenCapturer::Create(const DesktopCaptureOptions& options) { | 938 ScreenCapturer* ScreenCapturer::Create(const DesktopCaptureOptions& options) { |
937 if (!options.configuration_monitor()) | 939 if (!options.configuration_monitor()) |
938 return nullptr; | 940 return nullptr; |
939 | 941 |
940 std::unique_ptr<ScreenCapturerMac> capturer( | 942 std::unique_ptr<ScreenCapturer> capturer( |
941 new ScreenCapturerMac(options.configuration_monitor())); | 943 new ScreenCapturerMac(options.configuration_monitor())); |
942 if (!capturer->Init()) | 944 if (!static_cast<ScreenCapturerMac*>(capturer.get())->Init()) { |
943 capturer.reset(); | 945 return nullptr; |
| 946 } |
| 947 |
| 948 if (options.detect_updated_region()) { |
| 949 capturer.reset(new ScreenCapturerDifferWrapper(std::move(capturer))); |
| 950 } |
| 951 |
944 return capturer.release(); | 952 return capturer.release(); |
945 } | 953 } |
946 | 954 |
947 } // namespace webrtc | 955 } // namespace webrtc |
OLD | NEW |