Skip to content

Commit e8673cc

Browse files
committed
Merge branch 'gateway240-master'
* gateway240-master: Update Camera Position Fix Deprecated AvCaptureDevice Enumeration
2 parents 1ce0ddd + 4808880 commit e8673cc

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

mac/platformcontext.mm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ of this software and associated documentation files (the "Software"), to deal
8888
LOG(LOG_DEBUG, "enumerateDevices called\n");
8989

9090
m_devices.clear();
91-
for (AVCaptureDevice* device in [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo])
91+
AVCaptureDeviceDiscoverySession *captureDeviceDiscoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera,AVCaptureDeviceTypeExternalUnknown]
92+
mediaType:AVMediaTypeVideo
93+
position:AVCaptureDevicePositionUnspecified];
94+
for (AVCaptureDevice* device in [captureDeviceDiscoverySession devices])
9295
{
9396
platformDeviceInfo* deviceInfo = new platformDeviceInfo();
9497
deviceInfo->m_captureDevice = CFBridgingRetain(device);
@@ -104,7 +107,7 @@ of this software and associated documentation files (the "Software"), to deal
104107
NSRange vidRange = [device.modelID rangeOfString:@"VendorID_"];
105108
if (vidRange.length > 0)
106109
{
107-
uint32_t maxLen = device.modelID.length - vidRange.location - 9;
110+
unsigned long maxLen = device.modelID.length - vidRange.location - 9;
108111
maxLen = (maxLen > 5) ? 5 : maxLen;
109112
deviceInfo->m_vid = [[device.modelID substringWithRange:NSMakeRange(vidRange.location + 9, maxLen)] intValue];
110113
}
@@ -117,7 +120,7 @@ of this software and associated documentation files (the "Software"), to deal
117120
NSRange pidRange = [device.modelID rangeOfString:@"ProductID_"];
118121
if (pidRange.length > 0)
119122
{
120-
uint32_t maxLen = device.modelID.length - pidRange.location - 10;
123+
unsigned long maxLen = device.modelID.length - pidRange.location - 10;
121124
maxLen = (maxLen > 5) ? 5 : maxLen;
122125
deviceInfo->m_pid = [[device.modelID substringWithRange:NSMakeRange(pidRange.location + 10, maxLen)] intValue];
123126
}

mac/platformstream.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput
8383
if (CVPixelBufferLockBaseAddress(pixelBuffer, 0) == kCVReturnSuccess)
8484
{
8585
const uint8_t *pixelPtr = static_cast<const uint8_t*>(CVPixelBufferGetBaseAddress(pixelBuffer));
86-
uint32_t frameBytes = CVPixelBufferGetHeight(pixelBuffer) *
86+
unsigned long frameBytes = CVPixelBufferGetHeight(pixelBuffer) *
8787
CVPixelBufferGetBytesPerRow(pixelBuffer);
8888

89-
m_stream->callback(pixelPtr, frameBytes);
89+
m_stream->callback(pixelPtr, (uint32_t)frameBytes);
9090

9191
CVPixelBufferUnlockBaseAddress(pixelBuffer, 0);
9292
}

mac/uvcctrl.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ of this software and associated documentation files (the "Software"), to deal
146146
CFMutableDictionaryRef dict = IOServiceMatching(kIOUSBDeviceClassName);
147147

148148
io_iterator_t serviceIterator;
149-
kern_return_t result = IOServiceGetMatchingServices(kIOMasterPortDefault, dict, &serviceIterator);
149+
kern_return_t result = IOServiceGetMatchingServices(NULL, dict, &serviceIterator);
150150
if (result != kIOReturnSuccess) {
151151
LOG(LOG_DEBUG, "UVCCtrl::findDevice() IOServiceGetMatchingServices failed: %d\n", result);
152152
return NULL;

0 commit comments

Comments
 (0)