OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h" | 5 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h" |
6 | 6 |
7 #import <QTKit/QTKit.h> | 7 #import <QTKit/QTKit.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "media/video/capture/mac/video_capture_device_mac.h" | 10 #include "media/video/capture/mac/video_capture_device_mac.h" |
11 #include "media/video/capture/video_capture_device.h" | 11 #include "media/video/capture/video_capture_device.h" |
| 12 #include "media/video/capture/video_capture_types.h" |
12 | 13 |
13 @implementation VideoCaptureDeviceQTKit | 14 @implementation VideoCaptureDeviceQTKit |
14 | 15 |
15 #pragma mark Class methods | 16 #pragma mark Class methods |
16 | 17 |
17 + (NSArray *)deviceNames { | 18 + (NSArray *)deviceNames { |
18 return [QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo]; | 19 return [QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo]; |
19 } | 20 } |
20 | 21 |
21 #pragma mark Public methods | 22 #pragma mark Public methods |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 153 } |
153 | 154 |
154 // Lock the frame and calculate frame size. | 155 // Lock the frame and calculate frame size. |
155 const int kLockFlags = 0; | 156 const int kLockFlags = 0; |
156 if (CVPixelBufferLockBaseAddress(videoFrame, kLockFlags) | 157 if (CVPixelBufferLockBaseAddress(videoFrame, kLockFlags) |
157 == kCVReturnSuccess) { | 158 == kCVReturnSuccess) { |
158 void *baseAddress = CVPixelBufferGetBaseAddress(videoFrame); | 159 void *baseAddress = CVPixelBufferGetBaseAddress(videoFrame); |
159 size_t bytesPerRow = CVPixelBufferGetBytesPerRow(videoFrame); | 160 size_t bytesPerRow = CVPixelBufferGetBytesPerRow(videoFrame); |
160 int frameHeight = CVPixelBufferGetHeight(videoFrame); | 161 int frameHeight = CVPixelBufferGetHeight(videoFrame); |
161 int frameSize = bytesPerRow * frameHeight; | 162 int frameSize = bytesPerRow * frameHeight; |
162 media::VideoCaptureDevice::Capability captureCapability; | 163 media::VideoCaptureCapability captureCapability; |
163 captureCapability.width = frameWidth_; | 164 captureCapability.width = frameWidth_; |
164 captureCapability.height = frameHeight_; | 165 captureCapability.height = frameHeight_; |
165 captureCapability.frame_rate = frameRate_; | 166 captureCapability.frame_rate = frameRate_; |
166 captureCapability.color = media::VideoCaptureDevice::kARGB; | 167 captureCapability.color = media::VideoCaptureCapability::kARGB; |
| 168 captureCapability.expected_capture_delay = 0; |
| 169 captureCapability.interlaced = false; |
167 | 170 |
168 // Deliver the captured video frame. | 171 // Deliver the captured video frame. |
169 frameReceiver_->ReceiveFrame(static_cast<UInt8*>(baseAddress), frameSize, | 172 frameReceiver_->ReceiveFrame(static_cast<UInt8*>(baseAddress), frameSize, |
170 captureCapability); | 173 captureCapability); |
171 | 174 |
172 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags); | 175 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags); |
173 } | 176 } |
174 } | 177 } |
175 | 178 |
176 @end | 179 @end |
OLD | NEW |