Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / media / base / mac / video_frame_mac.h
blob93bcb77b3626afe30f92035d2a67348c0892190a
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_BASE_MAC_VIDEO_FRAME_MAC_H_
6 #define MEDIA_BASE_MAC_VIDEO_FRAME_MAC_H_
8 #include <CoreVideo/CVPixelBuffer.h>
10 #include "base/mac/scoped_cftyperef.h"
11 #include "media/base/media_export.h"
13 namespace media {
15 class VideoFrame;
17 // Wrap a VideoFrame's data in a CVPixelBuffer object. The frame's lifetime is
18 // extended for the duration of the pixel buffer's lifetime. If the frame's data
19 // is already managed by a CVPixelBuffer (the frame was created using
20 // |WrapCVPixelBuffer()|, then the underlying CVPixelBuffer is returned.
22 // The only supported formats are I420 and NV12. Frames with extended pixels
23 // (the visible rect's size does not match the coded size) are not supported.
24 // If an unsupported frame is specified, null is returned.
25 MEDIA_EXPORT base::ScopedCFTypeRef<CVPixelBufferRef>
26 WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame);
28 } // namespace media
30 #endif // MEDIA_BASE_MAC_VIDEO_FRAME_MAC_H_