2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_
14 #include "webrtc/modules/desktop_capture/desktop_capturer.h"
15 #include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
16 #include "webrtc/system_wrappers/interface/scoped_ptr.h"
20 // A wrapper for DesktopCapturer that also captures mouse using specified
21 // MouseCursorMonitor and renders it on the generated streams.
22 class DesktopAndCursorComposer : public DesktopCapturer,
23 public DesktopCapturer::Callback,
24 public MouseCursorMonitor::Callback {
26 // Creates a new blender that captures mouse cursor using |mouse_monitor| and
27 // renders it into the frames generated by |desktop_capturer|. If
28 // |mouse_monitor| is NULL the frames are passed unmodified. Takes ownership
30 DesktopAndCursorComposer(DesktopCapturer* desktop_capturer,
31 MouseCursorMonitor* mouse_monitor);
32 virtual ~DesktopAndCursorComposer();
34 // DesktopCapturer interface.
35 virtual void Start(DesktopCapturer::Callback* callback) OVERRIDE;
36 virtual void Capture(const DesktopRegion& region) OVERRIDE;
37 virtual void SetExcludedWindow(WindowId window) OVERRIDE;
40 // DesktopCapturer::Callback interface.
41 virtual SharedMemory* CreateSharedMemory(size_t size) OVERRIDE;
42 virtual void OnCaptureCompleted(DesktopFrame* frame) OVERRIDE;
44 // MouseCursorMonitor::Callback interface.
45 virtual void OnMouseCursor(MouseCursor* cursor) OVERRIDE;
46 virtual void OnMouseCursorPosition(MouseCursorMonitor::CursorState state,
47 const DesktopVector& position) OVERRIDE;
49 scoped_ptr<DesktopCapturer> desktop_capturer_;
50 scoped_ptr<MouseCursorMonitor> mouse_monitor_;
52 DesktopCapturer::Callback* callback_;
54 scoped_ptr<MouseCursor> cursor_;
55 MouseCursorMonitor::CursorState cursor_state_;
56 DesktopVector cursor_position_;
58 DISALLOW_COPY_AND_ASSIGN(DesktopAndCursorComposer);
63 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_