我已经下载了 ffmpeg lib 文件并为 armv7 编译了它。我在我的项目中成功添加了 ffmpeg lib 文件。我能够使用 AVFoundation 获得 iphone 相机实时流。
现在的问题是我将如何将 iphone 相机流输出转换为 ffmpeg 的输入进行解码?检查我的代码
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
CMBlockBufferRef bufferData = CMSampleBufferGetDataBuffer(sampleBuffer);
size_t lengthAtOffset;
size_t totalLength; char* data;
if(CMBlockBufferGetDataPointer(bufferData, 0, &lengthAtOffset, &totalLength, &data) != noErr ){ NSLog(@"error!"); } }
请建议我使用 ffmpeg lib 的哪个函数进行解码,我将如何将CMBlockBufferRef
其作为输入?
谢谢