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