Reputation: 2334
I want to use GPUImageView
to output CMSampleBuffer
which I receive from my AVCaptureVideoDataOutputSampleBufferDelegate
. So, basically, I don't want GPUImage framework to manage AVCaptureSession
itself, I just want it to draw what I'd pass to it. Still I can't see any obvious and easy way to do that. Is it even possible?
Upvotes: 1
Views: 517
Reputation: 1432
Here's what you can do, fast and simple:
1.Set up your GPUImage with GPUImageView to output the frames as usual. Just like they do it in examples.
Dive into GPUImageVideoCamera class. Add a delegate there. Like one:
@protocol GPUImageVideoCameraDelegate @optional
Go to GPUImageVideoCamera.m, find the: - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection method.
Add your delegate call in there.
if (self.delegate) { [self.delegate videoCameraCaptureOutput:captureOutput didOutputSampleBuffer:sampleBuffer fromConnection:connection]; }
Set your controller/class/whatever as delegate, videoCamera.delegate = self;
Use the delegate method in your class and do whatever you want with the CMSampleBufferRef.
Make sure you work with CMSampleBufferRef "in-place", meaning - do not copy it into CPU memory if you wish to avoid using relatively slow CPU versus faster GPU.
From there you can set any image into CMSampleBufferRef.
Upvotes: 2