I want to analyze colors displayed in AVSampleBufferDisplayLayer
which gets frames from the data source which I don't control.
I've made my own subclass of this class and override func enqueue(_ sampleBuffer: CMSampleBuffer)
to get my hands on sample buffers. My plan was to create CIImage from it and then apply CIAreaAverage
filter.
Unfortunately, when I call CMSampleBufferGetImageBuffer(sampleBuffer)
, I get null
.
From what I understand, this means that I should use dataBuffer
instead. But how can I convert it into CIImage?