| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // frame is destroyed, |no_longer_needed_cb.Run()| will be called. | 130 // frame is destroyed, |no_longer_needed_cb.Run()| will be called. |
| 131 // Returns NULL on failure. | 131 // Returns NULL on failure. |
| 132 static scoped_refptr<VideoFrame> WrapExternalPackedMemory( | 132 static scoped_refptr<VideoFrame> WrapExternalPackedMemory( |
| 133 Format format, | 133 Format format, |
| 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 uint8* data, | 137 uint8* data, |
| 138 size_t data_size, | 138 size_t data_size, |
| 139 base::SharedMemoryHandle handle, | 139 base::SharedMemoryHandle handle, |
| 140 size_t data_offset, |
| 140 base::TimeDelta timestamp, | 141 base::TimeDelta timestamp, |
| 141 const base::Closure& no_longer_needed_cb); | 142 const base::Closure& no_longer_needed_cb); |
| 142 | 143 |
| 143 #if defined(OS_POSIX) | 144 #if defined(OS_POSIX) |
| 144 // Wraps provided dmabufs | 145 // Wraps provided dmabufs |
| 145 // (https://www.kernel.org/doc/Documentation/dma-buf-sharing.txt) with a | 146 // (https://www.kernel.org/doc/Documentation/dma-buf-sharing.txt) with a |
| 146 // VideoFrame. The dmabuf fds are dup()ed on creation, so that the VideoFrame | 147 // VideoFrame. The dmabuf fds are dup()ed on creation, so that the VideoFrame |
| 147 // retains a reference to them, and are automatically close()d on destruction, | 148 // retains a reference to them, and are automatically close()d on destruction, |
| 148 // dropping the reference. The caller may safely close() its reference after | 149 // dropping the reference. The caller may safely close() its reference after |
| 149 // calling WrapExternalDmabufs(). | 150 // calling WrapExternalDmabufs(). |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 uint8* visible_data(size_t plane); | 292 uint8* visible_data(size_t plane); |
| 292 | 293 |
| 293 // Returns the mailbox holder of the native texture wrapped by this frame. | 294 // Returns the mailbox holder of the native texture wrapped by this frame. |
| 294 // Only valid to call if this is a NATIVE_TEXTURE frame. Before using the | 295 // Only valid to call if this is a NATIVE_TEXTURE frame. Before using the |
| 295 // mailbox, the caller must wait for the included sync point. | 296 // mailbox, the caller must wait for the included sync point. |
| 296 const gpu::MailboxHolder* mailbox_holder() const; | 297 const gpu::MailboxHolder* mailbox_holder() const; |
| 297 | 298 |
| 298 // Returns the shared-memory handle, if present | 299 // Returns the shared-memory handle, if present |
| 299 base::SharedMemoryHandle shared_memory_handle() const; | 300 base::SharedMemoryHandle shared_memory_handle() const; |
| 300 | 301 |
| 302 // Return the offset with the shared-memory handle. |
| 303 size_t shared_memory_offset() const; |
| 304 |
| 301 #if defined(OS_POSIX) | 305 #if defined(OS_POSIX) |
| 302 // Returns backing dmabuf file descriptor for given |plane|, if present. | 306 // Returns backing dmabuf file descriptor for given |plane|, if present. |
| 303 int dmabuf_fd(size_t plane) const; | 307 int dmabuf_fd(size_t plane) const; |
| 304 #endif | 308 #endif |
| 305 | 309 |
| 306 #if defined(OS_MACOSX) | 310 #if defined(OS_MACOSX) |
| 307 // Returns the backing CVPixelBuffer, if present. | 311 // Returns the backing CVPixelBuffer, if present. |
| 308 CVPixelBufferRef cv_pixel_buffer() const; | 312 CVPixelBufferRef cv_pixel_buffer() const; |
| 309 #endif | 313 #endif |
| 310 | 314 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 uint8* data_[kMaxPlanes]; | 386 uint8* data_[kMaxPlanes]; |
| 383 | 387 |
| 384 // Native texture mailbox, if this is a NATIVE_TEXTURE frame. | 388 // Native texture mailbox, if this is a NATIVE_TEXTURE frame. |
| 385 const scoped_ptr<gpu::MailboxHolder> mailbox_holder_; | 389 const scoped_ptr<gpu::MailboxHolder> mailbox_holder_; |
| 386 ReleaseMailboxCB mailbox_holder_release_cb_; | 390 ReleaseMailboxCB mailbox_holder_release_cb_; |
| 387 ReadPixelsCB read_pixels_cb_; | 391 ReadPixelsCB read_pixels_cb_; |
| 388 | 392 |
| 389 // Shared memory handle, if this frame was allocated from shared memory. | 393 // Shared memory handle, if this frame was allocated from shared memory. |
| 390 base::SharedMemoryHandle shared_memory_handle_; | 394 base::SharedMemoryHandle shared_memory_handle_; |
| 391 | 395 |
| 396 // Offset in shared memory buffer. |
| 397 size_t shared_memory_offset_; |
| 398 |
| 392 #if defined(OS_POSIX) | 399 #if defined(OS_POSIX) |
| 393 // Dmabufs for each plane, if this frame is wrapping memory | 400 // Dmabufs for each plane, if this frame is wrapping memory |
| 394 // acquired via dmabuf. | 401 // acquired via dmabuf. |
| 395 base::ScopedFD dmabuf_fds_[kMaxPlanes]; | 402 base::ScopedFD dmabuf_fds_[kMaxPlanes]; |
| 396 #endif | 403 #endif |
| 397 | 404 |
| 398 #if defined(OS_MACOSX) | 405 #if defined(OS_MACOSX) |
| 399 // CVPixelBuffer, if this frame is wrapping one. | 406 // CVPixelBuffer, if this frame is wrapping one. |
| 400 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer_; | 407 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer_; |
| 401 #endif | 408 #endif |
| 402 | 409 |
| 403 base::Closure no_longer_needed_cb_; | 410 base::Closure no_longer_needed_cb_; |
| 404 | 411 |
| 405 base::TimeDelta timestamp_; | 412 base::TimeDelta timestamp_; |
| 406 | 413 |
| 407 base::Lock release_sync_point_lock_; | 414 base::Lock release_sync_point_lock_; |
| 408 uint32 release_sync_point_; | 415 uint32 release_sync_point_; |
| 409 | 416 |
| 410 const bool end_of_stream_; | 417 const bool end_of_stream_; |
| 411 | 418 |
| 412 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 419 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
| 413 }; | 420 }; |
| 414 | 421 |
| 415 } // namespace media | 422 } // namespace media |
| 416 | 423 |
| 417 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 424 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
| OLD | NEW |