Chromium Code Reviews| Index: media/base/video_frame.h |
| diff --git a/media/base/video_frame.h b/media/base/video_frame.h |
| index 5939c45211e16b939c69c96be2242968144c8385..22bf20998526d6b775d92b429b422c9dc82ec2c1 100644 |
| --- a/media/base/video_frame.h |
| +++ b/media/base/video_frame.h |
| @@ -17,6 +17,15 @@ |
| class SkBitmap; |
| +#if defined(OS_MACOSX) |
| +#include "base/mac/scoped_cftyperef.h" |
| + |
| +// From CoreVideo headers |
|
Robert Sesek
2014/08/07 16:12:57
Why can't you just include CoreVideo.h here?
jfroy
2014/08/07 16:22:14
I thought the general guideline in chromium code w
Robert Sesek
2014/08/07 16:34:42
No, don't forward-declare system types unless you
jfroy
2014/08/07 16:52:46
Acknowledged.
|
| +typedef struct __CVBuffer *CVBufferRef; |
| +typedef CVBufferRef CVImageBufferRef; |
| +typedef CVImageBufferRef CVPixelBufferRef; |
| +#endif |
| + |
| namespace gpu { |
| struct MailboxHolder; |
| } // namespace gpu |
| @@ -148,6 +157,20 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { |
| const base::Closure& no_longer_needed_cb); |
| #endif |
| +#if defined(OS_MACOSX) |
| + // Wraps 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 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 +274,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 +368,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_; |