summaryrefslogtreecommitdiffstats
path: root/remoting/host/ipc_video_frame_capturer.cc
blob: 21aed746d2769648aeaa634c5bfdbe62be50ca1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/host/ipc_video_frame_capturer.h"

#include "media/video/capture/screen/mouse_cursor_shape.h"
#include "media/video/capture/screen/screen_capture_data.h"
#include "remoting/host/desktop_session_proxy.h"

namespace remoting {

IpcVideoFrameCapturer::IpcVideoFrameCapturer(
    scoped_refptr<DesktopSessionProxy> desktop_session_proxy)
    : delegate_(NULL),
      desktop_session_proxy_(desktop_session_proxy) {
}

IpcVideoFrameCapturer::~IpcVideoFrameCapturer() {
}

void IpcVideoFrameCapturer::Start(Delegate* delegate) {
  delegate_ = delegate;
  desktop_session_proxy_->StartVideoCapturer(this);
}

void IpcVideoFrameCapturer::Stop() {
  desktop_session_proxy_->StopVideoCapturer();
  delegate_ = NULL;
}

void IpcVideoFrameCapturer::InvalidateRegion(const SkRegion& invalid_region) {
  desktop_session_proxy_->InvalidateRegion(invalid_region);
}

void IpcVideoFrameCapturer::CaptureFrame() {
  desktop_session_proxy_->CaptureFrame();
}

void IpcVideoFrameCapturer::OnCaptureCompleted(
    scoped_refptr<media::ScreenCaptureData> capture_data) {
  if (delegate_)
    delegate_->OnCaptureCompleted(capture_data);
}

void IpcVideoFrameCapturer::OnCursorShapeChanged(
    scoped_ptr<media::MouseCursorShape> cursor_shape) {
  if (delegate_)
    delegate_->OnCursorShapeChanged(cursor_shape.Pass());
}

}  // namespace remoting