OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BASE_CAPTURE_DATA_H_ | 5 #ifndef REMOTING_BASE_CAPTURE_DATA_H_ |
6 #define REMOTING_BASE_CAPTURE_DATA_H_ | 6 #define REMOTING_BASE_CAPTURE_DATA_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
13 #include "remoting/base/types.h" | 13 #include "third_party/skia/include/core/SkRegion.h" |
14 #include "ui/gfx/size.h" | |
14 | 15 |
15 namespace remoting { | 16 namespace remoting { |
16 | 17 |
17 struct DataPlanes { | 18 struct DataPlanes { |
18 DataPlanes(); | 19 DataPlanes(); |
19 | 20 |
20 static const int kPlaneCount = 3; | 21 static const int kPlaneCount = 3; |
21 uint8* data[kPlaneCount]; | 22 uint8* data[kPlaneCount]; |
22 int strides[kPlaneCount]; | 23 int strides[kPlaneCount]; |
23 }; | 24 }; |
24 | 25 |
25 // Stores the data and information of a capture to pass off to the | 26 // Stores the data and information of a capture to pass off to the |
26 // encoding thread. | 27 // encoding thread. |
27 class CaptureData : public base::RefCountedThreadSafe<CaptureData> { | 28 class CaptureData : public base::RefCountedThreadSafe<CaptureData> { |
28 public: | 29 public: |
29 CaptureData(const DataPlanes &data_planes, | 30 CaptureData(const DataPlanes &data_planes, |
30 const gfx::Size& size, | 31 const gfx::Size& size, |
31 media::VideoFrame::Format format); | 32 media::VideoFrame::Format format); |
32 | 33 |
33 // Get the data_planes data of the last capture. | 34 // Get the data_planes data of the last capture. |
34 const DataPlanes& data_planes() const { return data_planes_; } | 35 const DataPlanes& data_planes() const { return data_planes_; } |
35 | 36 |
36 // Get the list of updated rectangles in the last capture. The result is | 37 // Get the dirty region from the last capture. |
Wez
2011/08/10 22:05:43
nit: "last" -> "previous", to avoid ambiguity...
| |
37 // written into |rects|. | 38 const SkRegion& dirty_region() const { return dirty_region_; } |
38 const InvalidRects& dirty_rects() const { return dirty_rects_; } | |
39 | 39 |
40 // Return the size of the image captured. | 40 // Return the size of the image captured. |
41 gfx::Size size() const { return size_; } | 41 gfx::Size size() const { return size_; } |
42 | 42 |
43 // Get the pixel format of the image captured. | 43 // Get the pixel format of the image captured. |
44 media::VideoFrame::Format pixel_format() const { return pixel_format_; } | 44 media::VideoFrame::Format pixel_format() const { return pixel_format_; } |
45 | 45 |
46 // Mutating methods. | 46 // Mutating methods. |
47 InvalidRects& mutable_dirty_rects() { return dirty_rects_; } | 47 SkRegion& mutable_dirty_region() { return dirty_region_; } |
48 | 48 |
49 // Return the time spent on capturing. | 49 // Return the time spent on capturing. |
50 int capture_time_ms() const { return capture_time_ms_; } | 50 int capture_time_ms() const { return capture_time_ms_; } |
51 | 51 |
52 // Set the time spent on capturing. | 52 // Set the time spent on capturing. |
53 void set_capture_time_ms(int capture_time_ms) { | 53 void set_capture_time_ms(int capture_time_ms) { |
54 capture_time_ms_ = capture_time_ms; | 54 capture_time_ms_ = capture_time_ms; |
55 } | 55 } |
56 | 56 |
57 int64 client_sequence_number() const { return client_sequence_number_; } | 57 int64 client_sequence_number() const { return client_sequence_number_; } |
58 | 58 |
59 void set_client_sequence_number(int64 client_sequence_number) { | 59 void set_client_sequence_number(int64 client_sequence_number) { |
60 client_sequence_number_ = client_sequence_number; | 60 client_sequence_number_ = client_sequence_number; |
61 } | 61 } |
62 | 62 |
63 private: | 63 private: |
64 const DataPlanes data_planes_; | 64 const DataPlanes data_planes_; |
65 InvalidRects dirty_rects_; | 65 SkRegion dirty_region_; |
66 gfx::Size size_; | 66 gfx::Size size_; |
67 media::VideoFrame::Format pixel_format_; | 67 media::VideoFrame::Format pixel_format_; |
68 | 68 |
69 // Time spent in capture. Unit is in milliseconds. | 69 // Time spent in capture. Unit is in milliseconds. |
70 int capture_time_ms_; | 70 int capture_time_ms_; |
71 | 71 |
72 // Sequence number supplied by client for performance tracking. | 72 // Sequence number supplied by client for performance tracking. |
73 int64 client_sequence_number_; | 73 int64 client_sequence_number_; |
74 | 74 |
75 friend class base::RefCountedThreadSafe<CaptureData>; | 75 friend class base::RefCountedThreadSafe<CaptureData>; |
76 virtual ~CaptureData(); | 76 virtual ~CaptureData(); |
77 }; | 77 }; |
78 | 78 |
79 } // namespace remoting | 79 } // namespace remoting |
80 | 80 |
81 #endif // REMOTING_BASE_CAPTURE_DATA_H_ | 81 #endif // REMOTING_BASE_CAPTURE_DATA_H_ |
OLD | NEW |