Created
February 3, 2013 18:17
-
-
Save sgss/4702914 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Derive dimensions of the capture device input. | |
AVCaptureInputPort *captureDeviceInputPort = nil; | |
for (AVCaptureInputPort *port in [captureDeviceInput ports]) { | |
if ([[port mediaType] isEqualToString:AVMediaTypeVideo]) { | |
captureDeviceInputPort = port; | |
break; | |
} | |
} | |
if (!captureDeviceInputPort) { | |
CFXLogError(@"Capture device input port of video media type was " | |
@"unexpectedly not found."); | |
CFXLog(@"Skipping."); | |
return; | |
} | |
CMFormatDescriptionRef formatDescription = | |
[captureDeviceInputPort formatDescription]; | |
CMVideoDimensions videoDimensions = | |
CMVideoFormatDescriptionGetDimensions(formatDescription); | |
[self willChangeValueForKey:@"inputSize"]; | |
inputSize = CGSizeMake( | |
(CGFloat)videoDimensions.width, (CGFloat)videoDimensions.height); | |
[self didChangeValueForKey:@"inputSize"]; | |
CFXLogInfo(@"Derived device input size: %@", NSStringFromCGSize(inputSize)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment