Classes

The following classes are available globally.

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBAcneRegions : NSObject
    - (nonnull instancetype)initWithRegions:(nonnull NSArray<BNBPixelRect *> *)regions
                             basisTransform:(nonnull NSArray<NSNumber *> *)basisTransform;
    + (nonnull instancetype)acneRegionsWithRegions:(nonnull NSArray<BNBPixelRect *> *)regions
                                    basisTransform:(nonnull NSArray<NSNumber *> *)basisTransform;
    
    @property (nonatomic, readonly, nonnull) NSArray<BNBPixelRect *> * regions;
    
    /** (common -> rect) transformation */
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * basisTransform;
    
    @end

    Swift

    class BNBAcneRegions : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBActionUnits : NSObject
    - (nonnull instancetype)initWithRotX:(float)rotX
                                    rotY:(float)rotY
                                    rotZ:(float)rotZ
                                   units:(nonnull NSArray<NSNumber *> *)units;
    + (nonnull instancetype)actionUnitsWithRotX:(float)rotX
                                           rotY:(float)rotY
                                           rotZ:(float)rotZ
                                          units:(nonnull NSArray<NSNumber *> *)units;
    
    @property (nonatomic, readonly) float rotX;
    
    @property (nonatomic, readonly) float rotY;
    
    @property (nonatomic, readonly) float rotZ;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * units;
    
    @end

    Swift

    class BNBActionUnits : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBActionUnitsData : NSObject
    - (nonnull instancetype)initWithFaces:(nonnull NSArray<BNBActionUnits *> *)faces;
    + (nonnull instancetype)actionUnitsDataWithFaces:(nonnull NSArray<BNBActionUnits *> *)faces;
    
    @property (nonatomic, readonly, nonnull) NSArray<BNBActionUnits *> * faces;
    
    @end

    Swift

    class BNBActionUnitsData : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBBnbMorphResult : NSObject
    - (nonnull instancetype)initWithImg:(nonnull BNBFullImageData *)img
                              landmarks:(nonnull NSArray<NSNumber *> *)landmarks;
    + (nonnull instancetype)bnbMorphResultWithImg:(nonnull BNBFullImageData *)img
                                        landmarks:(nonnull NSArray<NSNumber *> *)landmarks;
    
    @property (nonatomic, readonly, nonnull) BNBFullImageData * img;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * landmarks;
    
    @end

    Swift

    class BNBBnbMorphResult : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBBrowsMask : NSObject
    - (nonnull instancetype)initWithLeft:(nonnull BNBTransformedMaskByte *)left
                                   right:(nonnull BNBTransformedMaskByte *)right;
    + (nonnull instancetype)browsMaskWithLeft:(nonnull BNBTransformedMaskByte *)left
                                        right:(nonnull BNBTransformedMaskByte *)right;
    
    @property (nonatomic, readonly, nonnull) BNBTransformedMaskByte * left;
    
    @property (nonatomic, readonly, nonnull) BNBTransformedMaskByte * right;
    
    @end

    Swift

    class BNBBrowsMask : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBCameraPosition : NSObject
    - (nonnull instancetype)initWithModelViewM:(nonnull NSArray<NSNumber *> *)modelViewM
                                   projectionM:(nonnull NSArray<NSNumber *> *)projectionM;
    + (nonnull instancetype)cameraPositionWithModelViewM:(nonnull NSArray<NSNumber *> *)modelViewM
                                             projectionM:(nonnull NSArray<NSNumber *> *)projectionM;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * modelViewM;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * projectionM;
    
    @end

    Swift

    class BNBCameraPosition : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBDepthMap : NSObject
    - (nonnull instancetype)initWithDepthData:(nonnull NSData *)depthData
                                depthMapWidth:(int32_t)depthMapWidth
                               depthMapHeight:(int32_t)depthMapHeight;
    + (nonnull instancetype)depthMapWithDepthData:(nonnull NSData *)depthData
                                    depthMapWidth:(int32_t)depthMapWidth
                                   depthMapHeight:(int32_t)depthMapHeight;
    
    @property (nonatomic, readonly, nonnull) NSData * depthData;
    
    @property (nonatomic, readonly) int32_t depthMapWidth;
    
    @property (nonatomic, readonly) int32_t depthMapHeight;
    
    @end

    Swift

    class BNBDepthMap : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBEffect : NSObject
    
    /** Thread-safe. May be called from any thread */
    - (nonnull NSString *)url;
    
    /**
     * Call js method in effect. 
     * @param methodName JS global function name. Member functions are not supported.
     * @param params Function arguments.
     * @depreacted Use `evalJs` instead.
     */
    - (void)callJsMethod:(nonnull NSString *)methodName
                  params:(nonnull NSString *)params;
    
    /**
     * Evaluate the `script` in effect. This method is thread safe.
     * @param sctipt JS string to execute 
     * @param js_callback Callback for result, will be called in render thread.
     */
    - (void)evalJs:(nonnull NSString *)script
    resultCallback:(nullable id<BNBJsCallback>)resultCallback;
    
    /**
     * Evaluate the `script` in effect.
     * MUST be called from the render thread
     * @param sctipt JS string to execute 
     * @return JS evaluation result
     */
    - (nonnull NSString *)evalJsSync:(nonnull NSString *)script;
    
    /**
     * Reset effect state
     * MUST be called from the render thread
     */
    - (void)reset;
    
    /**
     * Update effect state (evaluate scheduled JS calls)
     * MUST be called from the render thread
     */
    - (void)update;
    
    /**
     * Deserialize effect from the provided `resoved_url`. If `configOverride` is an
     * empty string, will use `config.json` under provided `resolvedUrl`, otherwise
     * content of `configOverride` will be used.
     * 
     * Can be called from any thread.
     */
    - (void)deserialize:(nonnull NSString *)resolvedUrl
         configOverride:(nonnull NSString *)configOverride;
    
    /**
     * activate current effect
     * MUST be called from the render thread for OpenGL backends.
     */
    - (void)activate:(int32_t)fxWidth
            fxHeight:(int32_t)fxHeight
        surfaceWidth:(int32_t)surfaceWidth
       surfaceHeight:(int32_t)surfaceHeight;
    
    - (void)dumpFs:(nonnull NSString *)outDir;
    
    - (void)dump;
    
    - (nonnull NSString *)dumpJson;
    
    - (BNBEffectStatus)status;
    
    @end

    Swift

    class BNBEffect : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBEffectInfo : NSObject
    - (nonnull instancetype)initWithUrl:(nonnull NSString *)url
                     recognizerFeatures:(nonnull NSSet<NSNumber *> *)recognizerFeatures
                              usesAudio:(BOOL)usesAudio
                              usesVideo:(BOOL)usesVideo
                            usesTouches:(BOOL)usesTouches
                       usesBgSeparation:(BOOL)usesBgSeparation;
    + (nonnull instancetype)effectInfoWithUrl:(nonnull NSString *)url
                           recognizerFeatures:(nonnull NSSet<NSNumber *> *)recognizerFeatures
                                    usesAudio:(BOOL)usesAudio
                                    usesVideo:(BOOL)usesVideo
                                  usesTouches:(BOOL)usesTouches
                             usesBgSeparation:(BOOL)usesBgSeparation;
    
    @property (nonatomic, readonly, nonnull) NSString * url;
    
    @property (nonatomic, readonly, nonnull) NSSet<NSNumber *> * recognizerFeatures;
    
    @property (nonatomic, readonly) BOOL usesAudio;
    
    @property (nonatomic, readonly) BOOL usesVideo;
    
    @property (nonatomic, readonly) BOOL usesTouches;
    
    @property (nonatomic, readonly) BOOL usesBgSeparation;
    
    @end

    Swift

    class BNBEffectInfo : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBEffectManager : NSObject
    
    /**
     * Add callback to receive errors messages from Effect Player.
     * Thread-safe. May be called from any thread
     */
    - (void)addErrorListener:(nullable id<BNBErrorListener>)errorListener;
    
    /**
     * Remove callback to receive errors messages from Effect Player.
     * Thread-safe. May be called from any thread
     */
    - (void)removeErrorListener:(nullable id<BNBErrorListener>)errorListener;
    
    /**
     * Add callback to receive user-visible messages from effects.
     * You should display them on UI.
     * Thread-safe. May be called from any thread
     */
    - (void)addHintListener:(nullable id<BNBHintListener>)hintListener;
    
    /**
     * Remove callback to receive user-visible messages from effects.
     * Thread-safe. May be called from any thread
     */
    - (void)removeHintListener:(nullable id<BNBHintListener>)hintListener;
    
    /**
     * Add callback to receive events from effect.
     * Thread-safe. May be called from any thread
     */
    - (void)addEffectEventListener:(nullable id<BNBEffectEventListener>)effectEventListener;
    
    /**
     * Remove callback to receive events from effect.
     * Thread-safe. May be called from any thread
     */
    - (void)removeEffectEventListener:(nullable id<BNBEffectEventListener>)effectEventListener;
    
    /**
     * Add callback to receive notifications on effect change.
     * Thread-safe. May be called from any thread
     */
    - (void)addEffectActivatedListener:(nullable id<BNBEffectActivatedListener>)effectActivatedListener;
    
    /**
     * Remove callback to receive notifications on effect change.
     * Thread-safe. May be called from any thread
     */
    - (void)removeEffectActivatedListener:(nullable id<BNBEffectActivatedListener>)effectActivatedListener;
    
    /** Create empty effect. If working directory path is empty string then effect assumed as an in-memory effect. */
    - (nullable BNBEffect *)createEffect:(nonnull NSString *)workDir;
    
    /**
     * Set current effect.
     * Thread-safe. May be called from any thread
     */
    - (void)setCurrentEffect:(nullable BNBEffect *)effect;
    
    /**
     * Load and activate effect sync.
     * MUST be called from the render thread.
     */
    - (nullable BNBEffect *)load:(nonnull NSString *)url;
    
    /**
     * Load effect async, activate in the draw() call when it will be ready.
     * Thread-safe. May be called from any thread.
     */
    - (nullable BNBEffect *)loadAsync:(nonnull NSString *)url;
    
    /**
     * Reload current effect config from the string provided. If this reload
     * is possible without effect recreation, this method will return `hot_reload == true`,
     * otherwise `current` effect will be replaced and the method will return
     * `hot_reload == false`.
     *
     * Thread-safe. May be called from any thread. 
     */
    - (nullable BNBReloadResult *)reloadConfig:(nonnull NSString *)config;
    
    /**
     * Get effect info. May be called before loading effect
     * "render type" and "recognizer features" fields won't be filled
     * Thread-safe. May be called from any thread
     */
    + (nonnull BNBEffectInfo *)getEffectInfo:(nonnull NSString *)url;
    
    /**
     * Unload effect from cache. if no currently loading effect -
     * works the same way as load(""); launches empty effect loading.
     * MUST be called from the render thread
     */
    - (void)unload:(nullable BNBEffect *)effect;
    
    /**
     * Get active effect
     * Thread-safe. May be called from any thread
     */
    - (nullable BNBEffect *)current;
    
    /**
     * Update effect loading state
     * @param sync syncronize effect manager, block until effect loaded
     * MUST be called from the render thread
     */
    - (void)update:(BOOL)sync;
    
    /**
     * Get current effect size
     * Thread-safe. May be called from any thread
     */
    - (nonnull BNBSize *)effectSize;
    
    /**
     * Get current surface size
     * Thread-safe. May be called from any thread
     */
    - (nonnull BNBSize *)surfaceSize;
    
    /**
     * Get effect audio volume.
     * Thread-safe. May be called from any thread
     * @return A volume in range `[0, 1]`, where `1` means maximum volume.
     */
    - (float)effectVolume;
    
    /**
     * Set effect audio volume.
     * Thread-safe. May be called from any thread
     * @param volume A value in range `[0, 1]`, where `1` means maximum volume.
     */
    - (void)setEffectVolume:(float)volume;
    
    /**
     * Changes effect player render size, should be called on render thread.
     * MUST be called from the render thread
     */
    - (void)setEffectSize:(int32_t)fxWidth
                 fxHeight:(int32_t)fxHeight;
    
    /** set different render surfaces. Can be treated as void* */
    - (void)setRenderSurface:(nonnull BNBSurfaceData *)data;
    
    /** disable surface presentation. Needed for offscreen rendering */
    - (void)disableSurfacePresentation;
    
    @end

    Swift

    class BNBEffectManager : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBEffectPlayer : NSObject
    
    + (nullable BNBEffectPlayer *)create:(nullable BNBEffectPlayerConfiguration *)configuration;
    
    /**
     * Add callback to receive FPS information.
     * Thread-safe. May be called from any thread
     */
    - (void)addFrameDurationListener:(nullable id<BNBFrameDurationListener>)frameDurationListener;
    
    /**
     * Remove callback to receive FPS information.
     * Thread-safe. May be called from any thread
     */
    - (void)removeFrameDurationListener:(nullable id<BNBFrameDurationListener>)frameDurationListener;
    
    /**
     * Add callback to receive faces count in frame.
     * Thread-safe. May be called from any thread
     */
    - (void)addFaceNumberListener:(nullable id<BNBFaceNumberListener>)faceNumberListener;
    
    /**
     * Remove callback to receive faces count in frame.
     * Thread-safe. May be called from any thread
     */
    - (void)removeFaceNumberListener:(nullable id<BNBFaceNumberListener>)faceNumberListener;
    
    /**
     * Add callback to receive frame data right after processing in recognizer.
     * Thread-safe. May be called from any thread
     */
    - (void)addFrameDataListener:(nullable id<BNBFrameDataListener>)frameDataListener;
    
    /**
     * Remove callback to receive frame data right after processing in recognizer.
     * Thread-safe. May be called from any thread
     */
    - (void)removeFrameDataListener:(nullable id<BNBFrameDataListener>)frameDataListener;
    
    /**
     * Add callback to receive center of the face in frame relative to top-left
     * corner in [0, 1] space.
     * Thread-safe. May be called from any thread
     */
    - (void)addCameraPoiListener:(nullable id<BNBCameraPoiListener>)cameraPoiListener;
    
    /**
     * Remove callback to receive center of the face in frame relative to top-left
     * Thread-safe. May be called from any thread
     */
    - (void)removeCameraPoiListener:(nullable id<BNBCameraPoiListener>)cameraPoiListener;
    
    /**
     * Add callback to receive current effect info from Effect Player.
     * Thread-safe. May be called from any thread
     */
    - (void)addEffectInfoListener:(nullable id<BNBEffectInfoListener>)effectInfoListener;
    
    /**
     * Remove callback to receive current effect info from Effect Player.
     * Thread-safe. May be called from any thread
     */
    - (void)removeEffectInfoListener:(nullable id<BNBEffectInfoListener>)effectInfoListener;
    
    /**
     * Add callback to receive current effect activation notification from Effect Player.
     * Thread-safe. May be called from any thread
     */
    - (void)addEffectActivationCompletionListener:(nullable id<BNBEffectActivationCompletionListener>)effectActivationCompletionListener;
    
    /**
     * Remove callback to receive current effect activation notification from Effect Player.
     * Thread-safe. May be called from any thread
     */
    - (void)removeEffectActivationCompletionListener:(nullable id<BNBEffectActivationCompletionListener>)effectActivationCompletionListener;
    
    /**
     * Sets maximum allowed face results, if face tracking feature is present.
     * Thread-safe. May be called from any thread
     * This option is relevant only for GLFX effects.
     */
    - (void)setMaxFaces:(int32_t)maxFaces;
    
    /**
     * Set OpenGL name of input external texture.
     * https://developer.android.com/reference/android/graphics/SurfaceTexture .
     * MUST be called from the render thread
     *
     * @param name Texture name
     * @param width Textute width
     * @param height Texture height
     *
     * @see setUseExtCamTex
     *
     * <br/> Note: This function is Android only.
     * <br/> Note: We use texture size to calculate aspect ratio only.
     */
    - (void)setExternalCameraTexture:(int32_t)name
                               width:(int32_t)width
                              height:(int32_t)height;
    
    /**
     * Use external texture as input source.
     * MUST be called from the render thread
     * @see setExternalCameraTexture
     * @note This function is Android only
     */
    - (void)setUseExtCamTex:(BOOL)value;
    
    /**
     * Use to notify the EffectPlayer that the surface exists and effect can be played.
     * 0, 0 for width and height are valid values.
     * MUST be called from the render thread
     */
    - (void)surfaceCreated:(int32_t)width
                    height:(int32_t)height;
    
    /**
     * Notify about rendering surface being resized.
     * MUST be called from the render thread
     */
    - (void)surfaceChanged:(int32_t)width
                    height:(int32_t)height;
    
    /**
     * This method should be called right before an active context will become invalid.
     * Switches playback state to inactive state. If it's not done an application will be
     * crashed on next draw iteration. After losing the surface effect playback can't be
     * resumed from last position.
     * MUST be called from the render thread
     */
    - (void)surfaceDestroyed;
    
    /**
     * Draw the current effect into the current OpenGL framebuffer. Uses internal frame_data
     * object obtained from latest push_frame recognition result.
     *
     * Return current frame number if drawing was performed and caller should swap buffers
     * otherwise `DRAW_SKIPPED`(-1)
     * MUST be called from the render thread
     */
    - (int64_t)draw;
    
    /**
     * Draw the current effect into the current OpenGL framebuffer. Uses externally provided frameData
     * object instead of internal one obtained from latest push_frame recognition result.
     *
     * Return frame number from provided frameData if drawing was performed and caller should swap buffers
     * otherwise `DRAW_SKIPPED`(-1)
     * MUST be called from the render thread
     */
    - (int64_t)drawWithExternalFrameData:(nullable BNBFrameData *)frameData;
    
    /**
     * Record last rendering ("draw_()") result into current OpenGL framebuffer.
     * Content is cropped to maintain effect_size() aspect ratio
     * MUST be called from the render thread
     */
    - (void)captureBlit:(int32_t)captureWidth
          captureHeight:(int32_t)captureHeight;
    
    /**
     * Receive the last rendered frame in binary form.
     *
     * @return 4-byte per pixel data, size is `fx_width * fx_height * 4`
     * MUST be called from the render thread
     */
    - (nonnull BNBPixelBuffer *)readPixels;
    
    /** Thread-safe. May be called from any thread */
    - (void)setRenderConsistencyMode:(BNBConsistencyMode)value;
    
    /**
     * Process an image with current effect.
     *
     * Must be called from the render thread.
     *
     * @param inputImage to avoid conversion recommended to use YUV image
     * @param outputPixelFormat to avoid conversion recommended to use RGBA
     * @param params extra image processing arguments
     */
    - (nonnull NSData *)processImage:(nonnull BNBFullImageData *)inputImage
                   outputPixelFormat:(BNBPixelFormat)outputPixelFormat;
    
    /**
     * Process an image with current effect.
     * Prefer this method over `processImage` when you have extra input data
     * besides just an input image.
     *
     * Must be called from render thread.
     *
     * @param inputFrameData `FrameData` with an image
     * @param outputPixelFormat to avoid conversion recommended to use RGBA
     * @param params extra image processing arguments
     */
    - (nonnull NSData *)processImageFrameData:(nullable BNBFrameData *)inputFrameData
                            outputPixelFormat:(BNBPixelFormat)outputPixelFormat;
    
    /**
     * Process image with current effect.
     * Must be called from render thread.
     * NOTE: inputImage have copy overhead, preferable to use process_image method
     * MUST be called from the render thread
     * @param inputImage input image with `width * height * 4` size
     * @param outputPixelFormat to avoid conversion recommended to use RGBA
     */
    - (nonnull NSData *)processImageData:(nonnull NSData *)inputImage
                                   width:(int32_t)width
                                  height:(int32_t)height
                             orientation:(BNBCameraOrientation)orientation
                              isMirrored:(BOOL)isMirrored
                        inputPixelFormat:(BNBPixelFormat)inputPixelFormat
                       outputPixelFormat:(BNBPixelFormat)outputPixelFormat;
    
    /**
     * Provides image to process and to play effect.
     * Thread-safe. May be called from any thread
     */
    - (void)pushFrame:(nonnull BNBFullImageData *)fullImage;
    
    /**
     * Provides image to process and to play effect.
     * Thread-safe. May be called from any thread
     */
    - (void)pushFrameWithNumber:(nonnull BNBFullImageData *)fullImage
                    frameNumber:(int64_t)frameNumber;
    
    /**
     * Provides FrameData to process and to play effect.
     * Must contain full image.
     * Thread-safe. May be called from any thread
     */
    - (void)pushFrameData:(nullable BNBFrameData *)frameData;
    
    /**
     * Provides FrameData with frame number to process and to play effect.
     * Must contain full image.
     * Thread-safe. May be called from any thread
     */
    - (void)pushFrameDataWithNumber:(nullable BNBFrameData *)frameData
                        frameNumber:(int64_t)frameNumber;
    
    /** MUST be called from the main(render) thread */
    - (void)playbackPlay;
    
    - (void)playbackPause;
    
    - (void)playbackStop;
    
    /** Thread-safe. May be called from any thread */
    - (BNBEffectPlayerPlaybackState)getPlaybackState;
    
    /**
     * Get interface to control user iterations. This events will be passed to effect.
     * Thread-safe. May be called from any thread
     */
    - (nullable BNBInputManager *)getInputManager;
    
    /**
     * Initialize video processing. To provide frames use *process_video_frame* methods.
     * Effect audio is recorded as well and can be accessed using *process_recorded_audio*
     * and *write_recorded_audio*.
     * *push_frame* should not be called during processing.
     * MUST be called from the render thread
     * @throw Exception Must be aborted with stop_video_processing()
     */
    - (void)startVideoProcessing:(int64_t)screenWidth
                    screenHeight:(int64_t)screenHeight
                     orientation:(BNBCameraOrientation)orientation
                     resetEffect:(BOOL)resetEffect
                     offlineMode:(BOOL)offlineMode;
    
    /**
     * Finish processing and return renderer to normal state.
     * MUST be called from the render thread
     */
    - (void)stopVideoProcessing:(BOOL)resetEffect;
    
    /**
     * Provide frame data to evaluate video processing.
     * MUST be called from the render thread
     * @param inputFrameData Frame Data to process.
     * @param params Processing params.
     * @param recognizerIterations Number of processing iterations. Higher number means higher processing quality, but lower speed. Must be greater than 1. Pass null value for default number.
     * @return Frame data with frame processing results.
     */
    - (nullable BNBFrameData *)processVideoFrameData:(nullable BNBFrameData *)inputFrameData
                                recognizerIterations:(nullable NSNumber *)recognizerIterations;
    
    /**
     * Provide frame to evaluate video processing.
     * MUST be called from the render thread
     * @param inputImage Image to process.
     * @param params Processing params.
     * @param recognizerIterations Number of processing iterations. Higher number means higher processing quality, but lower speed. Must be greater than 1. Pass null value for default number.
     * @return Frame data with frame processing results.
     */
    - (nullable BNBFrameData *)processVideoFrame:(nonnull BNBFullImageData *)inputImage
                            recognizerIterations:(nullable NSNumber *)recognizerIterations;
    
    /**
     * Draw processed frame to image buffer.
     * MUST be called from the render thread
     * @param inputFrameData FrameData to draw.
     * @param timeNs Frame position on timeline.
     * @param outputPixelFormat Output image format.
     * @return Buffer with processed image in selected format.
     */
    - (nonnull NSData *)drawVideoFrame:(nullable BNBFrameData *)inputFrameData
                                timeNs:(int64_t)timeNs
                     outputPixelFormat:(BNBPixelFormat)outputPixelFormat;
    
    /**
     * The same as *draw_video_frame* but accepts preallocated buffer to avoid recreation for every frame.
     * MUST be called from the render thread
     */
    - (nonnull NSData *)drawVideoFrameAllocated:(nullable BNBFrameData *)inputFrameData
                                         timeNs:(int64_t)timeNs
                              outputPixelFormat:(BNBPixelFormat)outputPixelFormat
                                allocatedBuffer:(nonnull NSData *)allocatedBuffer;
    
    /**
     * Save recorded audio.
     * Not thread-safe but can be called from any thread.
     * @param filename ".wav" extension must be used.
     * @param lengthMs Track length. Set to '0' to use full duration.
     */
    - (void)writeRecordedAudio:(nonnull NSString *)filename
                      lengthMs:(int64_t)lengthMs;
    
    /**
     * Trigger record start events in EP and Effect.
     * Records all sounds during recording
     * to be replayed by `processRecordedAudio`.
     * If @param playAudioWhileRecording is true, the audio will continue to play. Otherwise, the audio will be muted. 
     * Thread-safe. May be called from any thread
     */
    - (void)onVideoRecordStart:(BOOL)playAudioWhileRecording;
    
    /**
     * Triggers record stop events in EP and Effect.
     * Thread-safe. May be called from any thread
     */
    - (void)onVideoRecordEnd;
    
    /**
     * Get effect manager object
     * Thread-safe. May be called from any thread
     */
    - (nullable BNBEffectManager *)effectManager;
    
    /**
     * Force recognizer offline mode
     * Thread-safe. May be called from any thread
     */
    - (void)setRecognizerOfflineMode:(BOOL)on;
    
    /**
     * Set future frame filtrarion mode.
     * Produce smoother recognition result (anti jitter), however adds inconsistency in push'ed/draw'ed frames (one frame lag)
     * Example: push frame 1 - draw frame 1, push frame 2 - draw frame 1, push frame 3 - draw frame 2, ...
     */
    - (void)setRecognizerUseFutureFilter:(BOOL)on;
    
    /**
     * Set future frame interpolation mode.
     * Produce faster recognition result (skip even frames), however adds inconsistency in push'ed/pop'ed frames (one frame lag)
     * Example: push frame 1 - pop frame 1, push frame 2 - pop frame 1, push frame 3 - pop frame 2, ...
     */
    - (void)setRecognizerUseFutureInterpolate:(BOOL)on;
    
    /**
     * Set frame processor as current
     * Thread-safe. May be called from any thread
     */
    - (void)setFrameProcessor:(nullable BNBFrameProcessor *)processor;
    
    /**
     * Get current frame processor
     * Thread-safe. May be called from any thread
     */
    - (nullable BNBFrameProcessor *)frameProcessor;
    
    + (void)setRenderBackend:(BNBRenderBackendType)backendType;
    
    + (BNBRenderBackendType)getCurrentRenderBackendType;
    
    @end

    Swift

    class BNBEffectPlayer : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBEffectPlayerConfiguration : NSObject
    
    /**
     * @param fxWidth Width of effect rendering area
     * @param fxHeight Height of effect rendering area
     */
    + (nullable BNBEffectPlayerConfiguration *)create:(int32_t)fxWidth
                                             fxHeight:(int32_t)fxHeight;
    
    /** Init audio device. */
    - (void)setAudioEnabled:(BOOL)enabled;
    
    @end

    Swift

    class BNBEffectPlayerConfiguration : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBEglContext : NSObject
    
    + (nullable BNBEglContext *)create:(int32_t)width
                                height:(int32_t)height;
    
    - (BOOL)check;
    
    - (void)activate;
    
    - (void)deactivate;
    
    @end

    Swift

    class BNBEglContext : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBExternalFaceData : NSObject
    - (nonnull instancetype)initWithVertices:(nonnull NSArray<NSNumber *> *)vertices
                                    modelMat:(nonnull NSArray<NSNumber *> *)modelMat
                                     viewMat:(nonnull NSArray<NSNumber *> *)viewMat
                                     projMat:(nonnull NSArray<NSNumber *> *)projMat
                                   landmarks:(nonnull NSArray<NSNumber *> *)landmarks
                               landmarksMask:(nonnull NSArray<NSNumber *> *)landmarksMask
                              landmarksBrows:(nonnull NSArray<NSNumber *> *)landmarksBrows
                                     latents:(nonnull NSArray<NSNumber *> *)latents;
    + (nonnull instancetype)externalFaceDataWithVertices:(nonnull NSArray<NSNumber *> *)vertices
                                                modelMat:(nonnull NSArray<NSNumber *> *)modelMat
                                                 viewMat:(nonnull NSArray<NSNumber *> *)viewMat
                                                 projMat:(nonnull NSArray<NSNumber *> *)projMat
                                               landmarks:(nonnull NSArray<NSNumber *> *)landmarks
                                           landmarksMask:(nonnull NSArray<NSNumber *> *)landmarksMask
                                          landmarksBrows:(nonnull NSArray<NSNumber *> *)landmarksBrows
                                                 latents:(nonnull NSArray<NSNumber *> *)latents;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * vertices;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * modelMat;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * viewMat;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * projMat;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * landmarks;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * landmarksMask;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * landmarksBrows;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * latents;
    
    @end

    Swift

    class BNBExternalFaceData : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBEyesCorneoscleraMask : NSObject
    - (nonnull instancetype)initWithLeft:(nonnull BNBTransformedMaskByte *)left
                                   right:(nonnull BNBTransformedMaskByte *)right;
    + (nonnull instancetype)eyesCorneoscleraMaskWithLeft:(nonnull BNBTransformedMaskByte *)left
                                                   right:(nonnull BNBTransformedMaskByte *)right;
    
    @property (nonatomic, readonly, nonnull) BNBTransformedMaskByte * left;
    
    @property (nonatomic, readonly, nonnull) BNBTransformedMaskByte * right;
    
    @end

    Swift

    class BNBEyesCorneoscleraMask : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBEyesIrisMask : NSObject
    - (nonnull instancetype)initWithLeft:(nonnull BNBTransformedMaskByte *)left
                                   right:(nonnull BNBTransformedMaskByte *)right;
    + (nonnull instancetype)eyesIrisMaskWithLeft:(nonnull BNBTransformedMaskByte *)left
                                           right:(nonnull BNBTransformedMaskByte *)right;
    
    @property (nonatomic, readonly, nonnull) BNBTransformedMaskByte * left;
    
    @property (nonatomic, readonly, nonnull) BNBTransformedMaskByte * right;
    
    @end

    Swift

    class BNBEyesIrisMask : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBEyesMask : NSObject
    - (nonnull instancetype)initWithIris:(nonnull BNBEyesIrisMask *)iris
                            corneosclera:(nonnull BNBEyesCorneoscleraMask *)corneosclera
                                   pupil:(nonnull BNBEyesPupilMask *)pupil;
    + (nonnull instancetype)eyesMaskWithIris:(nonnull BNBEyesIrisMask *)iris
                                corneosclera:(nonnull BNBEyesCorneoscleraMask *)corneosclera
                                       pupil:(nonnull BNBEyesPupilMask *)pupil;
    
    @property (nonatomic, readonly, nonnull) BNBEyesIrisMask * iris;
    
    @property (nonatomic, readonly, nonnull) BNBEyesCorneoscleraMask * corneosclera;
    
    @property (nonatomic, readonly, nonnull) BNBEyesPupilMask * pupil;
    
    @end

    Swift

    class BNBEyesMask : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBEyesPupilMask : NSObject
    - (nonnull instancetype)initWithLeft:(nonnull BNBTransformedMaskByte *)left
                                   right:(nonnull BNBTransformedMaskByte *)right;
    + (nonnull instancetype)eyesPupilMaskWithLeft:(nonnull BNBTransformedMaskByte *)left
                                            right:(nonnull BNBTransformedMaskByte *)right;
    
    @property (nonatomic, readonly, nonnull) BNBTransformedMaskByte * left;
    
    @property (nonatomic, readonly, nonnull) BNBTransformedMaskByte * right;
    
    @end

    Swift

    class BNBEyesPupilMask : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBEyesState : NSObject
    - (nonnull instancetype)initWithIsOpenLeft:(BOOL)isOpenLeft
                                   isOpenRight:(BOOL)isOpenRight;
    + (nonnull instancetype)eyesStateWithIsOpenLeft:(BOOL)isOpenLeft
                                        isOpenRight:(BOOL)isOpenRight;
    
    @property (nonatomic, readonly) BOOL isOpenLeft;
    
    @property (nonatomic, readonly) BOOL isOpenRight;
    
    @end

    Swift

    class BNBEyesState : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBFaceData : NSObject
    
    + (nullable BNBFaceData *)create;
    
    - (nonnull NSArray<NSNumber *> *)getLandmarks;
    
    - (void)setLandmarks:(nonnull NSArray<NSNumber *> *)lms;
    
    - (nonnull NSArray<NSNumber *> *)getLatents;
    
    - (void)setLatents:(nonnull NSArray<NSNumber *> *)lats;
    
    - (nonnull NSArray<NSNumber *> *)getVertices;
    
    - (void)setVertices:(nonnull NSArray<NSNumber *> *)verts;
    
    - (nonnull NSArray<NSNumber *> *)getEarsLandmarks;
    
    - (void)setEarsLandmarks:(nonnull NSArray<NSNumber *> *)lms;
    
    - (nonnull NSArray<NSNumber *> *)getEarsLatents;
    
    - (void)setEarsLatents:(nonnull NSArray<NSNumber *> *)lats;
    
    - (nonnull NSArray<NSNumber *> *)getBrowsLms;
    
    - (void)setBrowsLms:(nonnull NSArray<NSNumber *> *)lms;
    
    - (nonnull BNBCameraPosition *)getCameraPosition;
    
    - (void)setCameraPosition:(nonnull BNBCameraPosition *)cam;
    
    /** filled when face_match feature is enabled */
    - (nonnull NSArray<NSNumber *> *)getEmbeddings;
    
    - (BOOL)hasFace;
    
    - (nonnull BNBPixelRect *)getFaceRect;
    
    - (void)setFaceRect:(nonnull BNBPixelRect *)rect;
    
    - (BNBGender)getGender;
    
    - (void)setGender:(BNBGender)g;
    
    @end

    Swift

    class BNBFaceData : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBFeatureParameter : NSObject
    - (nonnull instancetype)initWithX:(float)x
                                    y:(float)y
                                    z:(float)z
                                    w:(float)w;
    + (nonnull instancetype)featureParameterWithX:(float)x
                                                y:(float)y
                                                z:(float)z
                                                w:(float)w;
    
    @property (nonatomic, readonly) float x;
    
    @property (nonatomic, readonly) float y;
    
    @property (nonatomic, readonly) float z;
    
    @property (nonatomic, readonly) float w;
    
    @end

    Swift

    class BNBFeatureParameter : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBFrameData : NSObject
    
    /** Creates empty `FrameData`. Use `add*` function to fill it.  */
    + (nullable BNBFrameData *)create;
    
    - (nonnull BNBFullImageFormat *)getFullImgFormat;
    
    - (nonnull NSArray<NSNumber *> *)getFullImgTransform;
    
    /** Get frx_recognition_result or null if not exists */
    - (nullable BNBFrxRecognitionResult *)getFrxRecognitionResult;
    
    - (void)setFrxRecognitionResult:(nullable BNBFrxRecognitionResult *)result;
    
    - (nonnull BNBActionUnitsData *)getActionUnits;
    
    - (nonnull BNBAcneRegions *)getAcneRegions;
    
    - (BOOL)getIsSmile;
    
    - (BOOL)getIsMouthOpen;
    
    - (BOOL)getIsBrowsRaised;
    
    - (BOOL)getIsBrowsShifted;
    
    - (BOOL)getIsWearGlasses;
    
    - (float)getRuler;
    
    - (nonnull BNBEyesState *)getEyesState;
    
    - (float)getLightCorrection;
    
    - (nonnull BNBTransformedMaskByte *)getBackground;
    
    - (nonnull BNBTransformedMaskGpu *)getBackgroundGpu;
    
    - (nonnull BNBTransformedMaskByte *)getHair;
    
    - (nonnull BNBTransformedMaskGpu *)getHairGpu;
    
    - (nonnull BNBTransformedMaskByte *)getSkin;
    
    - (nonnull BNBTransformedMaskGpu *)getSkinGpu;
    
    - (nonnull BNBTransformedMaskByte *)getLips;
    
    - (nonnull BNBTransformedMaskGpu *)getLipsGpu;
    
    - (nonnull BNBTransformedMaskByte *)getTeeth;
    
    - (nonnull BNBTransformedMaskByte *)getOcclusion;
    
    - (nonnull BNBTransformedMaskByte *)getBody;
    
    - (nonnull BNBLipsShineMask *)getLipsShine;
    
    - (nonnull BNBBrowsMask *)getBrows;
    
    - (nonnull BNBEyesMask *)getEyes;
    
    - (nonnull BNBTransformedMaskByte *)getFace;
    
    - (nonnull BNBTransformedMaskByte *)getFaceSkin;
    
    - (nullable NSString *)getFaceAttributes;
    
    /** Pupillary distance in mm */
    - (float)getPupillaryDistance;
    
    /**
     * list[0] and list[1] - x and y coordinates of the thermal temperature of the light source
     * list[2] - the brightness of the frame
     */
    - (nonnull NSArray<NSNumber *> *)getLightSourceParams;
    
    - (void)addFullImg:(nonnull BNBFullImageData *)img;
    
    - (void)replaceFullImg:(nonnull BNBFullImageData *)img;
    
    - (void)addBackground:(nonnull BNBTransformedMaskByte *)mask;
    
    - (void)addExternalFaceData:(BNBFaceDataSource)source
                           data:(nonnull NSArray<BNBExternalFaceData *> *)data;
    
    - (void)addDepthMap:(nonnull BNBDepthMap *)depthMap;
    
    - (void)addFrameNumber:(int64_t)frameNumber;
    
    - (void)addActionUnitsData:(nonnull BNBActionUnitsData *)actionUnits;
    
    /**
     * Extra parameters during in-CPU feature calculations.
     * Reference feature documentation. 
     */
    - (void)addFeatureParameters:(nonnull NSDictionary<NSNumber *, NSArray<BNBFeatureParameter *> *> *)params;
    
    /**add frame timestamp in microseconds */
    - (void)addTimestampUs:(double)timestampUs;
    
    @end

    Swift

    class BNBFrameData : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBFrameProcessor : NSObject
    
    /** Realtime feed processor. See RealtimeProcessorMode for more info. */
    + (nullable BNBFrameProcessor *)createRealtimeProcessor:(BNBRealtimeProcessorMode)mode
                                                     config:(nullable BNBProcessorConfiguration *)config;
    
    /**
     * Photo processor. `push` to set photo, processing happens on `pop` synchronously.
     * Several `pop` calls return same result without unnecessary processing,
     * except case when recognizer pipeline was changed by EffectPlayer, processing will be restarted.
     */
    + (nullable BNBFrameProcessor *)createPhotoProcessor:(nullable BNBProcessorConfiguration *)config;
    
    /** Video processor. Consistent `push` - `pop` will process frames synchronously. */
    + (nullable BNBFrameProcessor *)createVideoProcessor:(nullable BNBProcessorConfiguration *)config;
    
    - (BNBProcessorType)getType;
    
    - (void)push:(nullable BNBFrameData *)fd;
    
    - (nonnull BNBProcessorResult *)pop;
    
    @end

    Swift

    class BNBFrameProcessor : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBFrxRecognitionResult : NSObject
    
    + (nullable BNBFrxRecognitionResult *)create;
    
    - (nonnull NSArray<BNBFaceData *> *)getFaces;
    
    - (void)setFaces:(nonnull NSArray<BNBFaceData *> *)faces;
    
    - (nonnull NSArray<NSNumber *> *)getTexCoords;
    
    - (nonnull NSArray<NSNumber *> *)getTriangles;
    
    - (nonnull BNBTransformableEvent *)getTransform;
    
    - (void)setTransform:(nonnull BNBTransformableEvent *)t;
    
    @end

    Swift

    class BNBFrxRecognitionResult : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBFullImageFormat : NSObject
    - (nonnull instancetype)initWithWidth:(int32_t)width
                                   height:(int32_t)height
                              orientation:(BNBRotation)orientation;
    + (nonnull instancetype)fullImageFormatWithWidth:(int32_t)width
                                              height:(int32_t)height
                                         orientation:(BNBRotation)orientation;
    
    @property (nonatomic, readonly) int32_t width;
    
    @property (nonatomic, readonly) int32_t height;
    
    @property (nonatomic, readonly) BNBRotation orientation;
    
    @end

    Swift

    class BNBFullImageFormat : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBImageReleaser : NSObject
    
    /**
     * Increments the reference count by 1 for an interface pointer to a object.
     * MUST be called before release().
     */
    - (void)addRef;
    
    /**
     * Increments the reference count by number for an interface pointer to a object.
     * @param number number of add ref.
     * MUST be called before release().
     */
    - (void)addRefCount:(int32_t)number;
    
    /**
     * Decrements the reference count for an interface on a COM object.
     * After the last ref is deleted, the java image will be closed(released).
     * MUST be called from the deleters of bnb::color_plane.
     */
    - (void)release;
    
    @end

    Swift

    class BNBImageReleaser : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBInformer : NSObject
    
    /** Send event to Banuba Servers with custom key and value */
    + (void)sendEvent:(nullable BNBLicenseManager *)manager
                  key:(nonnull NSString *)key
                value:(nonnull NSString *)value;
    
    @end

    Swift

    class BNBInformer : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBInputManager : NSObject
    
    - (void)onTouchesBegan:(nonnull NSDictionary<NSNumber *, BNBTouch *> *)tocuhes;
    
    - (void)onTouchesMoved:(nonnull NSDictionary<NSNumber *, BNBTouch *> *)tocuhes;
    
    - (void)onTouchesEnded:(nonnull NSDictionary<NSNumber *, BNBTouch *> *)tocuhes;
    
    - (void)onTouchesCancelled:(nonnull NSDictionary<NSNumber *, BNBTouch *> *)tocuhes;
    
    - (void)onRotationGesture:(float)angle;
    
    - (void)onScaleGesture:(float)scale;
    
    - (void)onSwipeGesture:(float)dirX
                      dirY:(float)dirY;
    
    - (void)onDoubleTapGesture:(nonnull BNBTouch *)pos;
    
    - (void)onLongTapGesture:(nonnull BNBTouch *)pos;
    
    - (void)onGestureEnded:(nonnull NSString *)id;
    
    /** @param key Values are listed in https://www.glfw.org/docs/3.3/group__keys.html */
    - (void)onKeyDown:(int32_t)key;
    
    - (void)onKeyUp:(int32_t)key;
    
    @end

    Swift

    class BNBInputManager : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBLicenseManager : NSObject
    
    /** Creates *new* `LicenceManager`. This metod won't change Banuba SDK internal state. */
    + (nullable BNBLicenseManager *)create:(nonnull NSString *)clientToken;
    
    /**
     * Returns the instance used by Banuba SDK to check licence.
     * This istance was created by `UtilityManager.initialize`.
     */
    + (nullable BNBLicenseManager *)instance;
    
    /** Checks if Client Token is expired. */
    - (BNBLicenseStatus)isExpired;
    
    /** Returns decoded content of Client Token */
    - (nonnull NSString *)getJson;
    
    /** Returns hash of Client Token */
    - (nonnull NSString *)getChecksum;
    
    @end

    Swift

    class BNBLicenseManager : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBLipsShineMask : NSObject
    - (nonnull instancetype)initWithMeta:(nonnull BNBTransformedMaskByte *)meta
                                    vMin:(float)vMin
                                    vMax:(float)vMax;
    + (nonnull instancetype)lipsShineMaskWithMeta:(nonnull BNBTransformedMaskByte *)meta
                                             vMin:(float)vMin
                                             vMax:(float)vMax;
    
    /**shine_mask */
    @property (nonatomic, readonly, nonnull) BNBTransformedMaskByte * meta;
    
    /**blending coeffcient */
    @property (nonatomic, readonly) float vMin;
    
    @property (nonatomic, readonly) float vMax;
    
    @end

    Swift

    class BNBLipsShineMask : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBPixelBuffer : NSObject
    - (nonnull instancetype)initWithData:(nonnull NSData *)data
                                  format:(BNBPixelFormat)format
                                   width:(int32_t)width
                                  heigth:(int32_t)heigth;
    + (nonnull instancetype)pixelBufferWithData:(nonnull NSData *)data
                                         format:(BNBPixelFormat)format
                                          width:(int32_t)width
                                         heigth:(int32_t)heigth;
    
    @property (nonatomic, readonly, nonnull) NSData * data;
    
    @property (nonatomic, readonly) BNBPixelFormat format;
    
    @property (nonatomic, readonly) int32_t width;
    
    @property (nonatomic, readonly) int32_t heigth;
    
    @end

    Swift

    class BNBPixelBuffer : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBPixelRect : NSObject
    - (nonnull instancetype)initWithX:(int32_t)x
                                    y:(int32_t)y
                                    w:(int32_t)w
                                    h:(int32_t)h;
    + (nonnull instancetype)pixelRectWithX:(int32_t)x
                                         y:(int32_t)y
                                         w:(int32_t)w
                                         h:(int32_t)h;
    
    @property (nonatomic, readonly) int32_t x;
    
    @property (nonatomic, readonly) int32_t y;
    
    @property (nonatomic, readonly) int32_t w;
    
    @property (nonatomic, readonly) int32_t h;
    
    @end

    Swift

    class BNBPixelRect : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBPoint2d : NSObject
    - (nonnull instancetype)initWithX:(float)x
                                    y:(float)y;
    + (nonnull instancetype)point2dWithX:(float)x
                                       y:(float)y;
    
    @property (nonatomic, readonly) float x;
    
    @property (nonatomic, readonly) float y;
    
    @end

    Swift

    class BNBPoint2d : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBProcessorConfiguration : NSObject
    
    /** Create with default params */
    + (nullable BNBProcessorConfiguration *)create;
    
    /**
     * Use future frame to filter prediction, improves anti-jitter, adds processed frame inconsistency
     * Example: push frame 1 - pop frame 1, push frame 2 - pop frame 1, push frame 3 - pop frame 2, ...
     * Cannot be used together with other configurations
     * Default: true
     */
    - (void)setUseFutureFilter:(BOOL)value;
    
    /**
     * Use future frame to interpolate prediction, improves performance, adds processed frame inconsistency
     * Example: push frame 1 - pop frame 1, push frame 2 - pop frame 1, push frame 3 - pop frame 2, ...
     * Cannot be used together with other configurations
     * Default: false
     */
    - (void)setUseFutureInterpolate:(BOOL)value;
    
    /**
     * Use offline NN's for processing, improces accuracy in exchange to performance
     * Cannot be used together with other configurations
     * Default: false
     */
    - (void)setUseOfflineMode:(BOOL)value;
    
    @end

    Swift

    class BNBProcessorConfiguration : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBProcessorResult : NSObject
    - (nonnull instancetype)initWithStatus:(BNBProcessorStatus)status
                                 frameData:(nullable BNBFrameData *)frameData;
    + (nonnull instancetype)processorResultWithStatus:(BNBProcessorStatus)status
                                            frameData:(nullable BNBFrameData *)frameData;
    
    @property (nonatomic, readonly) BNBProcessorStatus status;
    
    @property (nonatomic, readonly, nullable) BNBFrameData * frameData;
    
    @end

    Swift

    class BNBProcessorResult : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBRecognizer : NSObject
    
    + (nullable BNBRecognizer *)create:(BNBRecognizerMode)mode;
    
    + (int64_t)getFeatureId:(BNBFeatureId)feature;
    
    - (nullable id<BNBFeature>)getFeature:(BNBFeatureId)feature;
    
    - (void)setFeatures:(nonnull NSSet<NSNumber *> *)features;
    
    - (void)addFeature:(nullable id<BNBFeature>)feature
          dependencies:(nonnull NSSet<NSNumber *> *)dependencies;
    
    - (void)removeFeature:(nullable id<BNBFeature>)feature;
    
    /** sets maximum allowed face results, if face tracking feature is present */
    - (void)setMaxFaces:(int32_t)num;
    
    - (void)setOfflineMode:(BOOL)on;
    
    /**
     * Set future frame filtrarion mode.
     * Produce smoother recognition result (anti jitter), however adds inconsistency in push'ed/pop'ed frames (one frame lag)
     * Applied only in push_camera_frame/pop_frame_data methods, when offline mode is disabled.
     * Example: push frame 1 - pop frame 1, push frame 2 - pop frame 1, push frame 3 - pop frame 2, ...
     */
    - (void)setUseFutureFilter:(BOOL)on;
    
    /**
     * Set future frame interpolation mode.
     * Produce faster recognition result (skip even frames), however adds inconsistency in push'ed/pop'ed frames (one frame lag)
     * Applied only in push_camera_frame/pop_frame_data methods, when offline mode is disabled.
     * Example: push frame 1 - pop frame 1, push frame 2 - pop frame 1, push frame 3 - pop frame 2, ...
     */
    - (void)setUseFutureInterpolate:(BOOL)on;
    
    - (void)process:(nullable BNBFrameData *)frameData;
    
    - (void)pushCameraFrame:(nullable BNBFrameData *)inputFrameData;
    
    - (BOOL)popFrameData:(nullable BNBFrameData *)outputFrameData;
    
    /** start the recognizer */
    - (void)start;
    
    /** pause the recognizer */
    - (void)pause;
    
    /** pause + clear */
    - (void)stop;
    
    /** clear input and output buffers and pipeline state, also clean cached features */
    - (void)clear;
    
    @end

    Swift

    class BNBRecognizer : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBReloadResult : NSObject
    
    /**
     * Effect with updated config applied. Depending on
     * changes it may be the effect already loaded or a new one.
     */
    - (nullable BNBEffect *)effect;
    
    /**
     * In case it was possible to apply the new config on the same 
     * effect, this flag will be `true`.
     */
    - (BOOL)hotReload;
    
    @end

    Swift

    class BNBReloadResult : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBRendererCommon : NSObject
    
    /** return rgba image, srcImage can be rgb or rgba */
    + (nonnull BNBFullImageData *)morphMesh:(nonnull BNBFullImageData *)srcImage
                              originalVerts:(nonnull NSArray<NSNumber *> *)originalVerts
                               morphedVerts:(nonnull NSArray<NSNumber *> *)morphedVerts
                                    indices:(nonnull NSArray<NSNumber *> *)indices
                                        mvp:(nonnull NSArray<NSNumber *> *)mvp;
    
    /** return rgba image, srcImage can be rgb or rgba */
    + (nonnull BNBBnbMorphResult *)morphMeshLandmarks:(nonnull BNBFullImageData *)srcImage
                                         srcLandmarks:(nonnull NSArray<NSNumber *> *)srcLandmarks
                                        originalVerts:(nonnull NSArray<NSNumber *> *)originalVerts
                                         morphedVerts:(nonnull NSArray<NSNumber *> *)morphedVerts
                                              indices:(nonnull NSArray<NSNumber *> *)indices
                                                  mvp:(nonnull NSArray<NSNumber *> *)mvp;
    
    @end

    Swift

    class BNBRendererCommon : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBSize : NSObject
    - (nonnull instancetype)initWithWidth:(int32_t)width
                                   height:(int32_t)height;
    + (nonnull instancetype)sizeWithWidth:(int32_t)width
                                   height:(int32_t)height;
    
    @property (nonatomic, readonly) int32_t width;
    
    @property (nonatomic, readonly) int32_t height;
    
    @end

    Swift

    class BNBSize : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBSurfaceData : NSObject
    - (nonnull instancetype)initWithGpuDevicePtr:(int64_t)gpuDevicePtr
                                 commandQueuePtr:(int64_t)commandQueuePtr
                                      surfacePtr:(int64_t)surfacePtr;
    + (nonnull instancetype)surfaceDataWithGpuDevicePtr:(int64_t)gpuDevicePtr
                                        commandQueuePtr:(int64_t)commandQueuePtr
                                             surfacePtr:(int64_t)surfacePtr;
    
    /** Pointer to device gpu */
    @property (nonatomic, readonly) int64_t gpuDevicePtr;
    
    /** Pointer to gpu command queue */
    @property (nonatomic, readonly) int64_t commandQueuePtr;
    
    /** Pointer to render layer */
    @property (nonatomic, readonly) int64_t surfacePtr;
    
    @end

    Swift

    class BNBSurfaceData : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBTouch : NSObject
    - (nonnull instancetype)initWithX:(float)x
                                    y:(float)y
                                   id:(int64_t)id;
    + (nonnull instancetype)touchWithX:(float)x
                                     y:(float)y
                                    id:(int64_t)id;
    
    @property (nonatomic, readonly) float x;
    
    @property (nonatomic, readonly) float y;
    
    @property (nonatomic, readonly) int64_t id;
    
    @end

    Swift

    class BNBTouch : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBTransformableEvent : NSObject
    - (nonnull instancetype)initWithBasisTransform:(nonnull NSArray<NSNumber *> *)basisTransform
                                           fullRoi:(nonnull BNBPixelRect *)fullRoi;
    + (nonnull instancetype)transformableEventWithBasisTransform:(nonnull NSArray<NSNumber *> *)basisTransform
                                                         fullRoi:(nonnull BNBPixelRect *)fullRoi;
    
    /** (common -> some event data basis) transformation */
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * basisTransform;
    
    /** rectangle area in common basis that encloses all valid & usable data */
    @property (nonatomic, readonly, nonnull) BNBPixelRect * fullRoi;
    
    @end

    Swift

    class BNBTransformableEvent : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBTransformation : NSObject
    
    /** Constructs identity transform */
    + (nullable BNBTransformation *)makeIdentity;
    
    /** Constructs from mat_t */
    + (nullable BNBTransformation *)makeData:(nonnull NSArray<NSNumber *> *)mat;
    
    /** Constructs rotate transformation */
    + (nullable BNBTransformation *)makeRot:(BNBRotation)rot;
    
    /** Constructs affine transformation */
    + (nullable BNBTransformation *)makeAffine:(float)scaleX
                                        scaleY:(float)scaleY
                                            tX:(float)tX
                                            tY:(float)tY
                                           rot:(BNBRotation)rot
                                         flipX:(BOOL)flipX
                                         flipY:(BOOL)flipY;
    
    /**
     * Constructs transformation from source to target rectangle
     * Rotation and flips are around rectangles' center
     */
    + (nullable BNBTransformation *)makeRects:(nonnull BNBPixelRect *)sourceRect
                                   targetRect:(nonnull BNBPixelRect *)targetRect
                                          rot:(BNBRotation)rot
                                        flipX:(BOOL)flipX
                                        flipY:(BOOL)flipY;
    
    /**
     * Applies transform t after this
     * e.g. {rotate >> translate;} rotates first: (initial -> rotated) >> (rotated -> translated) = (initial -> translated)
     */
    - (nullable BNBTransformation *)chainRight:(nullable BNBTransformation *)t;
    
    /** Apply transform to point */
    - (nonnull BNBPoint2d *)transformPoint:(nonnull BNBPoint2d *)p;
    
    - (nonnull BNBPixelRect *)transformRect:(nonnull BNBPixelRect *)rect;
    
    - (BOOL)equals:(nullable BNBTransformation *)t;
    
    /**
     * Get the inverse of the transformation
     * @throw std::logic_error when matrix is singular
     */
    - (nullable BNBTransformation *)inverseJ;
    
    /** Clone the transformation */
    - (nullable BNBTransformation *)cloneJ;
    
    /** Returns 3x3 row-maj transform matrix */
    - (nonnull NSArray<NSNumber *> *)getMatJ;
    
    @end

    Swift

    class BNBTransformation : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBTransformedMask : NSObject
    - (nonnull instancetype)initWithWidth:(int32_t)width
                                   height:(int32_t)height
                                  channel:(int32_t)channel
                                  inverse:(BOOL)inverse
                           basisTransform:(nonnull NSArray<NSNumber *> *)basisTransform;
    + (nonnull instancetype)transformedMaskWithWidth:(int32_t)width
                                              height:(int32_t)height
                                             channel:(int32_t)channel
                                             inverse:(BOOL)inverse
                                      basisTransform:(nonnull NSArray<NSNumber *> *)basisTransform;
    
    @property (nonatomic, readonly) int32_t width;
    
    @property (nonatomic, readonly) int32_t height;
    
    @property (nonatomic, readonly) int32_t channel;
    
    @property (nonatomic, readonly) BOOL inverse;
    
    /** (common -> mask) transformation */
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * basisTransform;
    
    @end

    Swift

    class BNBTransformedMask : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBTransformedMaskByte : NSObject
    - (nonnull instancetype)initWithMeta:(nonnull BNBTransformedMask *)meta
                                    mask:(nonnull NSArray<NSNumber *> *)mask;
    + (nonnull instancetype)transformedMaskByteWithMeta:(nonnull BNBTransformedMask *)meta
                                                   mask:(nonnull NSArray<NSNumber *> *)mask;
    
    @property (nonatomic, readonly, nonnull) BNBTransformedMask * meta;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * mask;
    
    @end

    Swift

    class BNBTransformedMaskByte : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBTransformedMaskFloat : NSObject
    - (nonnull instancetype)initWithMeta:(nonnull BNBTransformedMask *)meta
                                    mask:(nonnull NSArray<NSNumber *> *)mask;
    + (nonnull instancetype)transformedMaskFloatWithMeta:(nonnull BNBTransformedMask *)meta
                                                    mask:(nonnull NSArray<NSNumber *> *)mask;
    
    @property (nonatomic, readonly, nonnull) BNBTransformedMask * meta;
    
    @property (nonatomic, readonly, nonnull) NSArray<NSNumber *> * mask;
    
    @end

    Swift

    class BNBTransformedMaskFloat : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBTransformedMaskGpu : NSObject
    - (nonnull instancetype)initWithMeta:(nonnull BNBTransformedMask *)meta
                                    mask:(int32_t)mask;
    + (nonnull instancetype)transformedMaskGpuWithMeta:(nonnull BNBTransformedMask *)meta
                                                  mask:(int32_t)mask;
    
    @property (nonatomic, readonly, nonnull) BNBTransformedMask * meta;
    
    @property (nonatomic, readonly) int32_t mask;
    
    @end

    Swift

    class BNBTransformedMaskGpu : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBUtilityManager : NSObject
    
    + (void)initialize:(nonnull NSArray<NSString *> *)resourcePaths
           clientToken:(nonnull NSString *)clientToken;
    
    + (void)release;
    
    /** Add resources search path */
    + (void)addResourcePath:(nonnull NSString *)resourcePath;
    
    /** Remove resources search path */
    + (void)removeResourcePath:(nonnull NSString *)resourcePath;
    
    /** Diagnostic crash. Use this to check you crash analytics systems. */
    + (void)diagnosticCrash;
    
    /**
     * Get information about CPU capabilities. Mainly for usage on Android
     * @return JSON-string describing CPU capabilties
     */
    + (nonnull NSString *)cpuEnv;
    
    /**
     * Check device SoC class.
     * On Android first call may require presence of OpenGL context to 
     * get info about GPU. 
     * @return hardware class of device
     */
    + (BNBHardwareClass)getHardwareClass;
    
    + (void)setLogLevel:(BNBSeverityLevel)level;
    
    /**
     * Turns on SDK feature - analytics collection
     * @param outputFolder here log files would be written
     * could be documents directory for mobile apps
     */
    + (void)enableDiagnostics:(nonnull NSString *)outputFolder;
    
    /** Turns on SDK feature - telemetry collection */
    + (void)enableTelemetry;
    
    /**
     * Set callback to recieve log events from Banuba SDK.
     * @param cb Callback
     * @param lvl recieve logs with specified and higher levels
     */
    + (void)setLogRecordCallback:(nullable id<BNBLogRecordCallback>)cb
                             lvl:(BNBSeverityLevel)lvl;
    
    /** Returns SDK version as string */
    + (nonnull NSString *)getBanubaSdkVersionString;
    
    /**
     * Returns SDK version as number
     * major = version / 10000000
     * minor = (version - major * 10000000) / 100000
     * patch = (version - major * 10000000 - minor * 100000) / 1000
     * revision = version % 1000
     */
    + (int32_t)getBanubaSdkVersion;
    
    /**
     * The Banuba SDK tracks the resource version it built for.
     * Returns version of resources as string, represented in the following format
     * “Major.Minor.Patch”.
     */
    + (nonnull NSString *)getBanubaSdkResourcesVersionString;
    
    /**
     * Returns version as number
     * major = version / 10000000
     * minor = (version - major * 10000000) / 100000
     * patch = (version - major * 10000000 - minor * 100000) / 1000
     * revision = version % 1000
     */
    + (int32_t)getBanubaSdkResourcesVersion;
    
    /**
     * The Banuba SDK supports external resources archives.
     * After the initialization of the Banuba SDK,
     * API provides the capability to request the version of the archive.
     * Returns version of resources archive as string,
     * represented in the following format “Major.Minor.Patch”.
     * Such a version coincides with the Banuba SDK resources version
     * if no external resources are used.
     */
    + (nonnull NSString *)getBanubaSdkResourcesVersionArchiveString;
    
    /**
     * Checks if the current version of resources
     * is equal to Banuba SDK expected resources version
     */
    + (BOOL)checkBanubaSdkResourcesVersion;
    
    /** Checks if Banuba SDK treats as valid the version of external resources */
    + (BOOL)checkBanubaSdkResourcesVersionIgnorePatch;
    
    /**
     * load GL functions, for dynamic libraries only
     * should be called with active GL context
     */
    + (void)loadGlFunctions;
    
    @end

    Swift

    class BNBUtilityManager : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBVisualClip : NSObject
    
    /**
     * Create instance of visual clip processor
     * @param musicDbPath absolute path to folder with music info
     * @param effectsTemplatesPath absolute path to folder with effects templates
     * @param listener callback
     */
    + (nullable BNBVisualClip *)create:(nonnull NSString *)musicDbPath
                  effectsTemplatesPath:(nonnull NSString *)effectsTemplatesPath
                              listener:(nullable id<BNBVisualClipListener>)listener;
    
    /**
     * Process video and get recomendations
     * @param videos array of videos to process
     * @param numFrames number of frames in video to process
     * @param resultSize number of recomendations in result array
     * @return array of recomendations, each is json, sorted by relevance
     */
    - (nonnull NSArray<NSString *> *)process:(nonnull NSArray<BNBVisualClipVideo *> *)videos
                                   numFrames:(int32_t)numFrames
                                  resultSize:(int32_t)resultSize;
    
    @end

    Swift

    class BNBVisualClip : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface BNBVisualClipVideo : NSObject
    - (nonnull instancetype)initWithPath:(nonnull NSString *)path
                           startPosition:(float)startPosition
                                duration:(float)duration;
    + (nonnull instancetype)visualClipVideoWithPath:(nonnull NSString *)path
                                      startPosition:(float)startPosition
                                           duration:(float)duration;
    
    /** absolute path to video */
    @property (nonatomic, readonly, nonnull) NSString * path;
    
    /** start position in seconds */
    @property (nonatomic, readonly) float startPosition;
    
    /** duration in seconds */
    @property (nonatomic, readonly) float duration;
    
    @end

    Swift

    class BNBVisualClipVideo : NSObject
  • Container for image data designed for Banuba SDK.

    See more

    Declaration

    Objective-C

    
    @interface BNBFullImageData : NSObject

    Swift

    class BNBFullImageData : NSObject
  • Various helper method to improve Obj-C – Swift interoperability.

    See more

    Declaration

    Objective-C

    
    @interface BNBObjC : NSObject

    Swift

    class BNBObjC : NSObject
  • Deprecated

    Use the Player API instead

    All methods must be called from the same thread (in which the object was created BNBOffscreenEffectPlayer) All methods are synchronous

    WARNING: the SDK should be initialized with BNBUtilityManager before BNBOfscreenEffectPlayer creation

    See more

    Declaration

    Objective-C

    
    @interface BNBOffscreenEffectPlayer : NSObject

    Swift

    class BNBOffscreenEffectPlayer : NSObject