美文网首页OC音视频
CMSampleBufferCreate

CMSampleBufferCreate

作者: FBLog | 来源:发表于2018-04-17 21:07 被阅读2次

I do it by using CMSampleBufferCreateForImageBuffer() .

OSStatus ret = 0;

CMSampleBufferRef sample = NULL;

CMVideoFormatDescriptionRef videoInfo = NULL;

CMSampleTimingInfo timingInfo = kCMTimingInfoInvalid;

timingInfo.presentationTimeStamp = pts;

timingInfo.duration = duration;

ret = CMVideoFormatDescriptionCreateForImageBuffer(NULL, pixel, &videoInfo);

if (ret != 0) {

    NSLog(@"CMVideoFormatDescriptionCreateForImageBuffer failed! %d", (int)ret);

    goto done;

}

ret = CMSampleBufferCreateForImageBuffer(kCFAllocatorDefault, pixel, true, NULL, NULL,

                                        videoInfo, &timingInfo, &sample);

if (ret != 0) {

    NSLog(@"CMSampleBufferCreateForImageBuffer failed! %d", (int)ret);

    goto done;

}

相关文章

网友评论

    本文标题:CMSampleBufferCreate

    本文链接:https://www.haomeiwen.com/subject/usapkftx.html