Package com.banuba.sdk.effect_player
Class EffectPlayer.CppProxy
java.lang.Object
com.banuba.sdk.effect_player.EffectPlayer.CppProxy
- All Implemented Interfaces:
EffectPlayer
- Enclosing interface:
- EffectPlayer
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.banuba.sdk.effect_player.EffectPlayer
EffectPlayer.CppProxy -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddCameraPoiListener(CameraPoiListener cameraPoiListener) Add callback to receive center of the face in frame relative to top-left corner in [0, 1] space.voidaddEffectActivationCompletionListener(EffectActivationCompletionListener effectActivationCompletionListener) Add callback to receive current effect activation notification from Effect Player.voidaddEffectInfoListener(EffectInfoListener effectInfoListener) Add callback to receive current effect info from Effect Player.voidaddFaceNumberListener(FaceNumberListener faceNumberListener) Add callback to receive faces count in frame.voidaddFrameDataListener(FrameDataListener frameDataListener) Add callback to receive frame data right after processing in recognizer.voidaddFrameDurationListener(FrameDurationListener frameDurationListener) Add callback to receive FPS information.voidcaptureBlit(int captureWidth, int captureHeight) Record last rendering ("draw_()") result into current OpenGL framebuffer.static EffectPlayercreate(EffectPlayerConfiguration configuration) longdraw()Draw the current effect into the current OpenGL framebuffer.drawVideoFrame(FrameData inputFrameData, long timeNs, PixelFormat outputPixelFormat) Draw processed frame to image buffer.drawVideoFrameAllocated(FrameData inputFrameData, long timeNs, PixelFormat outputPixelFormat, Data allocatedBuffer) The same as *draw_video_frame* but accepts preallocated buffer to avoid recreation for every frame.longdrawWithExternalFrameData(FrameData frameData) Draw the current effect into the current OpenGL framebuffer.Get effect manager object Thread-safe.protected voidfinalize()Get current frame processor Thread-safe.static RenderBackendTypeGet interface to control user iterations.Thread-safe.voidTriggers record stop events in EP and Effect.voidonVideoRecordStart(boolean playAudioWhileRecording) Trigger record start events in EP and Effect.voidvoidMUST be called from the main(render) threadvoidprocessImage(FullImageData inputImage, PixelFormat outputPixelFormat) Process an image with current effect.byte[]processImageData(byte[] inputImage, int width, int height, CameraOrientation orientation, boolean isMirrored, PixelFormat inputPixelFormat, PixelFormat outputPixelFormat) Process image with current effect.processImageFrameData(FrameData inputFrameData, PixelFormat outputPixelFormat) Process an image with current effect.processVideoFrame(FullImageData inputImage, Integer recognizerIterations) Provide frame to evaluate video processing.processVideoFrameData(FrameData inputFrameData, Integer recognizerIterations) Provide frame data to evaluate video processing.voidpushFrame(FullImageData fullImage) Provides image to process and to play effect.voidpushFrameData(FrameData frameData) Provides FrameData to process and to play effect.voidpushFrameDataWithNumber(FrameData frameData, long frameNumber) Provides FrameData with frame number to process and to play effect.voidpushFrameWithNumber(FullImageData fullImage, long frameNumber) Provides image to process and to play effect.Receive the last rendered frame in binary form.voidremoveCameraPoiListener(CameraPoiListener cameraPoiListener) Remove callback to receive center of the face in frame relative to top-left Thread-safe.voidremoveEffectActivationCompletionListener(EffectActivationCompletionListener effectActivationCompletionListener) Remove callback to receive current effect activation notification from Effect Player.voidremoveEffectInfoListener(EffectInfoListener effectInfoListener) Remove callback to receive current effect info from Effect Player.voidremoveFaceNumberListener(FaceNumberListener faceNumberListener) Remove callback to receive faces count in frame.voidremoveFrameDataListener(FrameDataListener frameDataListener) Remove callback to receive frame data right after processing in recognizer.voidremoveFrameDurationListener(FrameDurationListener frameDurationListener) Remove callback to receive FPS information.voidsetExternalCameraTexture(int name, int width, int height) Set OpenGL name of input external texture.voidsetFrameProcessor(FrameProcessor processor) Set frame processor as current Thread-safe.voidsetMaxFaces(int maxFaces) Sets maximum allowed face results, if face tracking feature is present.voidsetRecognizerOfflineMode(boolean on) Force recognizer offline mode Thread-safe.voidsetRecognizerUseFutureFilter(boolean on) Set future frame filtrarion mode.voidsetRecognizerUseFutureInterpolate(boolean on) Set future frame interpolation mode.voidsetRecognizerUseNewFaceTracking(boolean on) Set new face tracking mode.static voidsetRenderBackend(RenderBackendType backendType) voidThread-safe.voidsetUseExtCamTex(boolean value) Use external texture as input source.voidstartVideoProcessing(long screenWidth, long screenHeight, CameraOrientation orientation, boolean resetEffect, boolean offlineMode) Initialize video processing.voidstopVideoProcessing(boolean resetEffect) Finish processing and return renderer to normal state.voidsurfaceChanged(int width, int height) Notify about rendering surface being resized.voidsurfaceCreated(int width, int height) Use to notify the EffectPlayer that the surface exists and effect can be played. 0, 0 for width and height are valid values.voidThis method should be called right before an active context will become invalid.voidwriteRecordedAudio(String filename, long lengthMs) Save recorded audio.
-
Method Details
-
_djinni_private_destroy
public void _djinni_private_destroy() -
finalize
-
addFrameDurationListener
Description copied from interface:EffectPlayerAdd callback to receive FPS information. Thread-safe. May be called from any thread- Specified by:
addFrameDurationListenerin interfaceEffectPlayer
-
removeFrameDurationListener
Description copied from interface:EffectPlayerRemove callback to receive FPS information. Thread-safe. May be called from any thread- Specified by:
removeFrameDurationListenerin interfaceEffectPlayer
-
addFaceNumberListener
Description copied from interface:EffectPlayerAdd callback to receive faces count in frame. Thread-safe. May be called from any thread- Specified by:
addFaceNumberListenerin interfaceEffectPlayer
-
removeFaceNumberListener
Description copied from interface:EffectPlayerRemove callback to receive faces count in frame. Thread-safe. May be called from any thread- Specified by:
removeFaceNumberListenerin interfaceEffectPlayer
-
addFrameDataListener
Description copied from interface:EffectPlayerAdd callback to receive frame data right after processing in recognizer. Thread-safe. May be called from any thread- Specified by:
addFrameDataListenerin interfaceEffectPlayer
-
removeFrameDataListener
Description copied from interface:EffectPlayerRemove callback to receive frame data right after processing in recognizer. Thread-safe. May be called from any thread- Specified by:
removeFrameDataListenerin interfaceEffectPlayer
-
addCameraPoiListener
Description copied from interface:EffectPlayerAdd 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- Specified by:
addCameraPoiListenerin interfaceEffectPlayer
-
removeCameraPoiListener
Description copied from interface:EffectPlayerRemove callback to receive center of the face in frame relative to top-left Thread-safe. May be called from any thread- Specified by:
removeCameraPoiListenerin interfaceEffectPlayer
-
addEffectInfoListener
Description copied from interface:EffectPlayerAdd callback to receive current effect info from Effect Player. Thread-safe. May be called from any thread- Specified by:
addEffectInfoListenerin interfaceEffectPlayer
-
removeEffectInfoListener
Description copied from interface:EffectPlayerRemove callback to receive current effect info from Effect Player. Thread-safe. May be called from any thread- Specified by:
removeEffectInfoListenerin interfaceEffectPlayer
-
addEffectActivationCompletionListener
public void addEffectActivationCompletionListener(EffectActivationCompletionListener effectActivationCompletionListener) Description copied from interface:EffectPlayerAdd callback to receive current effect activation notification from Effect Player. Thread-safe. May be called from any thread- Specified by:
addEffectActivationCompletionListenerin interfaceEffectPlayer
-
removeEffectActivationCompletionListener
public void removeEffectActivationCompletionListener(EffectActivationCompletionListener effectActivationCompletionListener) Description copied from interface:EffectPlayerRemove callback to receive current effect activation notification from Effect Player. Thread-safe. May be called from any thread- Specified by:
removeEffectActivationCompletionListenerin interfaceEffectPlayer
-
setMaxFaces
public void setMaxFaces(int maxFaces) Description copied from interface:EffectPlayerSets 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.- Specified by:
setMaxFacesin interfaceEffectPlayer
-
setExternalCameraTexture
public void setExternalCameraTexture(int name, int width, int height) Description copied from interface:EffectPlayerSet OpenGL name of input external texture. https://developer.android.com/reference/android/graphics/SurfaceTexture . MUST be called from the render thread- Specified by:
setExternalCameraTexturein interfaceEffectPlayer- Parameters:
name- Texture namewidth- Textute widthheight- Texture height- See Also:
-
setUseExtCamTex
public void setUseExtCamTex(boolean value) Description copied from interface:EffectPlayerUse external texture as input source. MUST be called from the render thread- Specified by:
setUseExtCamTexin interfaceEffectPlayer- See Also:
-
surfaceCreated
public void surfaceCreated(int width, int height) Description copied from interface:EffectPlayerUse 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- Specified by:
surfaceCreatedin interfaceEffectPlayer
-
surfaceChanged
public void surfaceChanged(int width, int height) Description copied from interface:EffectPlayerNotify about rendering surface being resized. MUST be called from the render thread- Specified by:
surfaceChangedin interfaceEffectPlayer
-
surfaceDestroyed
public void surfaceDestroyed()Description copied from interface:EffectPlayerThis 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- Specified by:
surfaceDestroyedin interfaceEffectPlayer
-
draw
public long draw()Description copied from interface:EffectPlayerDraw 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- Specified by:
drawin interfaceEffectPlayer
-
drawWithExternalFrameData
Description copied from interface:EffectPlayerDraw 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- Specified by:
drawWithExternalFrameDatain interfaceEffectPlayer
-
captureBlit
public void captureBlit(int captureWidth, int captureHeight) Description copied from interface:EffectPlayerRecord last rendering ("draw_()") result into current OpenGL framebuffer. Content is cropped to maintain effect_size() aspect ratio MUST be called from the render thread- Specified by:
captureBlitin interfaceEffectPlayer
-
readPixels
Description copied from interface:EffectPlayerReceive the last rendered frame in binary form.- Specified by:
readPixelsin interfaceEffectPlayer- Returns:
- 4-byte per pixel data, size is `fx_width * fx_height * 4` MUST be called from the render thread
-
setRenderConsistencyMode
Description copied from interface:EffectPlayerThread-safe. May be called from any thread- Specified by:
setRenderConsistencyModein interfaceEffectPlayer
-
processImage
Description copied from interface:EffectPlayerProcess an image with current effect. Must be called from the render thread.- Specified by:
processImagein interfaceEffectPlayer- Parameters:
inputImage- to avoid conversion recommended to use YUV imageoutputPixelFormat- to avoid conversion recommended to use RGBA
-
processImageFrameData
Description copied from interface:EffectPlayerProcess 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.- Specified by:
processImageFrameDatain interfaceEffectPlayer- Parameters:
inputFrameData- `FrameData` with an imageoutputPixelFormat- to avoid conversion recommended to use RGBA
-
processImageData
public byte[] processImageData(byte[] inputImage, int width, int height, CameraOrientation orientation, boolean isMirrored, PixelFormat inputPixelFormat, PixelFormat outputPixelFormat) Description copied from interface:EffectPlayerProcess 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- Specified by:
processImageDatain interfaceEffectPlayer- Parameters:
inputImage- input image with `width * height * 4` sizeoutputPixelFormat- to avoid conversion recommended to use RGBA
-
pushFrame
Description copied from interface:EffectPlayerProvides image to process and to play effect. Thread-safe. May be called from any thread- Specified by:
pushFramein interfaceEffectPlayer
-
pushFrameWithNumber
Description copied from interface:EffectPlayerProvides image to process and to play effect. Thread-safe. May be called from any thread- Specified by:
pushFrameWithNumberin interfaceEffectPlayer
-
pushFrameData
Description copied from interface:EffectPlayerProvides FrameData to process and to play effect. Must contain full image. Thread-safe. May be called from any thread- Specified by:
pushFrameDatain interfaceEffectPlayer
-
pushFrameDataWithNumber
Description copied from interface:EffectPlayerProvides FrameData with frame number to process and to play effect. Must contain full image. Thread-safe. May be called from any thread- Specified by:
pushFrameDataWithNumberin interfaceEffectPlayer
-
playbackPlay
public void playbackPlay()Description copied from interface:EffectPlayerMUST be called from the main(render) thread- Specified by:
playbackPlayin interfaceEffectPlayer
-
playbackPause
public void playbackPause()- Specified by:
playbackPausein interfaceEffectPlayer
-
playbackStop
public void playbackStop()- Specified by:
playbackStopin interfaceEffectPlayer
-
getPlaybackState
Description copied from interface:EffectPlayerThread-safe. May be called from any thread- Specified by:
getPlaybackStatein interfaceEffectPlayer
-
getInputManager
Description copied from interface:EffectPlayerGet interface to control user iterations. This events will be passed to effect. Thread-safe. May be called from any thread- Specified by:
getInputManagerin interfaceEffectPlayer
-
startVideoProcessing
public void startVideoProcessing(long screenWidth, long screenHeight, CameraOrientation orientation, boolean resetEffect, boolean offlineMode) Description copied from interface:EffectPlayerInitialize 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- Specified by:
startVideoProcessingin interfaceEffectPlayer
-
stopVideoProcessing
public void stopVideoProcessing(boolean resetEffect) Description copied from interface:EffectPlayerFinish processing and return renderer to normal state. MUST be called from the render thread- Specified by:
stopVideoProcessingin interfaceEffectPlayer
-
processVideoFrameData
Description copied from interface:EffectPlayerProvide frame data to evaluate video processing. MUST be called from the render thread- Specified by:
processVideoFrameDatain interfaceEffectPlayer- Parameters:
inputFrameData- Frame Data to process.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.- Returns:
- Frame data with frame processing results.
-
processVideoFrame
Description copied from interface:EffectPlayerProvide frame to evaluate video processing. MUST be called from the render thread- Specified by:
processVideoFramein interfaceEffectPlayer- Parameters:
inputImage- Image to process.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.- Returns:
- Frame data with frame processing results.
-
drawVideoFrame
Description copied from interface:EffectPlayerDraw processed frame to image buffer. MUST be called from the render thread- Specified by:
drawVideoFramein interfaceEffectPlayer- Parameters:
inputFrameData- FrameData to draw.timeNs- Frame position on timeline.outputPixelFormat- Output image format.- Returns:
- Buffer with processed image in selected format.
-
drawVideoFrameAllocated
public Data drawVideoFrameAllocated(FrameData inputFrameData, long timeNs, PixelFormat outputPixelFormat, Data allocatedBuffer) Description copied from interface:EffectPlayerThe same as *draw_video_frame* but accepts preallocated buffer to avoid recreation for every frame. MUST be called from the render thread- Specified by:
drawVideoFrameAllocatedin interfaceEffectPlayer
-
writeRecordedAudio
Description copied from interface:EffectPlayerSave recorded audio. Not thread-safe but can be called from any thread.- Specified by:
writeRecordedAudioin interfaceEffectPlayer- Parameters:
filename- ".wav" extension must be used.lengthMs- Track length. Set to '0' to use full duration.
-
onVideoRecordStart
public void onVideoRecordStart(boolean playAudioWhileRecording) Description copied from interface:EffectPlayerTrigger 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- Specified by:
onVideoRecordStartin interfaceEffectPlayer
-
onVideoRecordEnd
public void onVideoRecordEnd()Description copied from interface:EffectPlayerTriggers record stop events in EP and Effect. Thread-safe. May be called from any thread- Specified by:
onVideoRecordEndin interfaceEffectPlayer
-
effectManager
Description copied from interface:EffectPlayerGet effect manager object Thread-safe. May be called from any thread- Specified by:
effectManagerin interfaceEffectPlayer
-
setRecognizerOfflineMode
public void setRecognizerOfflineMode(boolean on) Description copied from interface:EffectPlayerForce recognizer offline mode Thread-safe. May be called from any thread- Specified by:
setRecognizerOfflineModein interfaceEffectPlayer
-
setRecognizerUseFutureFilter
public void setRecognizerUseFutureFilter(boolean on) Description copied from interface:EffectPlayerSet 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, ...- Specified by:
setRecognizerUseFutureFilterin interfaceEffectPlayer
-
setRecognizerUseFutureInterpolate
public void setRecognizerUseFutureInterpolate(boolean on) Description copied from interface:EffectPlayerSet 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, ...- Specified by:
setRecognizerUseFutureInterpolatein interfaceEffectPlayer
-
setRecognizerUseNewFaceTracking
public void setRecognizerUseNewFaceTracking(boolean on) Description copied from interface:EffectPlayerSet new face tracking mode.- Specified by:
setRecognizerUseNewFaceTrackingin interfaceEffectPlayer
-
setFrameProcessor
Description copied from interface:EffectPlayerSet frame processor as current Thread-safe. May be called from any thread- Specified by:
setFrameProcessorin interfaceEffectPlayer
-
frameProcessor
Description copied from interface:EffectPlayerGet current frame processor Thread-safe. May be called from any thread- Specified by:
frameProcessorin interfaceEffectPlayer
-
create
-
setRenderBackend
-
getCurrentRenderBackendType
-