I got this code from another stackoverflow post which seems to excactly do what I want to do:
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection
{
CFDictionaryRef metadataDict = CMCopyDictionaryOfAttachments(NULL,
sampleBuffer, kCMAttachmentMode_ShouldPropagate);
NSDictionary *metadata = [[NSMutableDictionary alloc]
initWithDictionary:(__bridge NSDictionary*)metadataDict];
CFRelease(metadataDict);
NSDictionary *exifMetadata = [[metadata
objectForKey:(NSString *)kCGImagePropertyExifDictionary] mutableCopy];
float brightnessValue = [[exifMetadata
objectForKey:(NSString *)kCGImagePropertyExifBrightnessValue] floatValue];
NSLog(@"AVCapture: %f", brightnessValue);
}
But since I don't know too much about AVFoundation I don't know how to use it... How do I get the AVCaptureOutput, CMSampleBufferRef & AVCaptureConnection objects?
Or in other words "how do I set up a video input using the AVFoundation framework"?