ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
Add ``` <ZGCaptureDeviceDataOutputPixelBufferDelegate> ``` ``` - (id<ZGCaptureDevice>)captureDevice { if (!_captureDevice) { if (self.captureSourceType == ZGCustomVideoCaptureSourceTypeCamera) { // BGRA32 or NV12 OSType pixelFormat = self.captureDataFormat == ZGCustomVideoCaptureDataFormatBGRA32 ? kCVPixelFormatType_32BGRA : kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange; _captureDevice = [[ZGCaptureDeviceCamera alloc] initWithPixelFormatType:pixelFormat]; } else if (self.captureSourceType == ZGCustomVideoCaptureSourceTypeImage) { _captureDevice = [[ZGCaptureDeviceImage alloc] initWithMotionImage:[UIImage imageNamed:@"ZegoLogo"].CGImage contentSize:CGSizeMake(720, 1280)]; } _captureDevice.delegate = self; } return _captureDevice; } ``` 在代理方法中调用美颜的方法,如下所示(The method of invoking beauty in the proxy method is shown below.): ``` - (void)captureDevice:(id<ZGCaptureDevice>)device didCapturedData:(CMSampleBufferRef)data { if (self.captureBufferType == ZGCustomVideoCaptureBufferTypeCVPixelBuffer) { // BufferType: CVPixelBuffer CVPixelBufferRef buffer = CMSampleBufferGetImageBuffer(data); CMTime timeStamp = CMSampleBufferGetPresentationTimeStamp(data); OSType osType = CVPixelBufferGetPixelFormatType(buffer); [self.beautyManager processWithPixelBuffer:buffer formatType:osType]; [[ZegoExpressEngine sharedEngine] sendCustomVideoCapturePixelBuffer:buffer timestamp:timeStamp]; } else if (self.captureBufferType == ZGCustomVideoCaptureBufferTypeEncodedFrame) { [self.encoder encodeBuffer:data]; } ```