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, and additionally zeroes out |
| 117 // the initial allocated buffers. |
| 118 static scoped_refptr<VideoFrame> CreateZeroInitializedFrame( |
| 119 VideoPixelFormat format, |
| 120 const gfx::Size& coded_size, |
| 121 const gfx::Rect& visible_rect, |
| 122 const gfx::Size& natural_size, |
| 123 base::TimeDelta timestamp); |
| 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 static scoped_refptr<VideoFrame> CreateFrameInternal( |
| 428 VideoPixelFormat format, |
| 429 const gfx::Size& coded_size, |
| 430 const gfx::Rect& visible_rect, |
| 431 const gfx::Size& natural_size, |
| 432 base::TimeDelta timestamp, |
| 433 bool zero_initialize_memory); |
| 434 |
| 435 void AllocateYUV(bool zero_initialize_memory); |
419 | 436 |
420 // Frame format. | 437 // Frame format. |
421 const VideoPixelFormat format_; | 438 const VideoPixelFormat format_; |
422 | 439 |
423 // Storage type for the different planes. | 440 // Storage type for the different planes. |
424 StorageType storage_type_; // TODO(mcasas): make const | 441 StorageType storage_type_; // TODO(mcasas): make const |
425 | 442 |
426 // Width and height of the video frame, in pixels. This must include pixel | 443 // 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 | 444 // 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 | 445 // 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_; | 493 uint32 release_sync_point_; |
477 | 494 |
478 VideoFrameMetadata metadata_; | 495 VideoFrameMetadata metadata_; |
479 | 496 |
480 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 497 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
481 }; | 498 }; |
482 | 499 |
483 } // namespace media | 500 } // namespace media |
484 | 501 |
485 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 502 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |