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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 VideoPixelFormat format, | 155 VideoPixelFormat format, |
156 const gfx::Size& coded_size, | 156 const gfx::Size& coded_size, |
157 const gfx::Rect& visible_rect, | 157 const gfx::Rect& visible_rect, |
158 const gfx::Size& natural_size, | 158 const gfx::Size& natural_size, |
159 uint8_t* data, | 159 uint8_t* data, |
160 size_t data_size, | 160 size_t data_size, |
161 base::SharedMemoryHandle handle, | 161 base::SharedMemoryHandle handle, |
162 size_t shared_memory_offset, | 162 size_t shared_memory_offset, |
163 base::TimeDelta timestamp); | 163 base::TimeDelta timestamp); |
164 | 164 |
| 165 // Same as WrapExternalData() with GpuMemoryBuffers. |
| 166 // The returned VideoFrame does not own the GpuMemoryBuffer. |
| 167 static scoped_refptr<VideoFrame> WrapExternalGpuMemoryBuffer( |
| 168 VideoPixelFormat format, |
| 169 const gfx::Size& coded_size, |
| 170 const gfx::Rect& visible_rect, |
| 171 const gfx::Size& natural_size, |
| 172 uint8_t* data, |
| 173 const gfx::GpuMemoryBufferHandle& y_handle, |
| 174 base::TimeDelta timestamp); |
| 175 |
165 // Wraps external YUV data of the given parameters with a VideoFrame. | 176 // Wraps external YUV data of the given parameters with a VideoFrame. |
166 // The returned VideoFrame does not own the data passed in. | 177 // The returned VideoFrame does not own the data passed in. |
167 static scoped_refptr<VideoFrame> WrapExternalYuvData( | 178 static scoped_refptr<VideoFrame> WrapExternalYuvData( |
168 VideoPixelFormat format, | 179 VideoPixelFormat format, |
169 const gfx::Size& coded_size, | 180 const gfx::Size& coded_size, |
170 const gfx::Rect& visible_rect, | 181 const gfx::Rect& visible_rect, |
171 const gfx::Size& natural_size, | 182 const gfx::Size& natural_size, |
172 int32_t y_stride, | 183 int32_t y_stride, |
173 int32_t u_stride, | 184 int32_t u_stride, |
174 int32_t v_stride, | 185 int32_t v_stride, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 318 |
308 // Returns the number of columns for the given plane, format, and width. | 319 // Returns the number of columns for the given plane, format, and width. |
309 // The width may be aligned to format requirements. | 320 // The width may be aligned to format requirements. |
310 static size_t Columns(size_t plane, VideoPixelFormat format, int width); | 321 static size_t Columns(size_t plane, VideoPixelFormat format, int width); |
311 | 322 |
312 // Used to keep a running hash of seen frames. Expects an initialized MD5 | 323 // Used to keep a running hash of seen frames. Expects an initialized MD5 |
313 // context. Calls MD5Update with the context and the contents of the frame. | 324 // context. Calls MD5Update with the context and the contents of the frame. |
314 static void HashFrameForTesting(base::MD5Context* context, | 325 static void HashFrameForTesting(base::MD5Context* context, |
315 const scoped_refptr<VideoFrame>& frame); | 326 const scoped_refptr<VideoFrame>& frame); |
316 | 327 |
| 328 // Returns the BufferFormat to use for the given VideoPixelFormat. |
| 329 static gfx::BufferFormat BufferFormat(VideoPixelFormat format); |
| 330 |
317 // Returns true if |frame| is accessible and mapped in the VideoFrame memory | 331 // Returns true if |frame| is accessible and mapped in the VideoFrame memory |
318 // space. If false, clients should refrain from accessing data(), | 332 // space. If false, clients should refrain from accessing data(), |
319 // visible_data() etc. | 333 // visible_data() etc. |
320 bool IsMappable() const; | 334 bool IsMappable() const; |
321 | 335 |
322 // Returns true if |frame| has textures with any StorageType and should not be | 336 // Returns true if |frame| has textures with any StorageType and should not be |
323 // accessed via data(), visible_data() etc. | 337 // accessed via data(), visible_data() etc. |
324 bool HasTextures() const; | 338 bool HasTextures() const; |
325 | 339 |
326 // Returns the color space of this frame's content. | 340 // Returns the color space of this frame's content. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 const int unique_id_; | 594 const int unique_id_; |
581 | 595 |
582 gfx::ColorSpace color_space_; | 596 gfx::ColorSpace color_space_; |
583 | 597 |
584 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 598 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
585 }; | 599 }; |
586 | 600 |
587 } // namespace media | 601 } // namespace media |
588 | 602 |
589 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 603 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |