Chromium Code Reviews| Index: webrtc/modules/desktop_capture/desktop_capturer.cc |
| diff --git a/webrtc/modules/desktop_capture/desktop_capturer.cc b/webrtc/modules/desktop_capture/desktop_capturer.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2329746f55ef236767796d92493b754dbe0768fc |
| --- /dev/null |
| +++ b/webrtc/modules/desktop_capture/desktop_capturer.cc |
| @@ -0,0 +1,98 @@ |
| +/* |
| + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#include "webrtc/modules/desktop_capture/desktop_capturer.h" |
| + |
| +#include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
| +#include "webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h" |
| + |
| +namespace webrtc { |
| + |
| +WindowId DesktopCapturer::Source::window_id() const { |
| + return id; |
| +} |
| + |
| +ScreenId DesktopCapturer::Source::screen_id() const { |
| + return id; |
| +} |
| + |
| +bool DesktopCapturer::Source::operator<(const Source& other) const { |
| + if (type == other.type) { |
| + return id < other.id; |
| + } |
| + |
| + return type < other.type; |
| +} |
| + |
| +bool DesktopCapturer::Source::operator>(const Source& other) const { |
| + return (*this != other) && !(*this < other); |
| +} |
| + |
| +bool DesktopCapturer::Source::operator==(const Source& other) const { |
| + if (type != other.type) { |
| + return false; |
| + } |
| + |
| + return id == other.id; |
| +} |
| + |
| +bool DesktopCapturer::Source::operator!=(const Source& other) const { |
| + return !(*this == other); |
| +} |
| + |
| +// static |
| +DesktopCapturer::Source DesktopCapturer::Source::NewWindow( |
| + WindowId id, |
| + const std::string& title) { |
| +// MSVC and android-g++ does not support C99 structure initialization. |
|
Sergey Ulanov
2016/10/28 15:53:21
This is a not a good reason to use ifdef. The firs
Hzj_jie
2016/10/28 22:03:53
Done.
|
| +#if defined(_MSC_VER) || defined(WEBRTC_ANDROID) |
| + Source result; |
| + result.type = SourceType::WINDOW; |
| + result.id = id; |
| + result.title = title; |
| + return result; |
| +#else |
| + return Source{.type = SourceType::WINDOW, .id = id, .title = title}; |
| +#endif |
| +} |
| + |
| +// static |
| +DesktopCapturer::Source DesktopCapturer::Source::NewScreen(ScreenId id) { |
| +// MSVC and android-g++ does not support C99 structure initialization. |
| +#if defined(_MSC_VER) || defined(WEBRTC_ANDROID) |
| + Source result; |
| + result.type = SourceType::SCREEN; |
| + result.id = id; |
| + return result; |
| +#else |
| + return Source{.type = SourceType::SCREEN, .id = id}; |
| +#endif |
| +} |
| + |
| +DesktopCapturer::~DesktopCapturer() = default; |
| + |
| +void DesktopCapturer::SetSharedMemoryFactory( |
| + std::unique_ptr<SharedMemoryFactory> shared_memory_factory) {} |
| + |
| +void DesktopCapturer::SetExcludedWindow(WindowId window) {} |
| + |
| +bool DesktopCapturer::GetSourceList(SourceList* sources) { |
| + return true; |
| +} |
| + |
| +bool DesktopCapturer::SelectSource(const Source& source) { |
| + return false; |
| +} |
| + |
| +bool DesktopCapturer::FocusOnSelectedSource() { |
| + return false; |
| +} |
| + |
| +} // namespace webrtc |