OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/md5.h" | 9 #include "base/md5.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 const gfx::Size& natural_size, | 128 const gfx::Size& natural_size, |
129 base::TimeDelta timestamp, | 129 base::TimeDelta timestamp, |
130 const ReadPixelsCB& read_pixels_cb, | 130 const ReadPixelsCB& read_pixels_cb, |
131 const base::Closure& no_longer_needed_cb); | 131 const base::Closure& no_longer_needed_cb); |
132 | 132 |
133 // Read pixels from the native texture backing |*this| and write | 133 // Read pixels from the native texture backing |*this| and write |
134 // them to |pixels| as BGRA. |pixels| must point to a buffer at | 134 // them to |pixels| as BGRA. |pixels| must point to a buffer at |
135 // least as large as 4*visible_rect().width()*visible_rect().height(). | 135 // least as large as 4*visible_rect().width()*visible_rect().height(). |
136 void ReadPixelsFromNativeTexture(const SkBitmap& pixels); | 136 void ReadPixelsFromNativeTexture(const SkBitmap& pixels); |
137 | 137 |
138 // Wraps image data in a buffer backed by a base::SharedMemoryHandle with a | 138 // Wraps packed image data residing in a memory buffer with a VideoFrame. |
139 // VideoFrame. The image data resides in |data| and is assumed to be packed | 139 // The image data resides in |data| and is assumed to be packed tightly in a |
140 // tightly in a buffer of logical dimensions |coded_size| with the appropriate | 140 // buffer of logical dimensions |coded_size| with the appropriate bit depth |
141 // bit depth and plane count as given by |format|. When the frame is | 141 // and plane count as given by |format|. The shared memory handle of the |
142 // destroyed |no_longer_needed_cb.Run()| will be called. | 142 // backing allocation, if present, can be passed in with |handle|. When the |
143 static scoped_refptr<VideoFrame> WrapExternalSharedMemory( | 143 // frame is destroyed, |no_longer_needed_cb.Run()| will be called. |
144 static scoped_refptr<VideoFrame> WrapExternalPackedMemory( | |
144 Format format, | 145 Format format, |
145 const gfx::Size& coded_size, | 146 const gfx::Size& coded_size, |
146 const gfx::Rect& visible_rect, | 147 const gfx::Rect& visible_rect, |
147 const gfx::Size& natural_size, | 148 const gfx::Size& natural_size, |
148 uint8* data, | 149 uint8* data, |
149 size_t data_size, | 150 size_t data_size, |
150 base::SharedMemoryHandle handle, | 151 base::SharedMemoryHandle handle, |
151 base::TimeDelta timestamp, | 152 base::TimeDelta timestamp, |
152 const base::Closure& no_longer_needed_cb); | 153 const base::Closure& no_longer_needed_cb); |
153 | 154 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 // Allocates a hole frame. | 188 // Allocates a hole frame. |
188 static scoped_refptr<VideoFrame> CreateHoleFrame(const gfx::Size& size); | 189 static scoped_refptr<VideoFrame> CreateHoleFrame(const gfx::Size& size); |
189 #endif | 190 #endif |
190 | 191 |
191 static size_t NumPlanes(Format format); | 192 static size_t NumPlanes(Format format); |
192 | 193 |
193 // Returns the required allocation size for a (tightly packed) frame of the | 194 // Returns the required allocation size for a (tightly packed) frame of the |
194 // given coded size and format. | 195 // given coded size and format. |
195 static size_t AllocationSize(Format format, const gfx::Size& coded_size); | 196 static size_t AllocationSize(Format format, const gfx::Size& coded_size); |
196 | 197 |
198 // Returns the required allocation size for a (tightly packed) plane of the | |
199 // given coded size and format. | |
200 static size_t PlaneAllocationSize(Format format, | |
201 size_t plane, | |
Ami GONE FROM CHROMIUM
2013/11/19 21:01:52
size_t is a weird type to use for this. Please na
sheu
2013/11/19 21:30:27
Everything else uses size_t for plane index. Shou
ncarter (slow)
2013/11/19 21:36:42
I concur with sheu@; we should leave this as size_
| |
202 const gfx::Size& coded_size); | |
203 | |
197 Format format() const { return format_; } | 204 Format format() const { return format_; } |
198 | 205 |
199 const gfx::Size& coded_size() const { return coded_size_; } | 206 const gfx::Size& coded_size() const { return coded_size_; } |
200 const gfx::Rect& visible_rect() const { return visible_rect_; } | 207 const gfx::Rect& visible_rect() const { return visible_rect_; } |
201 const gfx::Size& natural_size() const { return natural_size_; } | 208 const gfx::Size& natural_size() const { return natural_size_; } |
202 | 209 |
203 int stride(size_t plane) const; | 210 int stride(size_t plane) const; |
204 | 211 |
205 // Returns the number of bytes per row and number of rows for a given plane. | 212 // Returns the number of bytes per row and number of rows for a given plane. |
206 // | 213 // |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 base::TimeDelta timestamp_; | 295 base::TimeDelta timestamp_; |
289 | 296 |
290 const bool end_of_stream_; | 297 const bool end_of_stream_; |
291 | 298 |
292 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 299 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
293 }; | 300 }; |
294 | 301 |
295 } // namespace media | 302 } // namespace media |
296 | 303 |
297 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 304 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |