Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(899)

Unified Diff: media/base/video_frame.h

Issue 446163003: Extend media::VideoFrame to wrap CVPixelBuffer on OS X and iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use literal value of kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange instead of (wrong) availabilit… Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/base/video_frame.cc » ('j') | media/base/video_frame.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame.h
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index 5939c45211e16b939c69c96be2242968144c8385..04be78fd3939a799ca639c8c29c4cf0683d69a56 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -17,6 +17,12 @@
class SkBitmap;
+#if defined(OS_MACOSX)
+#include <CoreVideo/CoreVideo.h>
+
+#include "base/mac/scoped_cftyperef.h"
+#endif
+
namespace gpu {
struct MailboxHolder;
} // namespace gpu
@@ -148,6 +154,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 +271,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 +365,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_;
« no previous file with comments | « no previous file | media/base/video_frame.cc » ('j') | media/base/video_frame.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698