Hi to all
I'm implementing a software to caputre video from webcam. I've seen MyRecorder sample in Apple Dev and it works fine.
I've tried to add a button to take a snapshot from video with this code:
- (IBAction)addFrame:(id)sender
{
CVImageBufferRef imageBuffer;
@synchronized (self) {
imageBuffer = CVBufferRetain(mCurrentImageBuffer);
}
if (imageBuffer) {
[ bla bla bla ]
}
}
but mCurrentImageBuffer is always empty. How can I take current frame from my webcam and put on mCurrentImageBuffer?
I've tried to use
(void)captureOutput:(QTCaptureOutput *)captureOutput
didOutputVideoFrame:(CVImageBufferRef)videoFrame
withSampleBuffer:(QTSampleBuffer *)sampleBuffer
fromConnection:(QTCaptureConnection *)connection
{
CVImageBufferRef imageBufferToRelease;
CVBufferRetain(videoFrame);
@synchronized (self) {
imageBufferToRelease = mCurrentImageBuffer;
mCurrentImageBuffer = videoFrame;
}
CVBufferRelease(imageBufferToRelease);
}
but it's never called. How can I decide when call captureOutput delegate method? Any idea?
thanks, Andrea