| 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 | |
| 152 // Wraps packed image data residing in a memory buffer with a VideoFrame. | 139 // Wraps packed image data residing in a memory buffer with a VideoFrame. |
| 153 // The image data resides in |data| and is assumed to be packed tightly in a | 140 // The image data resides in |data| and is assumed to be packed tightly in a |
| 154 // buffer of logical dimensions |coded_size| with the appropriate bit depth | 141 // buffer of logical dimensions |coded_size| with the appropriate bit depth |
| 155 // and plane count as given by |format|. Returns NULL on failure. | 142 // and plane count as given by |format|. Returns NULL on failure. |
| 156 static scoped_refptr<VideoFrame> WrapExternalData( | 143 static scoped_refptr<VideoFrame> WrapExternalData( |
| 157 VideoPixelFormat format, | 144 VideoPixelFormat format, |
| 158 const gfx::Size& coded_size, | 145 const gfx::Size& coded_size, |
| 159 const gfx::Rect& visible_rect, | 146 const gfx::Rect& visible_rect, |
| 160 const gfx::Size& natural_size, | 147 const gfx::Size& natural_size, |
| 161 uint8_t* data, | 148 uint8_t* data, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 // plane buffer specified by visible_rect().origin(). Memory is owned by | 332 // plane buffer specified by visible_rect().origin(). Memory is owned by |
| 346 // VideoFrame object and must not be freed by the caller. | 333 // VideoFrame object and must not be freed by the caller. |
| 347 const uint8_t* visible_data(size_t plane) const; | 334 const uint8_t* visible_data(size_t plane) const; |
| 348 uint8_t* visible_data(size_t plane); | 335 uint8_t* visible_data(size_t plane); |
| 349 | 336 |
| 350 // Returns a mailbox holder for a given texture. | 337 // Returns a mailbox holder for a given texture. |
| 351 // Only valid to call if this is a NATIVE_TEXTURE frame. Before using the | 338 // Only valid to call if this is a NATIVE_TEXTURE frame. Before using the |
| 352 // mailbox, the caller must wait for the included sync point. | 339 // mailbox, the caller must wait for the included sync point. |
| 353 const gpu::MailboxHolder& mailbox_holder(size_t texture_index) const; | 340 const gpu::MailboxHolder& mailbox_holder(size_t texture_index) const; |
| 354 | 341 |
| 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 | |
| 360 // Returns the shared-memory handle, if present | 342 // Returns the shared-memory handle, if present |
| 361 base::SharedMemoryHandle shared_memory_handle() const; | 343 base::SharedMemoryHandle shared_memory_handle() const; |
| 362 | 344 |
| 363 // Returns the offset into the shared memory where the frame data begins. | 345 // Returns the offset into the shared memory where the frame data begins. |
| 364 size_t shared_memory_offset() const; | 346 size_t shared_memory_offset() const; |
| 365 | 347 |
| 366 // Returns the vector of GpuMemoryBuffer handles, if present. | 348 // Returns the vector of GpuMemoryBuffer handles, if present. |
| 367 const std::vector<gfx::GpuMemoryBufferHandle>& gpu_memory_buffer_handles() | 349 const std::vector<gfx::GpuMemoryBufferHandle>& gpu_memory_buffer_handles() |
| 368 const; | 350 const; |
| 369 | 351 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 | 519 |
| 538 // Array of data pointers to each plane. | 520 // Array of data pointers to each plane. |
| 539 // TODO(mcasas): we don't know on ctor if we own |data_| or not. Change | 521 // TODO(mcasas): we don't know on ctor if we own |data_| or not. Change |
| 540 // to std::unique_ptr<uint8_t, AlignedFreeDeleter> after refactoring | 522 // to std::unique_ptr<uint8_t, AlignedFreeDeleter> after refactoring |
| 541 // VideoFrame. | 523 // VideoFrame. |
| 542 uint8_t* data_[kMaxPlanes]; | 524 uint8_t* data_[kMaxPlanes]; |
| 543 | 525 |
| 544 // Native texture mailboxes, if this is a IsTexture() frame. | 526 // Native texture mailboxes, if this is a IsTexture() frame. |
| 545 gpu::MailboxHolder mailbox_holders_[kMaxPlanes]; | 527 gpu::MailboxHolder mailbox_holders_[kMaxPlanes]; |
| 546 ReleaseMailboxCB mailbox_holders_release_cb_; | 528 ReleaseMailboxCB mailbox_holders_release_cb_; |
| 547 gfx::GpuMemoryBufferId texture_gpu_memory_buffer_ids_[kMaxPlanes]; | |
| 548 | 529 |
| 549 // Shared memory handle and associated offset inside it, if this frame is | 530 // Shared memory handle and associated offset inside it, if this frame is |
| 550 // a STORAGE_SHMEM one. | 531 // a STORAGE_SHMEM one. |
| 551 base::SharedMemoryHandle shared_memory_handle_; | 532 base::SharedMemoryHandle shared_memory_handle_; |
| 552 size_t shared_memory_offset_; | 533 size_t shared_memory_offset_; |
| 553 | 534 |
| 554 // GpuMemoryBuffer handles attached to the video_frame. | 535 // GpuMemoryBuffer handles attached to the video_frame. |
| 555 std::vector<gfx::GpuMemoryBufferHandle> gpu_memory_buffer_handles_; | 536 std::vector<gfx::GpuMemoryBufferHandle> gpu_memory_buffer_handles_; |
| 556 | 537 |
| 557 #if defined(OS_LINUX) | 538 #if defined(OS_LINUX) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 575 | 556 |
| 576 // Generated at construction time. | 557 // Generated at construction time. |
| 577 const int unique_id_; | 558 const int unique_id_; |
| 578 | 559 |
| 579 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 560 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
| 580 }; | 561 }; |
| 581 | 562 |
| 582 } // namespace media | 563 } // namespace media |
| 583 | 564 |
| 584 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 565 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
| OLD | NEW |