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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // argument when the VideoFrame is to be destroyed. | 106 // argument when the VideoFrame is to be destroyed. |
107 // |read_pixels_cb| may be used to do (slow!) readbacks from the | 107 // |read_pixels_cb| may be used to do (slow!) readbacks from the |
108 // texture to main memory. | 108 // texture to main memory. |
109 static scoped_refptr<VideoFrame> WrapNativeTexture( | 109 static scoped_refptr<VideoFrame> WrapNativeTexture( |
110 scoped_ptr<gpu::MailboxHolder> mailbox_holder, | 110 scoped_ptr<gpu::MailboxHolder> mailbox_holder, |
111 const ReleaseMailboxCB& mailbox_holder_release_cb, | 111 const ReleaseMailboxCB& mailbox_holder_release_cb, |
112 const gfx::Size& coded_size, | 112 const gfx::Size& coded_size, |
113 const gfx::Rect& visible_rect, | 113 const gfx::Rect& visible_rect, |
114 const gfx::Size& natural_size, | 114 const gfx::Size& natural_size, |
115 base::TimeDelta timestamp, | 115 base::TimeDelta timestamp, |
116 const ReadPixelsCB& read_pixels_cb, | 116 const ReadPixelsCB& read_pixels_cb); |
117 bool allow_overlay); | |
118 | 117 |
119 #if !defined(MEDIA_FOR_CAST_IOS) | 118 #if !defined(MEDIA_FOR_CAST_IOS) |
120 // Read pixels from the native texture backing |*this| and write | 119 // Read pixels from the native texture backing |*this| and write |
121 // them to |pixels| as BGRA. |pixels| must point to a buffer at | 120 // them to |pixels| as BGRA. |pixels| must point to a buffer at |
122 // least as large as 4 * visible_rect().size().GetArea(). | 121 // least as large as 4 * visible_rect().size().GetArea(). |
123 void ReadPixelsFromNativeTexture(const SkBitmap& pixels); | 122 void ReadPixelsFromNativeTexture(const SkBitmap& pixels); |
124 #endif | 123 #endif |
125 | 124 |
126 // Wraps packed image data residing in a memory buffer with a VideoFrame. | 125 // Wraps packed image data residing in a memory buffer with a VideoFrame. |
127 // The image data resides in |data| and is assumed to be packed tightly in a | 126 // The image data resides in |data| and is assumed to be packed tightly in a |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 uint8* visible_data(size_t plane); | 291 uint8* visible_data(size_t plane); |
293 | 292 |
294 // Returns the mailbox holder of the native texture wrapped by this frame. | 293 // 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 | 294 // 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. | 295 // mailbox, the caller must wait for the included sync point. |
297 const gpu::MailboxHolder* mailbox_holder() const; | 296 const gpu::MailboxHolder* mailbox_holder() const; |
298 | 297 |
299 // Returns the shared-memory handle, if present | 298 // Returns the shared-memory handle, if present |
300 base::SharedMemoryHandle shared_memory_handle() const; | 299 base::SharedMemoryHandle shared_memory_handle() const; |
301 | 300 |
302 bool allow_overlay() const { return allow_overlay_; } | |
303 | |
304 #if defined(OS_POSIX) | 301 #if defined(OS_POSIX) |
305 // Returns backing dmabuf file descriptor for given |plane|, if present. | 302 // Returns backing dmabuf file descriptor for given |plane|, if present. |
306 int dmabuf_fd(size_t plane) const; | 303 int dmabuf_fd(size_t plane) const; |
307 #endif | 304 #endif |
308 | 305 |
309 #if defined(OS_MACOSX) | 306 #if defined(OS_MACOSX) |
310 // Returns the backing CVPixelBuffer, if present. | 307 // Returns the backing CVPixelBuffer, if present. |
311 CVPixelBufferRef cv_pixel_buffer() const; | 308 CVPixelBufferRef cv_pixel_buffer() const; |
312 #endif | 309 #endif |
313 | 310 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 402 |
406 base::Closure no_longer_needed_cb_; | 403 base::Closure no_longer_needed_cb_; |
407 | 404 |
408 base::TimeDelta timestamp_; | 405 base::TimeDelta timestamp_; |
409 | 406 |
410 base::Lock release_sync_point_lock_; | 407 base::Lock release_sync_point_lock_; |
411 uint32 release_sync_point_; | 408 uint32 release_sync_point_; |
412 | 409 |
413 const bool end_of_stream_; | 410 const bool end_of_stream_; |
414 | 411 |
415 bool allow_overlay_; | |
416 | |
417 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 412 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
418 }; | 413 }; |
419 | 414 |
420 } // namespace media | 415 } // namespace media |
421 | 416 |
422 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 417 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |