Chromium Code Reviews| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 // memory. | 56 // memory. |
| 57 // Note that VideoFrames of any StorageType can also have Texture backing, | 57 // Note that VideoFrames of any StorageType can also have Texture backing, |
| 58 // with "classical" GPU Driver-only textures identified as STORAGE_OPAQUE. | 58 // with "classical" GPU Driver-only textures identified as STORAGE_OPAQUE. |
| 59 enum StorageType { | 59 enum StorageType { |
| 60 STORAGE_UNKNOWN = 0, | 60 STORAGE_UNKNOWN = 0, |
| 61 STORAGE_OPAQUE = 1, // We don't know how VideoFrame's pixels are stored. | 61 STORAGE_OPAQUE = 1, // We don't know how VideoFrame's pixels are stored. |
| 62 STORAGE_UNOWNED_MEMORY = 2, // External, non owned data pointers. | 62 STORAGE_UNOWNED_MEMORY = 2, // External, non owned data pointers. |
| 63 STORAGE_OWNED_MEMORY = 3, // VideoFrame has allocated its own data buffer. | 63 STORAGE_OWNED_MEMORY = 3, // VideoFrame has allocated its own data buffer. |
| 64 STORAGE_SHMEM = 4, // Pixels are backed by Shared Memory. | 64 STORAGE_SHMEM = 4, // Pixels are backed by Shared Memory. |
| 65 #if defined(OS_LINUX) | 65 #if defined(OS_LINUX) |
| 66 // TODO(mcasas): Consider turning this type into STORAGE_NATIVE or another | 66 STORAGE_NATIVE = 5, // Each plane is stored into a DmaBuf. |
|
chfremer
2017/03/30 17:55:44
Why is STORAGE_NATIVE a more appropriate name than
Uzair
2017/03/31 10:09:19
Updated the name as per comment mentioned, but yes
| |
| 67 // meaningful name and handle it appropriately in all cases. | |
| 68 STORAGE_DMABUFS = 5, // Each plane is stored into a DmaBuf. | |
| 69 #endif | 67 #endif |
| 70 STORAGE_MOJO_SHARED_BUFFER = 6, | 68 STORAGE_MOJO_SHARED_BUFFER = 6, |
| 71 STORAGE_LAST = STORAGE_MOJO_SHARED_BUFFER, | 69 STORAGE_LAST = STORAGE_MOJO_SHARED_BUFFER, |
| 72 }; | 70 }; |
| 73 | 71 |
| 74 // CB to be called on the mailbox backing this frame when the frame is | 72 // CB to be called on the mailbox backing this frame when the frame is |
| 75 // destroyed. | 73 // destroyed. |
| 76 typedef base::Callback<void(const gpu::SyncToken&)> ReleaseMailboxCB; | 74 typedef base::Callback<void(const gpu::SyncToken&)> ReleaseMailboxCB; |
| 77 | 75 |
| 78 // Interface representing client operations on a SyncToken, i.e. insert one in | 76 // Interface representing client operations on a SyncToken, i.e. insert one in |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 | 330 |
| 333 // Returns the shared-memory handle, if present | 331 // Returns the shared-memory handle, if present |
| 334 base::SharedMemoryHandle shared_memory_handle() const; | 332 base::SharedMemoryHandle shared_memory_handle() const; |
| 335 | 333 |
| 336 // Returns the offset into the shared memory where the frame data begins. | 334 // Returns the offset into the shared memory where the frame data begins. |
| 337 size_t shared_memory_offset() const; | 335 size_t shared_memory_offset() const; |
| 338 | 336 |
| 339 #if defined(OS_LINUX) | 337 #if defined(OS_LINUX) |
| 340 // Returns backing DmaBuf file descriptor for given |plane|, if present, or | 338 // Returns backing DmaBuf file descriptor for given |plane|, if present, or |
| 341 // -1 if not. | 339 // -1 if not. |
| 342 // TODO(mcasas): Rename to DmabufFd() to comply with Style Guide. | 340 int DmabufFd(size_t plane) const; |
|
chfremer
2017/03/30 17:55:44
If we do not want to be as specific as saying "DMA
Uzair
2017/03/31 10:09:19
Changed above as i am not aware of any Non DMA buf
| |
| 343 int dmabuf_fd(size_t plane) const; | |
| 344 | 341 |
| 345 // Duplicates internally the |fds_in|, overwriting the current ones. Returns | 342 // Duplicates internally the |fds_in|, overwriting the current ones. Returns |
| 346 // false if something goes wrong, and leaves all internal fds closed. | 343 // false if something goes wrong, and leaves all internal fds closed. |
| 347 bool DuplicateFileDescriptors(const std::vector<int>& fds_in); | 344 bool DuplicateFileDescriptors(const std::vector<int>& fds_in); |
| 348 #endif | 345 #endif |
| 349 | 346 |
| 350 void AddSharedMemoryHandle(base::SharedMemoryHandle handle); | 347 void AddSharedMemoryHandle(base::SharedMemoryHandle handle); |
| 351 | 348 |
| 352 #if defined(OS_MACOSX) | 349 #if defined(OS_MACOSX) |
| 353 // Returns the backing CVPixelBuffer, if present. | 350 // Returns the backing CVPixelBuffer, if present. |
| 354 // TODO(mcasas): Rename to CvPixelBuffer() to comply with Style Guide. | 351 CVPixelBufferRef CvPixelBuffer() const; |
| 355 CVPixelBufferRef cv_pixel_buffer() const; | |
| 356 #endif | 352 #endif |
| 357 | 353 |
| 358 // Sets the mailbox release callback. | 354 // Sets the mailbox release callback. |
| 359 // | 355 // |
| 360 // The callback may be run from ANY THREAD, and so it is up to the client to | 356 // The callback may be run from ANY THREAD, and so it is up to the client to |
| 361 // ensure thread safety. | 357 // ensure thread safety. |
| 362 // | 358 // |
| 363 // WARNING: This method is not thread safe; it should only be called if you | 359 // WARNING: This method is not thread safe; it should only be called if you |
| 364 // are still the only owner of this VideoFrame. | 360 // are still the only owner of this VideoFrame. |
| 365 void SetReleaseMailboxCB(const ReleaseMailboxCB& release_mailbox_cb); | 361 void SetReleaseMailboxCB(const ReleaseMailboxCB& release_mailbox_cb); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 const int unique_id_; | 550 const int unique_id_; |
| 555 | 551 |
| 556 gfx::ColorSpace color_space_; | 552 gfx::ColorSpace color_space_; |
| 557 | 553 |
| 558 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 554 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
| 559 }; | 555 }; |
| 560 | 556 |
| 561 } // namespace media | 557 } // namespace media |
| 562 | 558 |
| 563 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 559 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
| OLD | NEW |