| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // argument when the VideoFrame is to be destroyed. | 129 // argument when the VideoFrame is to be destroyed. |
| 130 static scoped_refptr<VideoFrame> WrapNativeTextures( | 130 static scoped_refptr<VideoFrame> WrapNativeTextures( |
| 131 VideoPixelFormat format, | 131 VideoPixelFormat format, |
| 132 const gpu::MailboxHolder (&mailbox_holder)[kMaxPlanes], | 132 const gpu::MailboxHolder (&mailbox_holder)[kMaxPlanes], |
| 133 const ReleaseMailboxCB& mailbox_holders_release_cb, | 133 const ReleaseMailboxCB& mailbox_holders_release_cb, |
| 134 const gfx::Size& coded_size, | 134 const gfx::Size& coded_size, |
| 135 const gfx::Rect& visible_rect, | 135 const gfx::Rect& visible_rect, |
| 136 const gfx::Size& natural_size, | 136 const gfx::Size& natural_size, |
| 137 base::TimeDelta timestamp); | 137 base::TimeDelta timestamp); |
| 138 | 138 |
| 139 // Wraps a set of GpuMemoryBuffer-backed native textures with a VideoFrame. |
| 140 // |mailbox_holders_release_cb| will be called with a sync token as the |
| 141 // argument when the VideoFrame is to be destroyed. |
| 142 static scoped_refptr<VideoFrame> WrapGpuMemoryBufferBackedNativeTextures( |
| 143 VideoPixelFormat format, |
| 144 const gpu::MailboxHolder (&mailbox_holder)[kMaxPlanes], |
| 145 const gfx::GpuMemoryBufferId (&gpu_memory_buffer_ids)[kMaxPlanes], |
| 146 const ReleaseMailboxCB& mailbox_holders_release_cb, |
| 147 const gfx::Size& coded_size, |
| 148 const gfx::Rect& visible_rect, |
| 149 const gfx::Size& natural_size, |
| 150 base::TimeDelta timestamp); |
| 151 |
| 139 // Wraps packed image data residing in a memory buffer with a VideoFrame. | 152 // Wraps packed image data residing in a memory buffer with a VideoFrame. |
| 140 // The image data resides in |data| and is assumed to be packed tightly in a | 153 // The image data resides in |data| and is assumed to be packed tightly in a |
| 141 // buffer of logical dimensions |coded_size| with the appropriate bit depth | 154 // buffer of logical dimensions |coded_size| with the appropriate bit depth |
| 142 // and plane count as given by |format|. Returns NULL on failure. | 155 // and plane count as given by |format|. Returns NULL on failure. |
| 143 static scoped_refptr<VideoFrame> WrapExternalData( | 156 static scoped_refptr<VideoFrame> WrapExternalData( |
| 144 VideoPixelFormat format, | 157 VideoPixelFormat format, |
| 145 const gfx::Size& coded_size, | 158 const gfx::Size& coded_size, |
| 146 const gfx::Rect& visible_rect, | 159 const gfx::Rect& visible_rect, |
| 147 const gfx::Size& natural_size, | 160 const gfx::Size& natural_size, |
| 148 uint8_t* data, | 161 uint8_t* data, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 // plane buffer specified by visible_rect().origin(). Memory is owned by | 345 // plane buffer specified by visible_rect().origin(). Memory is owned by |
| 333 // VideoFrame object and must not be freed by the caller. | 346 // VideoFrame object and must not be freed by the caller. |
| 334 const uint8_t* visible_data(size_t plane) const; | 347 const uint8_t* visible_data(size_t plane) const; |
| 335 uint8_t* visible_data(size_t plane); | 348 uint8_t* visible_data(size_t plane); |
| 336 | 349 |
| 337 // Returns a mailbox holder for a given texture. | 350 // Returns a mailbox holder for a given texture. |
| 338 // Only valid to call if this is a NATIVE_TEXTURE frame. Before using the | 351 // Only valid to call if this is a NATIVE_TEXTURE frame. Before using the |
| 339 // mailbox, the caller must wait for the included sync point. | 352 // mailbox, the caller must wait for the included sync point. |
| 340 const gpu::MailboxHolder& mailbox_holder(size_t texture_index) const; | 353 const gpu::MailboxHolder& mailbox_holder(size_t texture_index) const; |
| 341 | 354 |
| 355 // Returns the GpuMemoryBufferId for the GpuMemoryBuffer that backs a |
| 356 // a given texture. |
| 357 const gfx::GpuMemoryBufferId& texture_gpu_memory_buffer_id( |
| 358 size_t texture_index) const; |
| 359 |
| 342 // Returns the shared-memory handle, if present | 360 // Returns the shared-memory handle, if present |
| 343 base::SharedMemoryHandle shared_memory_handle() const; | 361 base::SharedMemoryHandle shared_memory_handle() const; |
| 344 | 362 |
| 345 // Returns the offset into the shared memory where the frame data begins. | 363 // Returns the offset into the shared memory where the frame data begins. |
| 346 size_t shared_memory_offset() const; | 364 size_t shared_memory_offset() const; |
| 347 | 365 |
| 348 // Returns the vector of GpuMemoryBuffer handles, if present. | 366 // Returns the vector of GpuMemoryBuffer handles, if present. |
| 349 const std::vector<gfx::GpuMemoryBufferHandle>& gpu_memory_buffer_handles() | 367 const std::vector<gfx::GpuMemoryBufferHandle>& gpu_memory_buffer_handles() |
| 350 const; | 368 const; |
| 351 | 369 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 | 533 |
| 516 // Array of data pointers to each plane. | 534 // Array of data pointers to each plane. |
| 517 // TODO(mcasas): we don't know on ctor if we own |data_| or not. Change | 535 // TODO(mcasas): we don't know on ctor if we own |data_| or not. Change |
| 518 // to std::unique_ptr<uint8_t, AlignedFreeDeleter> after refactoring | 536 // to std::unique_ptr<uint8_t, AlignedFreeDeleter> after refactoring |
| 519 // VideoFrame. | 537 // VideoFrame. |
| 520 uint8_t* data_[kMaxPlanes]; | 538 uint8_t* data_[kMaxPlanes]; |
| 521 | 539 |
| 522 // Native texture mailboxes, if this is a IsTexture() frame. | 540 // Native texture mailboxes, if this is a IsTexture() frame. |
| 523 gpu::MailboxHolder mailbox_holders_[kMaxPlanes]; | 541 gpu::MailboxHolder mailbox_holders_[kMaxPlanes]; |
| 524 ReleaseMailboxCB mailbox_holders_release_cb_; | 542 ReleaseMailboxCB mailbox_holders_release_cb_; |
| 543 gfx::GpuMemoryBufferId texture_gpu_memory_buffer_ids_[kMaxPlanes]; |
| 525 | 544 |
| 526 // Shared memory handle and associated offset inside it, if this frame is | 545 // Shared memory handle and associated offset inside it, if this frame is |
| 527 // a STORAGE_SHMEM one. | 546 // a STORAGE_SHMEM one. |
| 528 base::SharedMemoryHandle shared_memory_handle_; | 547 base::SharedMemoryHandle shared_memory_handle_; |
| 529 size_t shared_memory_offset_; | 548 size_t shared_memory_offset_; |
| 530 | 549 |
| 531 // GpuMemoryBuffer handles attached to the video_frame. | 550 // GpuMemoryBuffer handles attached to the video_frame. |
| 532 std::vector<gfx::GpuMemoryBufferHandle> gpu_memory_buffer_handles_; | 551 std::vector<gfx::GpuMemoryBufferHandle> gpu_memory_buffer_handles_; |
| 533 | 552 |
| 534 #if defined(OS_LINUX) | 553 #if defined(OS_LINUX) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 549 gpu::SyncToken release_sync_token_; | 568 gpu::SyncToken release_sync_token_; |
| 550 | 569 |
| 551 VideoFrameMetadata metadata_; | 570 VideoFrameMetadata metadata_; |
| 552 | 571 |
| 553 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 572 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
| 554 }; | 573 }; |
| 555 | 574 |
| 556 } // namespace media | 575 } // namespace media |
| 557 | 576 |
| 558 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 577 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
| OLD | NEW |