1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #import "webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_info_objc.h" 12 #include "webrtc/modules/video_capture/include/video_capture.h" 13 #include "webrtc/modules/video_capture/video_capture_config.h" 14 #include "webrtc/system_wrappers/interface/trace.h" 15 16 namespace webrtc 17 { 18 namespace videocapturemodule 19 { 20 21 VideoCaptureMacQTKitInfo::VideoCaptureMacQTKitInfo(const int32_t id) : 22 DeviceInfoImpl(id) 23 { 24 _captureInfo = [[VideoCaptureMacQTKitInfoObjC alloc] init]; 25 } 26 27 VideoCaptureMacQTKitInfo::~VideoCaptureMacQTKitInfo() 28 { 29 [_captureInfo release]; 30 31 } 32 33 int32_t VideoCaptureMacQTKitInfo::Init() 34 { 35 36 return 0; 37 } 38 39 uint32_t VideoCaptureMacQTKitInfo::NumberOfDevices() 40 { 41 42 uint32_t captureDeviceCount = 43 [[_captureInfo getCaptureDeviceCount]intValue]; 44 return captureDeviceCount; 45 46 } 47 48 int32_t VideoCaptureMacQTKitInfo::GetDeviceName( 49 uint32_t deviceNumber, char* deviceNameUTF8, 50 uint32_t deviceNameLength, char* deviceUniqueIdUTF8, 51 uint32_t deviceUniqueIdUTF8Length, char* productUniqueIdUTF8, 52 uint32_t productUniqueIdUTF8Length) 53 { 54 int errNum = [[_captureInfo getDeviceNamesFromIndex:deviceNumber 55 DefaultName:deviceNameUTF8 WithLength:deviceNameLength 56 AndUniqueID:deviceUniqueIdUTF8 57 WithLength:deviceUniqueIdUTF8Length 58 AndProductID:productUniqueIdUTF8 59 WithLength:productUniqueIdUTF8Length]intValue]; 60 return errNum; 61 } 62 63 int32_t VideoCaptureMacQTKitInfo::NumberOfCapabilities( 64 const char* deviceUniqueIdUTF8) 65 { 66 // Not implemented. Mac doesn't use discrete steps in capabilities, rather 67 // "analog". QTKit will do it's best to convert frames to what ever format 68 // you ask for. 69 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, 70 "NumberOfCapabilities is not supported on the Mac platform."); 71 return -1; 72 } 73 74 75 int32_t VideoCaptureMacQTKitInfo::GetCapability( 76 const char* deviceUniqueIdUTF8, 77 const uint32_t deviceCapabilityNumber, 78 VideoCaptureCapability& capability) 79 { 80 // Not implemented. Mac doesn't use discrete steps in capabilities, rather 81 // "analog". QTKit will do it's best to convert frames to what ever format 82 // you ask for. 83 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, 84 "NumberOfCapabilities is not supported on the Mac platform."); 85 return -1; 86 } 87 88 89 int32_t VideoCaptureMacQTKitInfo::GetBestMatchedCapability( 90 const char*deviceUniqueIdUTF8, 91 const VideoCaptureCapability& requested, VideoCaptureCapability& resulting) 92 { 93 // Not implemented. Mac doesn't use discrete steps in capabilities, rather 94 // "analog". QTKit will do it's best to convert frames to what ever format 95 // you ask for. 96 WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id, 97 "NumberOfCapabilities is not supported on the Mac platform."); 98 return -1; 99 } 100 101 int32_t VideoCaptureMacQTKitInfo::DisplayCaptureSettingsDialogBox( 102 const char* deviceUniqueIdUTF8, 103 const char* dialogTitleUTF8, void* parentWindow, 104 uint32_t positionX, uint32_t positionY) 105 { 106 107 return [[_captureInfo 108 displayCaptureSettingsDialogBoxWithDevice:deviceUniqueIdUTF8 109 AndTitle:dialogTitleUTF8 110 AndParentWindow:parentWindow AtX:positionX AndY:positionY] 111 intValue]; 112 } 113 114 int32_t VideoCaptureMacQTKitInfo::CreateCapabilityMap( 115 const char* deviceUniqueIdUTF8) 116 { 117 // Not implemented. Mac doesn't use discrete steps in capabilities, rather 118 // "analog". QTKit will do it's best to convert frames to what ever format 119 // you ask for. 120 WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id, 121 "NumberOfCapabilities is not supported on the Mac platform."); 122 return -1; 123 } 124 } // namespace videocapturemodule 125 } // namespace webrtc 126