Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: webrtc/modules/desktop_capture/window_capturer_x11.cc

Issue 2490063002: Remove ScreenCapturer and WindowCapturer (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/desktop_capture/window_capturer_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/window_capturer.h"
12
13 #include <assert.h> 11 #include <assert.h>
14 #include <string.h> 12 #include <string.h>
15 #include <X11/Xatom.h> 13 #include <X11/Xatom.h>
16 #include <X11/extensions/Xcomposite.h> 14 #include <X11/extensions/Xcomposite.h>
17 #include <X11/extensions/Xrender.h> 15 #include <X11/extensions/Xrender.h>
18 #include <X11/Xutil.h> 16 #include <X11/Xutil.h>
19 17
20 #include <algorithm> 18 #include <algorithm>
21 19
22 #include "webrtc/base/constructormagic.h" 20 #include "webrtc/base/constructormagic.h"
23 #include "webrtc/base/scoped_ref_ptr.h" 21 #include "webrtc/base/scoped_ref_ptr.h"
22 #include "webrtc/modules/desktop_capture/desktop_capturer.h"
24 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" 23 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
25 #include "webrtc/modules/desktop_capture/desktop_frame.h" 24 #include "webrtc/modules/desktop_capture/desktop_frame.h"
26 #include "webrtc/modules/desktop_capture/x11/shared_x_display.h" 25 #include "webrtc/modules/desktop_capture/x11/shared_x_display.h"
27 #include "webrtc/modules/desktop_capture/x11/x_error_trap.h" 26 #include "webrtc/modules/desktop_capture/x11/x_error_trap.h"
28 #include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h" 27 #include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h"
29 #include "webrtc/system_wrappers/include/logging.h" 28 #include "webrtc/system_wrappers/include/logging.h"
30 29
31 namespace webrtc { 30 namespace webrtc {
32 31
33 namespace { 32 namespace {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 74 }
76 75
77 private: 76 private:
78 bool is_valid_ = false; 77 bool is_valid_ = false;
79 unsigned long size_ = 0; // NOLINT: type required by XGetWindowProperty 78 unsigned long size_ = 0; // NOLINT: type required by XGetWindowProperty
80 unsigned char* data_ = nullptr; 79 unsigned char* data_ = nullptr;
81 80
82 RTC_DISALLOW_COPY_AND_ASSIGN(XWindowProperty); 81 RTC_DISALLOW_COPY_AND_ASSIGN(XWindowProperty);
83 }; 82 };
84 83
85 class WindowCapturerLinux : public WindowCapturer, 84 class WindowCapturerLinux : public DesktopCapturer,
86 public SharedXDisplay::XEventHandler { 85 public SharedXDisplay::XEventHandler {
87 public: 86 public:
88 WindowCapturerLinux(const DesktopCaptureOptions& options); 87 WindowCapturerLinux(const DesktopCaptureOptions& options);
89 ~WindowCapturerLinux() override; 88 ~WindowCapturerLinux() override;
90 89
91 // DesktopCapturer interface. 90 // DesktopCapturer interface.
92 void Start(Callback* callback) override; 91 void Start(Callback* callback) override;
93 void CaptureFrame() override; 92 void CaptureFrame() override;
94 bool GetSourceList(SourceList* sources) override; 93 bool GetSourceList(SourceList* sources) override;
95 bool SelectSource(SourceId id) override; 94 bool SelectSource(SourceId id) override;
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 414 }
416 if (window_name.value) 415 if (window_name.value)
417 XFree(window_name.value); 416 XFree(window_name.value);
418 } 417 }
419 return result; 418 return result;
420 } 419 }
421 420
422 } // namespace 421 } // namespace
423 422
424 // static 423 // static
425 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) {
426 if (!options.x_display())
427 return nullptr;
428 return new WindowCapturerLinux(options);
429 }
430
431 // static
432 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer( 424 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
433 const DesktopCaptureOptions& options) { 425 const DesktopCaptureOptions& options) {
434 if (!options.x_display()) 426 if (!options.x_display())
435 return nullptr; 427 return nullptr;
436 return std::unique_ptr<DesktopCapturer>(new WindowCapturerLinux(options)); 428 return std::unique_ptr<DesktopCapturer>(new WindowCapturerLinux(options));
437 } 429 }
438 430
439 } // namespace webrtc 431 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/window_capturer_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698