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_HOST_VIDEO_FRAME_H_ | |
6 #define REMOTING_HOST_VIDEO_FRAME_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "base/memory/ref_counted.h" | |
11 #include "remoting/base/shared_buffer.h" | |
12 #include "third_party/skia/include/core/SkTypes.h" | |
13 #include "third_party/skia/include/core/SkSize.h" | |
14 | |
15 namespace remoting { | |
16 | |
17 // Represents a video frame. | |
18 class VideoFrame { | |
19 public: | |
20 virtual ~VideoFrame(); | |
21 | |
22 int bytes_per_row() const { return bytes_per_row_; } | |
23 const SkISize& dimensions() const { return dimensions_; } | |
24 uint8* pixels() const { return pixels_; } | |
25 const scoped_refptr<SharedBuffer>& shared_buffer() const { | |
26 return shared_buffer_; | |
27 } | |
28 | |
29 protected: | |
30 // Initializes an empty video frame. Derived classes are expected to allocate | |
31 // memory for the frame in a platform-specific way and set the properties of | |
32 // the allocated frame. | |
33 VideoFrame(); | |
34 | |
35 void set_bytes_per_row(int bytes_per_row) { | |
36 bytes_per_row_ = bytes_per_row; | |
37 } | |
38 | |
39 void set_dimensions(const SkISize& dimensions) { dimensions_ = dimensions; } | |
40 void set_pixels(uint8* ptr) { pixels_ = ptr; } | |
41 void set_shared_buffer(scoped_refptr<SharedBuffer> shared_buffer) { | |
42 shared_buffer_ = shared_buffer; | |
43 } | |
44 | |
45 private: | |
46 // Bytes per row of pixels including necessary padding. | |
47 int bytes_per_row_; | |
48 | |
49 // Dimensions of the buffer in pixels. | |
50 SkISize dimensions_; | |
51 | |
52 // Points to the pixel buffer. | |
53 uint8* pixels_; | |
54 | |
55 // Points to an optional shared memory buffer that backs up |pixels_| buffer. | |
56 scoped_refptr<SharedBuffer> shared_buffer_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(VideoFrame); | |
59 }; | |
60 | |
61 } // namespace remoting | |
62 | |
63 #endif // REMOTING_HOST_VIDEO_FRAME_H_ | |
OLD | NEW |