Raw Image(AVCapturePhotoOutput) CMSampleBuffer(AVVideodataoutput) difference?

I'm working on getting a raw image from avfoundation. I have a understanding of general pipeline of digital image.

  1. image sensor
  2. bayer filter
  3. demosaicing.

My goal is getting a image as raw as possible.

I found out that using avcaptureoutput, if device support raw pixel format, I get output as raw format in callback function(func photoOutput(_ output: AVCapturePhotoOutput, didFinishCaptureFor resolvedSettings: AVCaptureResolvedPhotoSettings, error: Error?))

but what is difference between CMSampleBuffer(in avvideodataout callback function) and output(in avphotooutput callback function)

this is my guess..

  1. cmsamplebuffer is image buffer which after all 1,2,3 step(after demosaicing)

  2. output from avphotooutput callback function(with raw format supported) is after step 1-2(after bayer filter)

is this right?

Post not yet marked as solved Up vote post of veursk Down vote post of veursk