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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 VideoPixelFormat format, | 149 VideoPixelFormat format, |
150 const gfx::Size& coded_size, | 150 const gfx::Size& coded_size, |
151 const gfx::Rect& visible_rect, | 151 const gfx::Rect& visible_rect, |
152 const gfx::Size& natural_size, | 152 const gfx::Size& natural_size, |
153 uint8_t* data, | 153 uint8_t* data, |
154 size_t data_size, | 154 size_t data_size, |
155 base::SharedMemoryHandle handle, | 155 base::SharedMemoryHandle handle, |
156 size_t shared_memory_offset, | 156 size_t shared_memory_offset, |
157 base::TimeDelta timestamp); | 157 base::TimeDelta timestamp); |
158 | 158 |
| 159 // Same as WrapExternalData() with GpuMemoryBuffers. |
| 160 // The returned VideoFrame does not own the GpuMemoryBuffer. |
| 161 static scoped_refptr<VideoFrame> WrapExternalGpuMemoryBuffer( |
| 162 VideoPixelFormat format, |
| 163 const gfx::Size& coded_size, |
| 164 const gfx::Rect& visible_rect, |
| 165 const gfx::Size& natural_size, |
| 166 uint8_t* data, |
| 167 const gfx::GpuMemoryBufferHandle& y_handle, |
| 168 base::TimeDelta timestamp); |
| 169 |
159 // Wraps external YUV data of the given parameters with a VideoFrame. | 170 // Wraps external YUV data of the given parameters with a VideoFrame. |
160 // The returned VideoFrame does not own the data passed in. | 171 // The returned VideoFrame does not own the data passed in. |
161 static scoped_refptr<VideoFrame> WrapExternalYuvData( | 172 static scoped_refptr<VideoFrame> WrapExternalYuvData( |
162 VideoPixelFormat format, | 173 VideoPixelFormat format, |
163 const gfx::Size& coded_size, | 174 const gfx::Size& coded_size, |
164 const gfx::Rect& visible_rect, | 175 const gfx::Rect& visible_rect, |
165 const gfx::Size& natural_size, | 176 const gfx::Size& natural_size, |
166 int32_t y_stride, | 177 int32_t y_stride, |
167 int32_t u_stride, | 178 int32_t u_stride, |
168 int32_t v_stride, | 179 int32_t v_stride, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 307 |
297 // Returns the number of columns for the given plane, format, and width. | 308 // Returns the number of columns for the given plane, format, and width. |
298 // The width may be aligned to format requirements. | 309 // The width may be aligned to format requirements. |
299 static size_t Columns(size_t plane, VideoPixelFormat format, int width); | 310 static size_t Columns(size_t plane, VideoPixelFormat format, int width); |
300 | 311 |
301 // Used to keep a running hash of seen frames. Expects an initialized MD5 | 312 // Used to keep a running hash of seen frames. Expects an initialized MD5 |
302 // context. Calls MD5Update with the context and the contents of the frame. | 313 // context. Calls MD5Update with the context and the contents of the frame. |
303 static void HashFrameForTesting(base::MD5Context* context, | 314 static void HashFrameForTesting(base::MD5Context* context, |
304 const scoped_refptr<VideoFrame>& frame); | 315 const scoped_refptr<VideoFrame>& frame); |
305 | 316 |
| 317 // Returns the BufferFormat to use for the given VideoPixelFormat. |
| 318 static gfx::BufferFormat BufferFormat(VideoPixelFormat format); |
| 319 |
306 // Returns true if |frame| is accessible and mapped in the VideoFrame memory | 320 // Returns true if |frame| is accessible and mapped in the VideoFrame memory |
307 // space. If false, clients should refrain from accessing data(), | 321 // space. If false, clients should refrain from accessing data(), |
308 // visible_data() etc. | 322 // visible_data() etc. |
309 bool IsMappable() const; | 323 bool IsMappable() const; |
310 | 324 |
311 // Returns true if |frame| has textures with any StorageType and should not be | 325 // Returns true if |frame| has textures with any StorageType and should not be |
312 // accessed via data(), visible_data() etc. | 326 // accessed via data(), visible_data() etc. |
313 bool HasTextures() const; | 327 bool HasTextures() const; |
314 | 328 |
315 // Returns the color space of this frame's content. | 329 // Returns the color space of this frame's content. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 const int unique_id_; | 583 const int unique_id_; |
570 | 584 |
571 gfx::ColorSpace color_space_; | 585 gfx::ColorSpace color_space_; |
572 | 586 |
573 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 587 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
574 }; | 588 }; |
575 | 589 |
576 } // namespace media | 590 } // namespace media |
577 | 591 |
578 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 592 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |