NLCustomCamera
示例
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
。
NLRecordParam *param = [NLRecordParam recordConfigWithVideoRatio:NLShootRatioFullScreen shootMode:photoVideoMode position:AVCaptureDevicePositionBack maxRecordTime:15.0f minRecordTime:1.0f isCompression:NO waterMark:nil isFilter:YES isShowBeautyBtn:NO isShowAlbumBtn:YES currentVC:self];
[NLRecordManager shareManager].recordParam = param;
NLPhotoViewController *page = [NLPhotoViewController new];
[self presentViewController:page animated:YES completion:nil];
修复 GPUImage
###修复 Xcode 主线程警告 https://github.com/BradLarson/GPUImage/pull/2533/files
- (void)recalculateViewGeometry;
{
__block CGRect currentBounds;
runOnMainQueueWithoutDeadlocking(^{
currentBounds = self.bounds;
});
runSynchronouslyOnVideoProcessingQueue(^{
CGFloat heightScaling, widthScaling;
// CGSize currentViewSize = self.bounds.size;
// CGFloat imageAspectRatio = inputImageSize.width / inputImageSize.height;
// CGFloat viewAspectRatio = currentViewSize.width / currentViewSize.height;
CGRect insetRect = AVMakeRectWithAspectRatioInsideRect(inputImageSize, currentBounds);
switch(_fillMode)
{
case kGPUImageFillModeStretch:
{
widthScaling = 1.0;
heightScaling = 1.0;
}; break;
case kGPUImageFillModePreserveAspectRatio:
{
widthScaling = insetRect.size.width / currentBounds.size.width;
heightScaling = insetRect.size.height / currentBounds.size.height;
}; break;
case kGPUImageFillModePreserveAspectRatioAndFill:
{
// CGFloat widthHolder = insetRect.size.width / currentViewSize.width;
widthScaling = currentBounds.size.height / insetRect.size.height;
heightScaling = currentBounds.size.width / insetRect.size.width;
}; break;
}
imageVertices[0] = -widthScaling;
imageVertices[1] = -heightScaling;
imageVertices[2] = widthScaling;
imageVertices[3] = -heightScaling;
imageVertices[4] = -widthScaling;
imageVertices[5] = heightScaling;
imageVertices[6] = widthScaling;
imageVertices[7] = heightScaling;
});
// static const GLfloat imageVertices[] = {
// -1.0f, -1.0f,
// 1.0f, -1.0f,
// -1.0f, 1.0f,
// 1.0f, 1.0f,
// };
}
安装
NLCustomCamera 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'NLCustomCamera'
作者
wzyinglong,[email protected]
许可协议
NLCustomCamera以MIT许可协议提供。更多信息请参阅LICENSE文件。