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