Index: media/base/video_frame.h |
diff --git a/media/base/video_frame.h b/media/base/video_frame.h |
index 5939c45211e16b939c69c96be2242968144c8385..0ae9c7624a7a33310592767a5514aa8b0863b81b 100644 |
--- a/media/base/video_frame.h |
+++ b/media/base/video_frame.h |
@@ -17,6 +17,11 @@ |
class SkBitmap; |
+#if defined(OS_MACOSX) |
+#include <CoreVideo/CoreVideo.h> |
Robert Sesek
2014/08/07 18:00:15
nit: blank line between system C headers and proje
jfroy
2014/08/07 18:08:20
Acknowledged.
|
+#include "base/mac/scoped_cftyperef.h" |
+#endif |
+ |
namespace gpu { |
struct MailboxHolder; |
} // namespace gpu |
@@ -148,6 +153,20 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { |
const base::Closure& no_longer_needed_cb); |
#endif |
+#if defined(OS_MACOSX) |
+ // Wraps a provided CVPixelBuffer with a VideoFrame. The pixel buffer is |
+ // retained for the lifetime of the VideoFrame and released upon destruction. |
+ // The image data is only accessible via the pixel buffer, which could be |
+ // backed by an IOSurface from another process. All the attributes of the |
+ // VideoFrame are derived from the pixel buffer, with the exception of the |
+ // timestamp. If information is missing or is incompatible (for example, a |
+ // pixel format that has no VideoFrame match), NULL is returned. |
+ // http://crbug.com/401308 |
+ static scoped_refptr<VideoFrame> WrapCVPixelBuffer( |
+ CVPixelBufferRef cv_pixel_buffer, |
+ base::TimeDelta timestamp); |
+#endif |
+ |
// Wraps external YUV data of the given parameters with a VideoFrame. |
// The returned VideoFrame does not own the data passed in. When the frame |
// is destroyed |no_longer_needed_cb.Run()| will be called. |
@@ -251,6 +270,11 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { |
int dmabuf_fd(size_t plane) const; |
#endif |
+#if defined(OS_MACOSX) |
+ // Returns the backing CVPixelBuffer, if present. |
+ CVPixelBufferRef cv_pixel_buffer() const; |
+#endif |
+ |
// Returns true if this VideoFrame represents the end of the stream. |
bool end_of_stream() const { return end_of_stream_; } |
@@ -340,6 +364,11 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { |
base::ScopedFD dmabuf_fds_[kMaxPlanes]; |
#endif |
+#if defined(OS_MACOSX) |
+ // CVPixelBuffer, if this frame is wrapping one. |
+ base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer_; |
+#endif |
+ |
base::Closure no_longer_needed_cb_; |
base::TimeDelta timestamp_; |