summaryrefslogtreecommitdiffstats
path: root/remoting/base/capture_data.h
blob: 1922c9c133fe98319c9842efd3b5b54b51767b9f (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
53
54
55
56
57
58
59
60
61
// Copyright (c) 2010 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.

#ifndef REMOTING_BASE_CAPTURE_DATA_H_
#define REMOTING_BASE_CAPTURE_DATA_H_

#include <vector>

#include "base/basictypes.h"
#include "base/ref_counted.h"
#include "media/base/video_frame.h"
#include "remoting/base/types.h"

namespace remoting {

struct DataPlanes {
  DataPlanes();

  static const int kPlaneCount = 3;
  uint8* data[kPlaneCount];
  int strides[kPlaneCount];
};

// Stores the data and information of a capture to pass off to the
// encoding thread.
class CaptureData : public base::RefCountedThreadSafe<CaptureData> {
 public:
  CaptureData(const DataPlanes &data_planes,
              const gfx::Size& size,
              media::VideoFrame::Format format);

  // Get the data_planes data of the last capture.
  const DataPlanes& data_planes() const { return data_planes_; }

  // Get the list of updated rectangles in the last capture. The result is
  // written into |rects|.
  const InvalidRects& dirty_rects() const { return dirty_rects_; }

  // Return the size of the image captured.
  gfx::Size size() const { return size_; }

  // Get the pixel format of the image captured.
  media::VideoFrame::Format pixel_format() const { return pixel_format_; }

  // Mutating methods.
  InvalidRects& mutable_dirty_rects() { return dirty_rects_; }

 private:
  const DataPlanes data_planes_;
  InvalidRects dirty_rects_;
  gfx::Size size_;
  media::VideoFrame::Format pixel_format_;

  friend class base::RefCountedThreadSafe<CaptureData>;
  virtual ~CaptureData();
};

}  // namespace remoting

#endif  // REMOTING_BASE_CAPTURE_DATA_H_