| 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 "media/video/capture/screen/screen_capturer.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class DesktopSessionProxy; | 22 class DesktopSessionProxy; |
| 23 | 23 |
| 24 // Routes media::ScreenCapturer calls though the IPC channel to the desktop | 24 // Routes media::ScreenCapturer calls though the IPC channel to the desktop |
| 25 // session agent running in the desktop integration process. | 25 // session agent running in the desktop integration process. |
| 26 class IpcVideoFrameCapturer : public media::ScreenCapturer { | 26 class IpcVideoFrameCapturer : public media::ScreenCapturer { |
| 27 public: | 27 public: |
| 28 explicit IpcVideoFrameCapturer( | 28 explicit IpcVideoFrameCapturer( |
| 29 scoped_refptr<DesktopSessionProxy> desktop_session_proxy); | 29 scoped_refptr<DesktopSessionProxy> desktop_session_proxy); |
| 30 virtual ~IpcVideoFrameCapturer(); | 30 virtual ~IpcVideoFrameCapturer(); |
| 31 | 31 |
| 32 // webrtc::DesktopCapturer interface. |
| 33 virtual void Start(Callback* callback) OVERRIDE; |
| 34 virtual void Capture(const webrtc::DesktopRegion& region) OVERRIDE; |
| 35 |
| 32 // media::ScreenCapturer interface. | 36 // media::ScreenCapturer interface. |
| 33 virtual void Start(Delegate* delegate) OVERRIDE; | 37 virtual void SetMouseShapeObserver( |
| 34 virtual void CaptureFrame() OVERRIDE; | 38 MouseShapeObserver* mouse_shape_observer) OVERRIDE; |
| 35 | 39 |
| 36 // Called when a video frame has been captured. |capture_data| describes | 40 // Called when a video |frame| has been captured. |
| 37 // a captured frame. | 41 void OnCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame); |
| 38 void OnCaptureCompleted(scoped_refptr<media::ScreenCaptureData> capture_data); | |
| 39 | 42 |
| 40 // Called when the cursor shape has changed. | 43 // Called when the cursor shape has changed. |
| 41 void OnCursorShapeChanged(scoped_ptr<media::MouseCursorShape> cursor_shape); | 44 void OnCursorShapeChanged(scoped_ptr<media::MouseCursorShape> cursor_shape); |
| 42 | 45 |
| 43 private: | 46 private: |
| 44 // Points to the delegate passed to media::ScreenCapturer::Start(). | 47 // Points to the callback passed to media::ScreenCapturer::Start(). |
| 45 media::ScreenCapturer::Delegate* delegate_; | 48 media::ScreenCapturer::Callback* callback_; |
| 49 |
| 50 MouseShapeObserver* mouse_shape_observer_; |
| 46 | 51 |
| 47 // Wraps the IPC channel to the desktop session agent. | 52 // Wraps the IPC channel to the desktop session agent. |
| 48 scoped_refptr<DesktopSessionProxy> desktop_session_proxy_; | 53 scoped_refptr<DesktopSessionProxy> desktop_session_proxy_; |
| 49 | 54 |
| 55 // Set to true when a frame is being captured. |
| 56 bool capture_pending_; |
| 57 |
| 50 // Used to cancel tasks pending on the capturer when it is stopped. | 58 // Used to cancel tasks pending on the capturer when it is stopped. |
| 51 base::WeakPtrFactory<IpcVideoFrameCapturer> weak_factory_; | 59 base::WeakPtrFactory<IpcVideoFrameCapturer> weak_factory_; |
| 52 | 60 |
| 53 DISALLOW_COPY_AND_ASSIGN(IpcVideoFrameCapturer); | 61 DISALLOW_COPY_AND_ASSIGN(IpcVideoFrameCapturer); |
| 54 }; | 62 }; |
| 55 | 63 |
| 56 } // namespace remoting | 64 } // namespace remoting |
| 57 | 65 |
| 58 #endif // REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ | 66 #endif // REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ |
| OLD | NEW |