美文网首页
GPUImageVideoCamera 方法解析

GPUImageVideoCamera 方法解析

作者: 874b526fa570 | 来源:发表于2017-11-06 10:43 被阅读24次

    GPUImageVideoCamera 方法解析

    颜色矩阵转换

    extern const GLfloat kColorConversion601[];//标准清晰度
    extern const GLfloat kColorConversion601FullRange[];//全彩
    extern const GLfloat kColorConversion709[];//高清晰度
    

    片段着色器:

    extern NSString *const kGPUImageYUVVideoRangeConversionForRGFragmentShaderString;
    extern NSString *const kGPUImageYUVFullRangeConversionForLAFragmentShaderString;
    extern NSString *const kGPUImageYUVVideoRangeConversionForLAFragmentShaderString;
    

    代理:

    -(void)willOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer;//将要输出samp leBuffer
    

    私有属性:

        NSUInteger numberOfFramesCaptured;//已采集的帧数
        CGFloat totalFrameTimeDuringCapture;//采集的总帧数
        AVCaptureSession *_captureSession;//采集会话层
        AVCaptureDevice *_inputCamera;//视频输入设备
        AVCaptureDevice *_microphone;//音频输入设备
        AVCaptureDeviceInput *videoInput;//视频输入
        AVCaptureVideoDataOutput *videoOutput;//视频数据输出
    
        BOOL capturePaused;//停止采集
        GPUImageRotationMode outputRotation, internalRotation;//输入和输出旋转方式
        dispatch_semaphore_t frameRenderingSemaphore;//帧渲染信号量
    
        BOOL captureAsYUV;//yuv格式采集
        GLuint luminanceTexture, chrominanceTexture;//亮度纹理、色度纹理
    
        __unsafe_unretained id<GPUImageVideoCameraDelegate> _delegate;//摄像头采集协议
    

    属性:

        @property(readonly, retain, nonatomic) AVCaptureSession *captureSession;//会话层
        @property (readwrite, nonatomic, copy) NSString *captureSessionPreset;//采集分辨率
        @property (readwrite) int32_t frameRate;//帧率
        @property (readonly, getter = isFrontFacingCameraPresent) BOOL frontFacingCameraPresent;//前置摄像头
        @property (readonly, getter = isBackFacingCameraPresent) BOOL backFacingCameraPresent;//后置摄像头
        @property(readwrite, nonatomic) BOOL runBenchmark;//基准
        @property(readonly) AVCaptureDevice *inputCamera;//输入摄像头
        @property(readwrite, nonatomic) UIInterfaceOrientation outputImageOrientation;//摄像头朝向
        @property(readwrite, nonatomic) BOOL horizontallyMirrorFrontFacingCamera, horizontallyMirrorRearFacingCamera;//前者摄像头水平镜像,后置摄像头水平镜像
        @property(nonatomic, assign) id<GPUImageVideoCameraDelegate> delegate;//摄像头代理
    

    方法集合:

    -(id)initWithSessionPreset:(NSString *)sessionPreset cameraPosition:(AVCaptureDevicePosition)cameraPosition;//根据分辨率、摄像头朝向初始化摄像头
        -(BOOL)addAudioInputsAndOutputs;//添加音频的输入和输出
        -(BOOL)removeAudioInputsAndOutputs;//移除音频的输入和输出
        -(void)removeInputsAndOutputs;//移除输入和输出设备
        -(void)startCameraCapture;//开始采集
        -(void)stopCameraCapture;//停止采集
        -(void)pauseCameraCapture;//暂停采集
        -(void)resumeCameraCapture;//恢复采集
        -(void)processVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer;//处理视频数据
        -(void)processAudioSampleBuffer:(CMSampleBufferRef)sampleBuffer;//处理音频数据
        -(AVCaptureDevicePosition)cameraPosition;//摄像头位置(前置/后置)
        -(AVCaptureConnection *)videoCaptureConnection;//视频连接
        -(void)rotateCamera;//转换摄像头
        -(CGFloat)averageFrameDurationDuringCapture;//平均帧时长
        - (void)resetBenchmarkAverage;
        + (BOOL)isBackFacingCameraPresent;
        + (BOOL)isFrontFacingCameraPresent;
    

    相关文章

      网友评论

          本文标题:GPUImageVideoCamera 方法解析

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