I'm writing a Mac app that encodes AVCaptureVideoDataOutput with H264 using videotoolbox framework.
VTCompressionSessionRef session;
OSStatus ret = VTCompressionSessionCreate(NULL, (int)width, (int)height, kCMVideoCodecType_H264, NULL, NULL, NULL, OutputCallback, NULL, &session);
The callback is implemented like this:
void OutputCallback(void *outputCallbackRefCon,
void *sourceFrameRefCon,
OSStatus status,
VTEncodeInfoFlags infoFlags,
CMSampleBufferRef sampleBuffer)
{
CMBlockBufferRef block = CMSampleBufferGetDataBuffer(sampleBuffer);
char* bufferData;
size_t size;
CMBlockBufferGetDataPointer(block, 0, NULL, &size, &bufferData);
NSData *data = [NSData dataWithBytes:bufferData length:size];
//and i use this data
}
Have these warnings in log
GVA warning: init, skip trailing zeros pps size = 35
GVA warning: init, skip trailing zeros pps size = 34 GVA warning: AVF_Get_Standalone_PPS, skip trailing zeros pps size = 35
Can anyone suggest a better way to decode to display in AVSampleBufferdisplayLayer?