SLGPUImageVideoCamera Class Reference

Inherits from SLGPUImageOutput : NSObject
Conforms to AVCaptureAudioDataOutputSampleBufferDelegate
AVCaptureVideoDataOutputSampleBufferDelegate
Declared in SLGPUImageVideoCamera.h

Overview

A SLGPUImageOutput that provides frames from either camera

Other Methods

  isRunning

Whether or not the underlying AVCaptureSession is running

@property (readonly, nonatomic) BOOL isRunning

Declared In

SLGPUImageVideoCamera.h

  captureSession

The AVCaptureSession used to capture from the camera

@property (readonly, retain, nonatomic) AVCaptureSession *captureSession

Declared In

SLGPUImageVideoCamera.h

  captureSessionPreset

This enables the capture session preset to be changed on the fly

@property (readwrite, nonatomic, copy) NSString *captureSessionPreset

Declared In

SLGPUImageVideoCamera.h

  frameRate

Setting this to 0 or below will set the frame rate back to the default setting for a particular preset.

@property (readwrite) int32_t frameRate

Declared In

SLGPUImageVideoCamera.h

  frontFacingCameraPresent

Easy way to tell which cameras are present on device

@property (readonly, getter=isFrontFacingCameraPresent) BOOL frontFacingCameraPresent

Declared In

SLGPUImageVideoCamera.h

  runBenchmark

This enables the benchmarking mode, which logs out instantaneous and average frame times to the console

@property (readwrite, nonatomic) BOOL runBenchmark

Declared In

SLGPUImageVideoCamera.h

  inputCamera

Use this property to manage camera settings. Focus point, exposure point, etc.

@property (readonly) AVCaptureDevice *inputCamera

Declared In

SLGPUImageVideoCamera.h

  outputImageOrientation

This determines the rotation applied to the output image, based on the source material

@property (readwrite, nonatomic) UIInterfaceOrientation outputImageOrientation

Declared In

SLGPUImageVideoCamera.h

  horizontallyMirrorRearFacingCamera

These properties determine whether or not the two camera orientations should be mirrored. By default, both are NO.

@property (readwrite, nonatomic) BOOL horizontallyMirrorFrontFacingCamera , horizontallyMirrorRearFacingCamera

Declared In

SLGPUImageVideoCamera.h

Initialization and teardown

– initWithSessionPreset:cameraPosition:

Begin a capture session

- (id)initWithSessionPreset:(NSString *)sessionPreset cameraPosition:(AVCaptureDevicePosition)cameraPosition

Parameters

sessionPreset

Session preset to use

cameraPosition

Camera to capture from

Discussion

See AVCaptureSession for acceptable values

Declared In

SLGPUImageVideoCamera.h

– addAudioInputsAndOutputs

Add audio capture to the session. Adding inputs and outputs freezes the capture session momentarily, so you can use this method to add the audio inputs and outputs early, if you’re going to set the audioEncodingTarget later. Returns YES is the audio inputs and outputs were added, or NO if they had already been added.

- (BOOL)addAudioInputsAndOutputs

Declared In

SLGPUImageVideoCamera.h

– removeAudioInputsAndOutputs

Remove the audio capture inputs and outputs from this session. Returns YES if the audio inputs and outputs were removed, or NO is they hadn’t already been added.

- (BOOL)removeAudioInputsAndOutputs

Declared In

SLGPUImageVideoCamera.h

– removeInputsAndOutputs

Tear down the capture session

- (void)removeInputsAndOutputs

Declared In

SLGPUImageVideoCamera.h

Manage the camera video stream

– startCameraCapture

Start camera capturing

- (void)startCameraCapture

Declared In

SLGPUImageVideoCamera.h

– stopCameraCapture

Stop camera capturing

- (void)stopCameraCapture

Declared In

SLGPUImageVideoCamera.h

– pauseCameraCapture

Pause camera capturing

- (void)pauseCameraCapture

Declared In

SLGPUImageVideoCamera.h

– resumeCameraCapture

Resume camera capturing

- (void)resumeCameraCapture

Declared In

SLGPUImageVideoCamera.h

– processVideoSampleBuffer:

Process a video sample

- (void)processVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer

Parameters

sampleBuffer

Buffer to process

Declared In

SLGPUImageVideoCamera.h

– processAudioSampleBuffer:

Process an audio sample

- (void)processAudioSampleBuffer:(CMSampleBufferRef)sampleBuffer

Parameters

sampleBuffer

Buffer to process

Declared In

SLGPUImageVideoCamera.h

– cameraPosition

Get the position (front, rear) of the source camera

- (AVCaptureDevicePosition)cameraPosition

Declared In

SLGPUImageVideoCamera.h

– videoCaptureConnection

Get the AVCaptureConnection of the source camera

- (AVCaptureConnection *)videoCaptureConnection

Declared In

SLGPUImageVideoCamera.h

– rotateCamera

This flips between the front and rear cameras

- (void)rotateCamera

Declared In

SLGPUImageVideoCamera.h

Benchmarking

– averageFrameDurationDuringCapture

When benchmarking is enabled, this will keep a running average of the time from uploading, processing, and final recording or display

- (CGFloat)averageFrameDurationDuringCapture

Declared In

SLGPUImageVideoCamera.h