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

Side by Side Diff: media/base/mac/video_frame_mac.cc

Issue 1154153003: Relanding 1143663007: VideoFrame: Separate Pixel Format from Storage Type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added NV12 support in CrOS Created 5 years, 6 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 unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "media/base/mac/corevideo_glue.h" 9 #include "media/base/mac/corevideo_glue.h"
10 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
(...skipping 25 matching lines...) Expand all
36 if (frame.cv_pixel_buffer()) { 36 if (frame.cv_pixel_buffer()) {
37 pixel_buffer.reset(frame.cv_pixel_buffer(), base::scoped_policy::RETAIN); 37 pixel_buffer.reset(frame.cv_pixel_buffer(), base::scoped_policy::RETAIN);
38 return pixel_buffer; 38 return pixel_buffer;
39 } 39 }
40 40
41 // VideoFrame only supports YUV formats and most of them are 'YVU' ordered, 41 // VideoFrame only supports YUV formats and most of them are 'YVU' ordered,
42 // which CVPixelBuffer does not support. This means we effectively can only 42 // which CVPixelBuffer does not support. This means we effectively can only
43 // represent I420 and NV12 frames. In addition, VideoFrame does not carry 43 // represent I420 and NV12 frames. In addition, VideoFrame does not carry
44 // colorimetric information, so this function assumes standard video range 44 // colorimetric information, so this function assumes standard video range
45 // and ITU Rec 709 primaries. 45 // and ITU Rec 709 primaries.
46 VideoFrame::Format video_frame_format = frame.format(); 46 const VideoFrame::Format video_frame_format = frame.format();
47 OSType cv_format; 47 OSType cv_format;
48 if (video_frame_format == VideoFrame::Format::I420) { 48 if (video_frame_format == VideoFrame::Format::I420) {
49 cv_format = kCVPixelFormatType_420YpCbCr8Planar; 49 cv_format = kCVPixelFormatType_420YpCbCr8Planar;
50 } else if (video_frame_format == VideoFrame::Format::NV12) { 50 } else if (video_frame_format == VideoFrame::Format::NV12) {
51 cv_format = CoreVideoGlue::kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange; 51 cv_format = CoreVideoGlue::kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
52 } else { 52 } else {
53 DLOG(ERROR) << " unsupported frame format: " << video_frame_format; 53 DLOG(ERROR) << " unsupported frame format: " << video_frame_format;
54 return pixel_buffer; 54 return pixel_buffer;
55 } 55 }
56 56
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 kCVImageBufferTransferFunction_ITU_R_709_2, 113 kCVImageBufferTransferFunction_ITU_R_709_2,
114 kCVAttachmentMode_ShouldPropagate); 114 kCVAttachmentMode_ShouldPropagate);
115 CVBufferSetAttachment(pixel_buffer, kCVImageBufferYCbCrMatrixKey, 115 CVBufferSetAttachment(pixel_buffer, kCVImageBufferYCbCrMatrixKey,
116 kCVImageBufferYCbCrMatrix_ITU_R_709_2, 116 kCVImageBufferYCbCrMatrix_ITU_R_709_2,
117 kCVAttachmentMode_ShouldPropagate); 117 kCVAttachmentMode_ShouldPropagate);
118 118
119 return pixel_buffer; 119 return pixel_buffer;
120 } 120 }
121 121
122 } // namespace media 122 } // namespace media
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_video_encoder_host.cc ('k') | media/base/mac/video_frame_mac_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698