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); |
117 | 118 |
118 #if !defined(MEDIA_FOR_CAST_IOS) | 119 #if !defined(MEDIA_FOR_CAST_IOS) |
119 // Read pixels from the native texture backing |*this| and write | 120 // Read pixels from the native texture backing |*this| and write |
120 // them to |pixels| as BGRA. |pixels| must point to a buffer at | 121 // them to |pixels| as BGRA. |pixels| must point to a buffer at |
121 // least as large as 4 * visible_rect().size().GetArea(). | 122 // least as large as 4 * visible_rect().size().GetArea(). |
122 void ReadPixelsFromNativeTexture(const SkBitmap& pixels); | 123 void ReadPixelsFromNativeTexture(const SkBitmap& pixels); |
123 #endif | 124 #endif |
124 | 125 |
125 // Wraps packed image data residing in a memory buffer with a VideoFrame. | 126 // Wraps packed image data residing in a memory buffer with a VideoFrame. |
126 // The image data resides in |data| and is assumed to be packed tightly in a | 127 // 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... |
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 bool allow_overlay() const { return allow_overlay_; } |
| 303 |
301 #if defined(OS_POSIX) | 304 #if defined(OS_POSIX) |
302 // Returns backing dmabuf file descriptor for given |plane|, if present. | 305 // Returns backing dmabuf file descriptor for given |plane|, if present. |
303 int dmabuf_fd(size_t plane) const; | 306 int dmabuf_fd(size_t plane) const; |
304 #endif | 307 #endif |
305 | 308 |
306 #if defined(OS_MACOSX) | 309 #if defined(OS_MACOSX) |
307 // Returns the backing CVPixelBuffer, if present. | 310 // Returns the backing CVPixelBuffer, if present. |
308 CVPixelBufferRef cv_pixel_buffer() const; | 311 CVPixelBufferRef cv_pixel_buffer() const; |
309 #endif | 312 #endif |
310 | 313 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 | 405 |
403 base::Closure no_longer_needed_cb_; | 406 base::Closure no_longer_needed_cb_; |
404 | 407 |
405 base::TimeDelta timestamp_; | 408 base::TimeDelta timestamp_; |
406 | 409 |
407 base::Lock release_sync_point_lock_; | 410 base::Lock release_sync_point_lock_; |
408 uint32 release_sync_point_; | 411 uint32 release_sync_point_; |
409 | 412 |
410 const bool end_of_stream_; | 413 const bool end_of_stream_; |
411 | 414 |
| 415 bool allow_overlay_; |
| 416 |
412 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 417 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
413 }; | 418 }; |
414 | 419 |
415 } // namespace media | 420 } // namespace media |
416 | 421 |
417 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 422 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |