| 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 // TODO(mcasas): Consider turning this type into STORAGE_NATIVE |
| 67 // meaningful name and handle it appropriately in all cases. | 67 // based on the idea of using this same enum value for both DMA |
| 68 // buffers on Linux and CVPixelBuffers on Mac (which currently use |
| 69 // STORAGE_UNOWNED_MEMORY) and handle it appropriately in all cases. |
| 68 STORAGE_DMABUFS = 5, // Each plane is stored into a DmaBuf. | 70 STORAGE_DMABUFS = 5, // Each plane is stored into a DmaBuf. |
| 69 #endif | 71 #endif |
| 70 STORAGE_MOJO_SHARED_BUFFER = 6, | 72 STORAGE_MOJO_SHARED_BUFFER = 6, |
| 71 STORAGE_LAST = STORAGE_MOJO_SHARED_BUFFER, | 73 STORAGE_LAST = STORAGE_MOJO_SHARED_BUFFER, |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 // CB to be called on the mailbox backing this frame when the frame is | 76 // CB to be called on the mailbox backing this frame when the frame is |
| 75 // destroyed. | 77 // destroyed. |
| 76 typedef base::Callback<void(const gpu::SyncToken&)> ReleaseMailboxCB; | 78 typedef base::Callback<void(const gpu::SyncToken&)> ReleaseMailboxCB; |
| 77 | 79 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 334 |
| 333 // Returns the shared-memory handle, if present | 335 // Returns the shared-memory handle, if present |
| 334 base::SharedMemoryHandle shared_memory_handle() const; | 336 base::SharedMemoryHandle shared_memory_handle() const; |
| 335 | 337 |
| 336 // Returns the offset into the shared memory where the frame data begins. | 338 // Returns the offset into the shared memory where the frame data begins. |
| 337 size_t shared_memory_offset() const; | 339 size_t shared_memory_offset() const; |
| 338 | 340 |
| 339 #if defined(OS_LINUX) | 341 #if defined(OS_LINUX) |
| 340 // Returns backing DmaBuf file descriptor for given |plane|, if present, or | 342 // Returns backing DmaBuf file descriptor for given |plane|, if present, or |
| 341 // -1 if not. | 343 // -1 if not. |
| 342 // TODO(mcasas): Rename to DmabufFd() to comply with Style Guide. | 344 int DmabufFd(size_t plane) const; |
| 343 int dmabuf_fd(size_t plane) const; | |
| 344 | 345 |
| 345 // Duplicates internally the |fds_in|, overwriting the current ones. Returns | 346 // Duplicates internally the |fds_in|, overwriting the current ones. Returns |
| 346 // false if something goes wrong, and leaves all internal fds closed. | 347 // false if something goes wrong, and leaves all internal fds closed. |
| 347 bool DuplicateFileDescriptors(const std::vector<int>& fds_in); | 348 bool DuplicateFileDescriptors(const std::vector<int>& fds_in); |
| 348 #endif | 349 #endif |
| 349 | 350 |
| 350 void AddSharedMemoryHandle(base::SharedMemoryHandle handle); | 351 void AddSharedMemoryHandle(base::SharedMemoryHandle handle); |
| 351 | 352 |
| 352 #if defined(OS_MACOSX) | 353 #if defined(OS_MACOSX) |
| 353 // Returns the backing CVPixelBuffer, if present. | 354 // Returns the backing CVPixelBuffer, if present. |
| 354 // TODO(mcasas): Rename to CvPixelBuffer() to comply with Style Guide. | 355 CVPixelBufferRef CvPixelBuffer() const; |
| 355 CVPixelBufferRef cv_pixel_buffer() const; | |
| 356 #endif | 356 #endif |
| 357 | 357 |
| 358 // Sets the mailbox release callback. | 358 // Sets the mailbox release callback. |
| 359 // | 359 // |
| 360 // The callback may be run from ANY THREAD, and so it is up to the client to | 360 // The callback may be run from ANY THREAD, and so it is up to the client to |
| 361 // ensure thread safety. | 361 // ensure thread safety. |
| 362 // | 362 // |
| 363 // WARNING: This method is not thread safe; it should only be called if you | 363 // WARNING: This method is not thread safe; it should only be called if you |
| 364 // are still the only owner of this VideoFrame. | 364 // are still the only owner of this VideoFrame. |
| 365 void SetReleaseMailboxCB(const ReleaseMailboxCB& release_mailbox_cb); | 365 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_; | 554 const int unique_id_; |
| 555 | 555 |
| 556 gfx::ColorSpace color_space_; | 556 gfx::ColorSpace color_space_; |
| 557 | 557 |
| 558 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 558 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
| 559 }; | 559 }; |
| 560 | 560 |
| 561 } // namespace media | 561 } // namespace media |
| 562 | 562 |
| 563 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 563 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
| OLD | NEW |