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 <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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 << ", visible_rect: " << frame.visible_rect().ToString(); | 65 << ", visible_rect: " << frame.visible_rect().ToString(); |
66 return pixel_buffer; | 66 return pixel_buffer; |
67 } | 67 } |
68 | 68 |
69 // Build arrays for each plane's data pointer, dimensions and byte alignment. | 69 // Build arrays for each plane's data pointer, dimensions and byte alignment. |
70 void* plane_ptrs[kMaxPlanes]; | 70 void* plane_ptrs[kMaxPlanes]; |
71 size_t plane_widths[kMaxPlanes]; | 71 size_t plane_widths[kMaxPlanes]; |
72 size_t plane_heights[kMaxPlanes]; | 72 size_t plane_heights[kMaxPlanes]; |
73 size_t plane_bytes_per_row[kMaxPlanes]; | 73 size_t plane_bytes_per_row[kMaxPlanes]; |
74 for (int plane_i = 0; plane_i < num_planes; ++plane_i) { | 74 for (int plane_i = 0; plane_i < num_planes; ++plane_i) { |
75 plane_ptrs[plane_i] = const_cast<uint8*>(frame.data(plane_i)); | 75 plane_ptrs[plane_i] = const_cast<uint8_t*>(frame.data(plane_i)); |
76 gfx::Size plane_size = | 76 gfx::Size plane_size = |
77 VideoFrame::PlaneSize(video_frame_format, plane_i, coded_size); | 77 VideoFrame::PlaneSize(video_frame_format, plane_i, coded_size); |
78 plane_widths[plane_i] = plane_size.width(); | 78 plane_widths[plane_i] = plane_size.width(); |
79 plane_heights[plane_i] = plane_size.height(); | 79 plane_heights[plane_i] = plane_size.height(); |
80 plane_bytes_per_row[plane_i] = frame.stride(plane_i); | 80 plane_bytes_per_row[plane_i] = frame.stride(plane_i); |
81 } | 81 } |
82 | 82 |
83 // CVPixelBufferCreateWithPlanarBytes needs a dummy plane descriptor or the | 83 // CVPixelBufferCreateWithPlanarBytes needs a dummy plane descriptor or the |
84 // release callback will not execute. The descriptor is freed in the callback. | 84 // release callback will not execute. The descriptor is freed in the callback. |
85 void* descriptor = calloc( | 85 void* descriptor = calloc( |
(...skipping 27 matching lines...) Expand all Loading... |
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 |
OLD | NEW |