OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 MEDIA_BASE_VIDEO_FRAME_H_ | 5 #ifndef MEDIA_BASE_VIDEO_FRAME_H_ |
6 #define MEDIA_BASE_VIDEO_FRAME_H_ | 6 #define MEDIA_BASE_VIDEO_FRAME_H_ |
7 | 7 |
8 #include "media/base/buffers.h" | 8 #include "media/base/buffers.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 public: | 45 public: |
46 // Creates a new frame with given parameters. Buffers for the frame are | 46 // Creates a new frame with given parameters. Buffers for the frame are |
47 // allocated but not initialized. | 47 // allocated but not initialized. |
48 static void CreateFrame(Format format, | 48 static void CreateFrame(Format format, |
49 size_t width, | 49 size_t width, |
50 size_t height, | 50 size_t height, |
51 base::TimeDelta timestamp, | 51 base::TimeDelta timestamp, |
52 base::TimeDelta duration, | 52 base::TimeDelta duration, |
53 scoped_refptr<VideoFrame>* frame_out); | 53 scoped_refptr<VideoFrame>* frame_out); |
54 | 54 |
| 55 // Creates a new frame with given parameters. Buffers for the frame are |
| 56 // provided externally. Reference to the buffers and strides are copied |
| 57 // from |data| and |strides| respectively. |
| 58 static void CreateFrameExternal(Format format, |
| 59 size_t width, |
| 60 size_t height, |
| 61 uint8* const data[kMaxPlanes], |
| 62 const int32 strides[kMaxPlanes], |
| 63 base::TimeDelta timestamp, |
| 64 base::TimeDelta duration, |
| 65 scoped_refptr<VideoFrame>* frame_out); |
| 66 |
55 // Creates a frame with format equals to VideoFrame::EMPTY, width, height | 67 // Creates a frame with format equals to VideoFrame::EMPTY, width, height |
56 // timestamp and duration are all 0. | 68 // timestamp and duration are all 0. |
57 static void CreateEmptyFrame(scoped_refptr<VideoFrame>* frame_out); | 69 static void CreateEmptyFrame(scoped_refptr<VideoFrame>* frame_out); |
58 | 70 |
59 // Allocates YV12 frame based on |width| and |height|, and sets its data to | 71 // Allocates YV12 frame based on |width| and |height|, and sets its data to |
60 // the YUV equivalent of RGB(0,0,0). | 72 // the YUV equivalent of RGB(0,0,0). |
61 static void CreateBlackFrame(int width, int height, | 73 static void CreateBlackFrame(int width, int height, |
62 scoped_refptr<VideoFrame>* frame_out); | 74 scoped_refptr<VideoFrame>* frame_out); |
63 | 75 |
64 // Creates a new frame of |type| with given parameters. | 76 // Creates a new frame of |type| with given parameters. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 size_t planes_; | 132 size_t planes_; |
121 | 133 |
122 // Array of strides for each plane, typically greater or equal to the width | 134 // Array of strides for each plane, typically greater or equal to the width |
123 // of the surface divided by the horizontal sampling period. Note that | 135 // of the surface divided by the horizontal sampling period. Note that |
124 // strides can be negative. | 136 // strides can be negative. |
125 int32 strides_[kMaxPlanes]; | 137 int32 strides_[kMaxPlanes]; |
126 | 138 |
127 // Array of data pointers to each plane. | 139 // Array of data pointers to each plane. |
128 uint8* data_[kMaxPlanes]; | 140 uint8* data_[kMaxPlanes]; |
129 | 141 |
| 142 // True of memory referenced by |data_| is provided externally and shouldn't |
| 143 // be deleted. |
| 144 bool external_memory_; |
| 145 |
130 // Private buffer pointer, can be used for EGLImage. | 146 // Private buffer pointer, can be used for EGLImage. |
131 void* private_buffer_; | 147 void* private_buffer_; |
132 | 148 |
133 DISALLOW_COPY_AND_ASSIGN(VideoFrame); | 149 DISALLOW_COPY_AND_ASSIGN(VideoFrame); |
134 }; | 150 }; |
135 | 151 |
136 } // namespace media | 152 } // namespace media |
137 | 153 |
138 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 154 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |