OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef REMOTING_BASE_CAPTURE_DATA_H_ | |
6 #define REMOTING_BASE_CAPTURE_DATA_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "media/base/video_frame.h" | |
13 #include "remoting/base/shared_buffer.h" | |
14 #include "third_party/skia/include/core/SkRegion.h" | |
15 | |
16 namespace remoting { | |
17 | |
18 class SharedBuffer; | |
19 | |
20 struct DataPlanes { | |
21 DataPlanes(); | |
22 | |
23 static const int kPlaneCount = 3; | |
24 uint8* data[kPlaneCount]; | |
25 int strides[kPlaneCount]; | |
26 }; | |
27 | |
28 // Stores the data and information of a capture to pass off to the | |
29 // encoding thread. | |
30 class CaptureData : public base::RefCountedThreadSafe<CaptureData> { | |
31 public: | |
32 CaptureData(const DataPlanes &data_planes, | |
33 const SkISize& size, | |
34 media::VideoFrame::Format format); | |
35 | |
36 // Gets the data_planes data of the previous capture. | |
37 const DataPlanes& data_planes() const { return data_planes_; } | |
38 | |
39 // Gets the dirty region from the previous capture. | |
40 const SkRegion& dirty_region() const { return dirty_region_; } | |
41 | |
42 // Returns the size of the image captured. | |
43 SkISize size() const { return size_; } | |
44 | |
45 // Gets the pixel format of the image captured. | |
46 media::VideoFrame::Format pixel_format() const { return pixel_format_; } | |
47 | |
48 SkRegion& mutable_dirty_region() { return dirty_region_; } | |
49 | |
50 // Returns the time spent on capturing. | |
51 int capture_time_ms() const { return capture_time_ms_; } | |
52 | |
53 // Sets the time spent on capturing. | |
54 void set_capture_time_ms(int capture_time_ms) { | |
55 capture_time_ms_ = capture_time_ms; | |
56 } | |
57 | |
58 int64 client_sequence_number() const { return client_sequence_number_; } | |
59 | |
60 void set_client_sequence_number(int64 client_sequence_number) { | |
61 client_sequence_number_ = client_sequence_number; | |
62 } | |
63 | |
64 SkIPoint dpi() const { return dpi_; } | |
65 | |
66 void set_dpi(const SkIPoint& dpi) { dpi_ = dpi; } | |
67 | |
68 // Returns the shared memory buffer pointed to by |data_planes_.data[0]|. | |
69 scoped_refptr<SharedBuffer> shared_buffer() const { return shared_buffer_; } | |
70 | |
71 // Sets the shared memory buffer pointed to by |data_planes_.data[0]|. | |
72 void set_shared_buffer(scoped_refptr<SharedBuffer> shared_buffer) { | |
73 shared_buffer_ = shared_buffer; | |
74 } | |
75 | |
76 private: | |
77 friend class base::RefCountedThreadSafe<CaptureData>; | |
78 virtual ~CaptureData(); | |
79 | |
80 const DataPlanes data_planes_; | |
81 SkRegion dirty_region_; | |
82 SkISize size_; | |
83 media::VideoFrame::Format pixel_format_; | |
84 | |
85 // Time spent in capture. Unit is in milliseconds. | |
86 int capture_time_ms_; | |
87 | |
88 // Sequence number supplied by client for performance tracking. | |
89 int64 client_sequence_number_; | |
90 | |
91 // DPI for this frame. | |
92 SkIPoint dpi_; | |
93 | |
94 scoped_refptr<SharedBuffer> shared_buffer_; | |
95 }; | |
96 | |
97 } // namespace remoting | |
98 | |
99 #endif // REMOTING_BASE_CAPTURE_DATA_H_ | |
OLD | NEW |