OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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/ref_counted.h" |
| 12 #include "gfx/rect.h" |
| 13 #include "remoting/base/protocol/chromotocol.pb.h" |
| 14 |
| 15 namespace remoting { |
| 16 |
| 17 typedef std::vector<gfx::Rect> RectVector; |
| 18 |
| 19 struct DataPlanes { |
| 20 static const int kPlaneCount = 3; |
| 21 uint8* data[kPlaneCount]; |
| 22 int strides[kPlaneCount]; |
| 23 |
| 24 DataPlanes() { |
| 25 for (int i = 0; i < kPlaneCount; ++i) { |
| 26 data[i] = NULL; |
| 27 strides[i] = 0; |
| 28 } |
| 29 } |
| 30 }; |
| 31 |
| 32 // Stores the data and information of a capture to pass off to the |
| 33 // encoding thread. |
| 34 class CaptureData : public base::RefCountedThreadSafe<CaptureData> { |
| 35 public: |
| 36 CaptureData(const DataPlanes &data_planes, |
| 37 int width, |
| 38 int height, |
| 39 PixelFormat format) : |
| 40 data_planes_(data_planes), dirty_rects_(), |
| 41 width_(width), height_(height), pixel_format_(format) { } |
| 42 |
| 43 // Get the data_planes data of the last capture. |
| 44 const DataPlanes& data_planes() const { return data_planes_; } |
| 45 |
| 46 // Get the list of updated rectangles in the last capture. The result is |
| 47 // written into |rects|. |
| 48 const RectVector& dirty_rects() const { return dirty_rects_; } |
| 49 |
| 50 // Get the width of the image captured. |
| 51 int width() const { return width_; } |
| 52 |
| 53 // Get the height of the image captured. |
| 54 int height() const { return height_; } |
| 55 |
| 56 // Get the pixel format of the image captured. |
| 57 PixelFormat pixel_format() const { return pixel_format_; } |
| 58 |
| 59 // Mutating methods. |
| 60 RectVector& mutable_dirty_rects() { return dirty_rects_; } |
| 61 |
| 62 private: |
| 63 const DataPlanes data_planes_; |
| 64 RectVector dirty_rects_; |
| 65 int width_; |
| 66 int height_; |
| 67 PixelFormat pixel_format_; |
| 68 |
| 69 friend class base::RefCountedThreadSafe<CaptureData>; |
| 70 ~CaptureData() {} |
| 71 }; |
| 72 |
| 73 } // namespace remoting |
| 74 |
| 75 #endif // REMOTING_BASE_CAPTURE_DATA_H_ |
OLD | NEW |