我用这种方法初始化AVCaptureVideoDataOutput:
// Setup the video output
_videoOutput = [[AVCaptureVideoDataOutput alloc] init];
_videoOutput.alwaysDiscardsLateVideoFrames = YES;
_videoOutput.minFrameDuration = kCMTimeZero;
_videoOutput.videoSettings =
[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA],(id)kCVPixelBufferPixelFormatTypeKey
,AVVideoCodecH264, AVVideoCodecKey, nil];
// Setup the audio output
_audioOutput = [[AVCaptureAudioDataOutput alloc] init];
NSLog(@"dispatch_queue_t");
// Setup the queue
dispatch_queue_t queue = dispatch_queue_create("MyQueue", NULL);
[_videoOutput setSampleBufferDelegate:self queue:queue];
[_audioOutput setSampleBufferDelegate:self queue:queue];
dispatch_release(queue);
我有一个问题就是委托方法:
是不会被调用的。在IOS4这个方法调用时,任何想法为什么会发生?
答案 0 :(得分:2)
向会话添加输入和输出。 然后调用[session startRunning]。