次の AVCaptureVideoDataOutputSampleBufferDelegate メソッドを使用して、ビデオ出力からリアルタイムで明るさの値、露出、およびその他のメタデータを取得しています。ただし、メタ データ ディクショナリは NULL を返します。WWDC 10 からコード スニペットを取得したので、それ以降に何かが変更された可能性があります。
- (void) captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
CFDictionaryRef metaDict = CMGetAttachment(sampleBuffer, CFSTR ("MetadataDictionary"), NULL);
if (metaDict) {
CFShow(metaDict);
}
}
また、同様の質問が行われ、応答が次のように使用されることにも気付きました。
NSDictionary *exifDictionary = (NSDictionary*)CMGetAttachment(sampleBuffer, kCGImagePropertyExifDictionary, NULL);
しかし、コンパイラは kCGImagePropertyExifDictionary を認識しません。そのパラメーターの CFStringRef を探しています。