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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 // must be YUV). Buffers for the frame are allocated but not initialized. The | 106 // must be YUV). Buffers for the frame are allocated but not initialized. The |
107 // caller most not make assumptions about the actual underlying size(s), but | 107 // caller most not make assumptions about the actual underlying size(s), but |
108 // check the returned VideoFrame instead. | 108 // check the returned VideoFrame instead. |
109 // TODO(mcasas): implement the RGB version of this factory method. | 109 // TODO(mcasas): implement the RGB version of this factory method. |
110 static scoped_refptr<VideoFrame> CreateFrame(VideoPixelFormat format, | 110 static scoped_refptr<VideoFrame> CreateFrame(VideoPixelFormat format, |
111 const gfx::Size& coded_size, | 111 const gfx::Size& coded_size, |
112 const gfx::Rect& visible_rect, | 112 const gfx::Rect& visible_rect, |
113 const gfx::Size& natural_size, | 113 const gfx::Size& natural_size, |
114 base::TimeDelta timestamp); | 114 base::TimeDelta timestamp); |
115 | 115 |
116 // Offers the same functionality as CreateFrame. When |zero_initialize_memory| | |
117 // is true, it zeroes out the initial allocated buffers. | |
118 static scoped_refptr<VideoFrame> CreateFrame(VideoPixelFormat format, | |
miu
2015/09/03 22:06:13
nit: You could eliminate the boolean arg, and just
DaleCurtis
2015/09/04 22:25:13
I like CreateZeroInitializedFrame()
emircan
2015/09/04 23:59:22
sgtm. Done.
chcunningham
2015/09/05 00:07:51
+1
| |
119 const gfx::Size& coded_size, | |
120 const gfx::Rect& visible_rect, | |
121 const gfx::Size& natural_size, | |
122 base::TimeDelta timestamp, | |
123 bool zero_initialize_memory); | |
124 | |
116 // Wraps a native texture of the given parameters with a VideoFrame. | 125 // Wraps a native texture of the given parameters with a VideoFrame. |
117 // The backing of the VideoFrame is held in the mailbox held by | 126 // The backing of the VideoFrame is held in the mailbox held by |
118 // |mailbox_holder|, and |mailbox_holder_release_cb| will be called with | 127 // |mailbox_holder|, and |mailbox_holder_release_cb| will be called with |
119 // a syncpoint as the argument when the VideoFrame is to be destroyed. | 128 // a syncpoint as the argument when the VideoFrame is to be destroyed. |
120 static scoped_refptr<VideoFrame> WrapNativeTexture( | 129 static scoped_refptr<VideoFrame> WrapNativeTexture( |
121 VideoPixelFormat format, | 130 VideoPixelFormat format, |
122 const gpu::MailboxHolder& mailbox_holder, | 131 const gpu::MailboxHolder& mailbox_holder, |
123 const ReleaseMailboxCB& mailbox_holder_release_cb, | 132 const ReleaseMailboxCB& mailbox_holder_release_cb, |
124 const gfx::Size& coded_size, | 133 const gfx::Size& coded_size, |
125 const gfx::Rect& visible_rect, | 134 const gfx::Rect& visible_rect, |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 VideoFrame(VideoPixelFormat format, | 417 VideoFrame(VideoPixelFormat format, |
409 StorageType storage_type, | 418 StorageType storage_type, |
410 const gfx::Size& coded_size, | 419 const gfx::Size& coded_size, |
411 const gfx::Rect& visible_rect, | 420 const gfx::Rect& visible_rect, |
412 const gfx::Size& natural_size, | 421 const gfx::Size& natural_size, |
413 const gpu::MailboxHolder(&mailbox_holders)[kMaxPlanes], | 422 const gpu::MailboxHolder(&mailbox_holders)[kMaxPlanes], |
414 const ReleaseMailboxCB& mailbox_holder_release_cb, | 423 const ReleaseMailboxCB& mailbox_holder_release_cb, |
415 base::TimeDelta timestamp); | 424 base::TimeDelta timestamp); |
416 virtual ~VideoFrame(); | 425 virtual ~VideoFrame(); |
417 | 426 |
418 void AllocateYUV(); | 427 void AllocateYUV(bool zero_initialize_memory); |
419 | 428 |
420 // Frame format. | 429 // Frame format. |
421 const VideoPixelFormat format_; | 430 const VideoPixelFormat format_; |
422 | 431 |
423 // Storage type for the different planes. | 432 // Storage type for the different planes. |
424 StorageType storage_type_; // TODO(mcasas): make const | 433 StorageType storage_type_; // TODO(mcasas): make const |
425 | 434 |
426 // Width and height of the video frame, in pixels. This must include pixel | 435 // Width and height of the video frame, in pixels. This must include pixel |
427 // data for the whole image; i.e. for YUV formats with subsampled chroma | 436 // data for the whole image; i.e. for YUV formats with subsampled chroma |
428 // planes, in the case that the visible portion of the image does not line up | 437 // planes, in the case that the visible portion of the image does not line up |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 uint32 release_sync_point_; | 485 uint32 release_sync_point_; |
477 | 486 |
478 VideoFrameMetadata metadata_; | 487 VideoFrameMetadata metadata_; |
479 | 488 |
480 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 489 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
481 }; | 490 }; |
482 | 491 |
483 } // namespace media | 492 } // namespace media |
484 | 493 |
485 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 494 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |