TuSDKFilterProcessor Class Reference

Inherits from TuSDKFilterProcessorBase
Declared in TuSDKFilterProcessor.h

Overview

滤镜引擎,实时处理帧数据,并返回处理的结果

特效管理

Other Methods

– initWithFormatType:isOriginalOrientation:videoSize:

初始化

- (instancetype)initWithFormatType:(OSType)pixelFormatType isOriginalOrientation:(BOOL)isOriginalOrientation videoSize:(CGSize)outputSize

Parameters

pixelFormatType

原始采样的pixelFormat Type

isOriginalOrientation

传入图像的方向是否为原始朝向,SDK 将依据该属性来调整人脸检测时图片的角度。如果没有对图片进行旋转,则为 YES

outputSize

输出尺寸

Return Value

instance

Discussion

支持: kCVPixelFormatType_420YpCbCr8BiPlanarFullRange | kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange kCVPixelFormatType_32BGRA

Declared In

TuSDKFilterProcessor.h

  enableLiveSticker

是否开启动态贴纸 (默认: NO)

@property (nonatomic) BOOL enableLiveSticker

Declared In

TuSDKFilterProcessor.h

  faceDetectionDelegate

人脸检测事件委托

@property (nonatomic, weak) id<TuSDKFilterProcessorFaceDetectionDelegate> faceDetectionDelegate

Declared In

TuSDKFilterProcessor.h

  mediaEffectDelegate

特效事件委托

@property (nonatomic, weak) id<TuSDKFilterProcessorMediaEffectDelegate> mediaEffectDelegate

Declared In

TuSDKFilterProcessor.h

  outputPixelFormatType

输出 PixelBuffer 格式,可选: lsqFormatTypeBGRA | lsqFormatTypeYUV420F | lsqFormatTypeRawData 默认:lsqFormatTypeBGRA

@property (nonatomic) lsqFrameFormatType outputPixelFormatType

Declared In

TuSDKFilterProcessor.h

  adjustOutputRotation

是否调整输出方向,当 isOriginalOrientation 为 YES 时生效; YES: 调整输出的buffer方向 NO:输出的buffer方向与输入保持一致 默认:NO

@property (nonatomic, assign) BOOL adjustOutputRotation

Declared In

TuSDKFilterProcessor.h

  interfaceOrientation

用户界面方向 默认为:UIInterfaceOrientationPortrait

@property (readwrite, nonatomic) UIInterfaceOrientation interfaceOrientation

Declared In

TuSDKFilterProcessor.h

  mediaEffectsSync

特效播放类

@property (nonatomic, strong) id<TuSDKMediaEffectSync> mediaEffectsSync

Declared In

TuSDKFilterProcessor.h

  filterWrapChain

特效播放类

@property (nonatomic, readonly) TuSDKComboFilterWrapChain *filterWrapChain

Declared In

TuSDKFilterProcessor.h

– syncProcessVideoSampleBuffer:frameTime:

Process a video sample and return result soon

- (CVPixelBufferRef)syncProcessVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer frameTime:(CMTime)currentTime

Parameters

sampleBuffer

sampleBuffer sampleBuffer Buffer to process

Return Value

Video PixelBuffer

Declared In

TuSDKFilterProcessor.h

– syncProcessVideoSampleBuffer:

Process a video sample and return result soon

- (CVPixelBufferRef)syncProcessVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer

Parameters

sampleBuffer

sampleBuffer sampleBuffer Buffer to process

Return Value

Video PixelBuffer

Declared In

TuSDKFilterProcessor.h

– syncProcessPixelBuffer:

Process pixelBuffer and return result soon

- (CVPixelBufferRef)syncProcessPixelBuffer:(CVPixelBufferRef)pixelBuffer

Parameters

pixelBuffer

pixelBuffer

Return Value

PixelBuffer

Declared In

TuSDKFilterProcessor.h

– syncProcessPixelBuffer:frameTime:

Process pixelBuffer and return result soon

- (CVPixelBufferRef)syncProcessPixelBuffer:(CVPixelBufferRef)pixelBuffer frameTime:(CMTime)currentTime

Parameters

pixelBuffer

pixelBuffer

currentTime

frameTime

Return Value

PixelBuffer

Declared In

TuSDKFilterProcessor.h

– syncProcessTexture:textureSize:

在OpenGL线程中调用,在这里可以进行采集图像的二次处理

- (GLuint)syncProcessTexture:(GLuint)texture textureSize:(CGSize)size

Parameters

texture

纹理ID

size

纹理尺寸

Return Value

返回的纹理

Declared In

TuSDKFilterProcessor.h

– copyPixelBuffer:dest:

将 CVPixelBufferRef 数据从 srcPixelBuffer 复制到 destPixelBuffer

- (void)copyPixelBuffer:(CVPixelBufferRef)srcPixelBuffer dest:(CVPixelBufferRef)destPixelBuffer

Parameters

srcPixelBuffer

源 CVPixelBufferRef

destPixelBuffer

目标 CVPixelBufferRef

Declared In

TuSDKFilterProcessor.h

– destroyFrameData

手动销毁帧数据

- (void)destroyFrameData

Declared In

TuSDKFilterProcessor.h

– setDetectScale:

设置检测框最小倍数 [取值范围: 0.1 < x < 0.5, 默认: 0.2] 值越大性能越高距离越近

- (void)setDetectScale:(CGFloat)scale

Declared In

TuSDKFilterProcessor.h

– destory

销毁

- (void)destory

Declared In

TuSDKFilterProcessor.h

MediaEffectManager Methods

– switchFilterWithCode:

切换滤镜

- (BOOL)switchFilterWithCode:(NSString *)code

Parameters

code

滤镜代号

Return Value

是否成功切换滤镜

Declared In

TuSDKFilterProcessor.h

– showGroupSticker:

显示一组动态贴纸。当显示一组贴纸时,会清除画布上的其它贴纸

- (void)showGroupSticker:(TuSDKPFStickerGroup *)groupSticker

Parameters

groupSticker

动态贴纸对象

Declared In

TuSDKFilterProcessor.h

– isGroupStickerUsed:

动态贴纸组是否已在使用

- (BOOL)isGroupStickerUsed:(TuSDKPFStickerGroup *)groupSticker

Parameters

groupSticker

动态贴纸组对象

Return Value

是否使用

Declared In

TuSDKFilterProcessor.h

– removeAllLiveSticker

清除动态贴纸

- (void)removeAllLiveSticker

Declared In

TuSDKFilterProcessor.h

– isSupportedMediaEffectType:

验证 TuSDKFilterProcessor 当前是否支持该特效类型

- (BOOL)isSupportedMediaEffectType:(TuSDKMediaEffectDataType)mediaEffectType

Parameters

mediaEffectType

特效类型

Return Value

true/false

Availability

v2.2.0

Declared In

TuSDKFilterProcessor.h

– addMediaEffect:

添加一个多媒体特效。该方法不会自动设置触发时间. 如果已有特效和该特效不能同时共存,已有旧特效将被移除.

- (BOOL)addMediaEffect:(id<TuSDKMediaEffect>)mediaEffect

Parameters

mediaEffect

特效数据

Availability

v2.2.0

Declared In

TuSDKFilterProcessor.h

– removeMediaEffect:

移除特效数据

- (void)removeMediaEffect:(id<TuSDKMediaEffect>)mediaEffect

Parameters

mediaEffect

特效数据

Availability

v2.2.0

Declared In

TuSDKFilterProcessor.h

– removeMediaEffectsWithType:

移除指定类型的特效信息

- (void)removeMediaEffectsWithType:(NSUInteger)effectType

Parameters

effectType

特效类型

Availability

v2.2.0

Declared In

TuSDKFilterProcessor.h

– removeAllMediaEffect

移除所有特效数据

- (void)removeAllMediaEffect

Availability

v2.2.0

Declared In

TuSDKFilterProcessor.h

– mediaEffectsWithType:

获取指定类型的特效信息

- (NSArray<id<TuSDKMediaEffect> > *)mediaEffectsWithType:(NSUInteger)effectType

Parameters

effectType

特效数据类型

Return Value

特效列表

Availability

v2.2.0

Declared In

TuSDKFilterProcessor.h

– mediaEffects

获取所有特效

- (NSArray<__kindofid<TuSDKMediaEffect> > *)mediaEffects

Return Value

NSArray<idTuSDKMediaEffect *

Availability

v3.0.1

Declared In

TuSDKFilterProcessor.h