OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ | 5 #ifndef REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ |
6 #define REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ | 6 #define REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "media/video/capture/screen/screen_capturer.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
11 | 12 |
12 namespace IPC { | 13 namespace IPC { |
13 class Message; | 14 class Message; |
14 } // namespace IPC | 15 } // namespace IPC |
15 | 16 |
16 namespace media { | 17 namespace media { |
17 struct MouseCursorShape; | 18 struct MouseCursorShape; |
18 } // namespace media | 19 } // namespace media |
19 | 20 |
20 namespace remoting { | 21 namespace remoting { |
21 | 22 |
22 class DesktopSessionProxy; | 23 class DesktopSessionProxy; |
23 | 24 |
24 // Routes media::ScreenCapturer calls though the IPC channel to the desktop | 25 // Routes webrtc::ScreenCapturer calls though the IPC channel to the desktop |
25 // session agent running in the desktop integration process. | 26 // session agent running in the desktop integration process. |
26 class IpcVideoFrameCapturer : public media::ScreenCapturer { | 27 class IpcVideoFrameCapturer : public webrtc::ScreenCapturer { |
27 public: | 28 public: |
28 explicit IpcVideoFrameCapturer( | 29 explicit IpcVideoFrameCapturer( |
29 scoped_refptr<DesktopSessionProxy> desktop_session_proxy); | 30 scoped_refptr<DesktopSessionProxy> desktop_session_proxy); |
30 virtual ~IpcVideoFrameCapturer(); | 31 virtual ~IpcVideoFrameCapturer(); |
31 | 32 |
32 // webrtc::DesktopCapturer interface. | 33 // webrtc::DesktopCapturer interface. |
33 virtual void Start(Callback* callback) OVERRIDE; | 34 virtual void Start(Callback* callback) OVERRIDE; |
34 virtual void Capture(const webrtc::DesktopRegion& region) OVERRIDE; | 35 virtual void Capture(const webrtc::DesktopRegion& region) OVERRIDE; |
35 | 36 |
36 // media::ScreenCapturer interface. | 37 // webrtc::ScreenCapturer interface. |
37 virtual void SetMouseShapeObserver( | 38 virtual void SetMouseShapeObserver( |
38 MouseShapeObserver* mouse_shape_observer) OVERRIDE; | 39 MouseShapeObserver* mouse_shape_observer) OVERRIDE; |
39 | 40 |
40 // Called when a video |frame| has been captured. | 41 // Called when a video |frame| has been captured. |
41 void OnCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame); | 42 void OnCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame); |
42 | 43 |
43 // Called when the cursor shape has changed. | 44 // Called when the cursor shape has changed. |
44 void OnCursorShapeChanged(scoped_ptr<media::MouseCursorShape> cursor_shape); | 45 void OnCursorShapeChanged(scoped_ptr<webrtc::MouseCursorShape> cursor_shape); |
45 | 46 |
46 private: | 47 private: |
47 // Points to the callback passed to media::ScreenCapturer::Start(). | 48 // Points to the callback passed to webrtc::ScreenCapturer::Start(). |
48 media::ScreenCapturer::Callback* callback_; | 49 webrtc::ScreenCapturer::Callback* callback_; |
49 | 50 |
50 MouseShapeObserver* mouse_shape_observer_; | 51 MouseShapeObserver* mouse_shape_observer_; |
51 | 52 |
52 // Wraps the IPC channel to the desktop session agent. | 53 // Wraps the IPC channel to the desktop session agent. |
53 scoped_refptr<DesktopSessionProxy> desktop_session_proxy_; | 54 scoped_refptr<DesktopSessionProxy> desktop_session_proxy_; |
54 | 55 |
55 // Set to true when a frame is being captured. | 56 // Set to true when a frame is being captured. |
56 bool capture_pending_; | 57 bool capture_pending_; |
57 | 58 |
58 // Used to cancel tasks pending on the capturer when it is stopped. | 59 // Used to cancel tasks pending on the capturer when it is stopped. |
59 base::WeakPtrFactory<IpcVideoFrameCapturer> weak_factory_; | 60 base::WeakPtrFactory<IpcVideoFrameCapturer> weak_factory_; |
60 | 61 |
61 DISALLOW_COPY_AND_ASSIGN(IpcVideoFrameCapturer); | 62 DISALLOW_COPY_AND_ASSIGN(IpcVideoFrameCapturer); |
62 }; | 63 }; |
63 | 64 |
64 } // namespace remoting | 65 } // namespace remoting |
65 | 66 |
66 #endif // REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ | 67 #endif // REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ |
OLD | NEW |