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 #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/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 frameHeight_ = height; | 164 frameHeight_ = height; |
165 frameRate_ = frameRate; | 165 frameRate_ = frameRate; |
166 | 166 |
167 // Set up desired output properties. | 167 // Set up desired output properties. |
168 NSDictionary *captureDictionary = | 168 NSDictionary *captureDictionary = |
169 [NSDictionary dictionaryWithObjectsAndKeys: | 169 [NSDictionary dictionaryWithObjectsAndKeys: |
170 [NSNumber numberWithDouble:frameWidth_], | 170 [NSNumber numberWithDouble:frameWidth_], |
171 (id)kCVPixelBufferWidthKey, | 171 (id)kCVPixelBufferWidthKey, |
172 [NSNumber numberWithDouble:frameHeight_], | 172 [NSNumber numberWithDouble:frameHeight_], |
173 (id)kCVPixelBufferHeightKey, | 173 (id)kCVPixelBufferHeightKey, |
174 [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA], | 174 [NSNumber numberWithUnsignedInt:kCVPixelFormatType_422YpCbCr8], |
175 (id)kCVPixelBufferPixelFormatTypeKey, | 175 (id)kCVPixelBufferPixelFormatTypeKey, |
176 nil]; | 176 nil]; |
177 [[[captureSession_ outputs] objectAtIndex:0] | 177 [[[captureSession_ outputs] objectAtIndex:0] |
178 setPixelBufferAttributes:captureDictionary]; | 178 setPixelBufferAttributes:captureDictionary]; |
179 | 179 |
180 [[[captureSession_ outputs] objectAtIndex:0] | 180 [[[captureSession_ outputs] objectAtIndex:0] |
181 setMinimumVideoFrameInterval:(NSTimeInterval)1/(float)frameRate]; | 181 setMinimumVideoFrameInterval:(NSTimeInterval)1/(float)frameRate]; |
182 return YES; | 182 return YES; |
183 } | 183 } |
184 | 184 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 expectedBytesPerRow); | 259 expectedBytesPerRow); |
260 } | 260 } |
261 | 261 |
262 addressToPass = adjustedAddress; | 262 addressToPass = adjustedAddress; |
263 frameSize = frameHeight * expectedBytesPerRow; | 263 frameSize = frameHeight * expectedBytesPerRow; |
264 } | 264 } |
265 media::VideoCaptureCapability captureCapability; | 265 media::VideoCaptureCapability captureCapability; |
266 captureCapability.width = frameWidth_; | 266 captureCapability.width = frameWidth_; |
267 captureCapability.height = frameHeight_; | 267 captureCapability.height = frameHeight_; |
268 captureCapability.frame_rate = frameRate_; | 268 captureCapability.frame_rate = frameRate_; |
269 captureCapability.color = media::PIXEL_FORMAT_ARGB; | 269 captureCapability.color = media::PIXEL_FORMAT_UYVY; |
270 captureCapability.expected_capture_delay = 0; | 270 captureCapability.expected_capture_delay = 0; |
271 captureCapability.interlaced = false; | 271 captureCapability.interlaced = false; |
272 | 272 |
273 // Deliver the captured video frame. | 273 // Deliver the captured video frame. |
274 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureCapability); | 274 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureCapability); |
275 | 275 |
276 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags); | 276 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags); |
277 } | 277 } |
278 [lock_ unlock]; | 278 [lock_ unlock]; |
279 } | 279 } |
280 | 280 |
281 - (void)handleNotification:(NSNotification *)errorNotification { | 281 - (void)handleNotification:(NSNotification *)errorNotification { |
282 NSError * error = (NSError *)[[errorNotification userInfo] | 282 NSError * error = (NSError *)[[errorNotification userInfo] |
283 objectForKey:QTCaptureSessionErrorKey]; | 283 objectForKey:QTCaptureSessionErrorKey]; |
284 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]); | 284 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]); |
285 } | 285 } |
286 | 286 |
287 @end | 287 @end |
OLD | NEW |