| 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 | 12 |
| 13 @implementation VideoCaptureDeviceQTKit | 13 @implementation VideoCaptureDeviceQTKit |
| 14 | 14 |
| 15 #pragma mark Class methods | 15 #pragma mark Class methods |
| 16 | 16 |
| 17 + (NSArray *)deviceNames { | 17 + (NSDictionary *)deviceNames { |
| 18 return [QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo]; | 18 NSArray *captureDevices = |
| 19 [QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo]; |
| 20 NSMutableDictionary *deviceNames = |
| 21 [[[NSMutableDictionary alloc] init] autorelease]; |
| 22 |
| 23 for (QTCaptureDevice* device in captureDevices) { |
| 24 NSString* qtDeviceName = [device localizedDisplayName]; |
| 25 NSString* qtUniqueId = [device uniqueID]; |
| 26 [deviceNames setObject:qtDeviceName forKey:qtUniqueId]; |
| 27 } |
| 28 return deviceNames; |
| 19 } | 29 } |
| 20 | 30 |
| 21 #pragma mark Public methods | 31 #pragma mark Public methods |
| 22 | 32 |
| 23 - (id)initWithFrameReceiver:(media::VideoCaptureDeviceMac *)frameReceiver { | 33 - (id)initWithFrameReceiver:(media::VideoCaptureDeviceMac *)frameReceiver { |
| 24 self = [super init]; | 34 self = [super init]; |
| 25 if (self) { | 35 if (self) { |
| 26 frameReceiver_ = frameReceiver; | 36 frameReceiver_ = frameReceiver; |
| 27 } | 37 } |
| 28 return self; | 38 return self; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 177 |
| 168 // Deliver the captured video frame. | 178 // Deliver the captured video frame. |
| 169 frameReceiver_->ReceiveFrame(static_cast<UInt8*>(baseAddress), frameSize, | 179 frameReceiver_->ReceiveFrame(static_cast<UInt8*>(baseAddress), frameSize, |
| 170 captureCapability); | 180 captureCapability); |
| 171 | 181 |
| 172 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags); | 182 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags); |
| 173 } | 183 } |
| 174 } | 184 } |
| 175 | 185 |
| 176 @end | 186 @end |
| OLD | NEW |