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 #include "media/base/mac/video_frame_mac.h" | 5 #include "media/base/mac/video_frame_mac.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 17 matching lines...) Expand all Loading... |
28 reinterpret_cast<const VideoFrame*>(frame_ref)->Release(); | 28 reinterpret_cast<const VideoFrame*>(frame_ref)->Release(); |
29 } | 29 } |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 MEDIA_EXPORT base::ScopedCFTypeRef<CVPixelBufferRef> | 33 MEDIA_EXPORT base::ScopedCFTypeRef<CVPixelBufferRef> |
34 WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) { | 34 WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) { |
35 base::ScopedCFTypeRef<CVPixelBufferRef> pixel_buffer; | 35 base::ScopedCFTypeRef<CVPixelBufferRef> pixel_buffer; |
36 | 36 |
37 // If the frame is backed by a pixel buffer, just return that buffer. | 37 // If the frame is backed by a pixel buffer, just return that buffer. |
38 if (frame.cv_pixel_buffer()) { | 38 if (frame.CvPixelBuffer()) { |
39 pixel_buffer.reset(frame.cv_pixel_buffer(), base::scoped_policy::RETAIN); | 39 pixel_buffer.reset(frame.CvPixelBuffer(), base::scoped_policy::RETAIN); |
40 return pixel_buffer; | 40 return pixel_buffer; |
41 } | 41 } |
42 | 42 |
43 // VideoFrame only supports YUV formats and most of them are 'YVU' ordered, | 43 // VideoFrame only supports YUV formats and most of them are 'YVU' ordered, |
44 // which CVPixelBuffer does not support. This means we effectively can only | 44 // which CVPixelBuffer does not support. This means we effectively can only |
45 // represent I420 and NV12 frames. In addition, VideoFrame does not carry | 45 // represent I420 and NV12 frames. In addition, VideoFrame does not carry |
46 // colorimetric information, so this function assumes standard video range | 46 // colorimetric information, so this function assumes standard video range |
47 // and ITU Rec 709 primaries. | 47 // and ITU Rec 709 primaries. |
48 const VideoPixelFormat video_frame_format = frame.format(); | 48 const VideoPixelFormat video_frame_format = frame.format(); |
49 OSType cv_format; | 49 OSType cv_format; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 kCVImageBufferTransferFunction_ITU_R_709_2, | 106 kCVImageBufferTransferFunction_ITU_R_709_2, |
107 kCVAttachmentMode_ShouldPropagate); | 107 kCVAttachmentMode_ShouldPropagate); |
108 CVBufferSetAttachment(pixel_buffer, kCVImageBufferYCbCrMatrixKey, | 108 CVBufferSetAttachment(pixel_buffer, kCVImageBufferYCbCrMatrixKey, |
109 kCVImageBufferYCbCrMatrix_ITU_R_709_2, | 109 kCVImageBufferYCbCrMatrix_ITU_R_709_2, |
110 kCVAttachmentMode_ShouldPropagate); | 110 kCVAttachmentMode_ShouldPropagate); |
111 | 111 |
112 return pixel_buffer; | 112 return pixel_buffer; |
113 } | 113 } |
114 | 114 |
115 } // namespace media | 115 } // namespace media |
OLD | NEW |