Class EffectPlayer.CppProxy

java.lang.Object
com.banuba.sdk.effect_player.EffectPlayer.CppProxy
All Implemented Interfaces:
EffectPlayer
Enclosing interface:
EffectPlayer

public static final class EffectPlayer.CppProxy
extends java.lang.Object
implements EffectPlayer
  • Method Details

    • _djinni_private_destroy

      public void _djinni_private_destroy()
    • finalize

      protected void finalize() throws java.lang.Throwable
      Overrides:
      finalize in class java.lang.Object
      Throws:
      java.lang.Throwable
    • addFrameDurationListener

      public void addFrameDurationListener​(FrameDurationListener frameDurationListener)
      Description copied from interface: EffectPlayer
      Add callback to receive FPS information. Thread-safe. May be called from any thread
      Specified by:
      addFrameDurationListener in interface EffectPlayer
    • removeFrameDurationListener

      public void removeFrameDurationListener​(FrameDurationListener frameDurationListener)
      Description copied from interface: EffectPlayer
      Remove callback to receive FPS information. Thread-safe. May be called from any thread
      Specified by:
      removeFrameDurationListener in interface EffectPlayer
    • addFaceNumberListener

      public void addFaceNumberListener​(FaceNumberListener faceNumberListener)
      Description copied from interface: EffectPlayer
      Add callback to receive faces count in frame. Thread-safe. May be called from any thread
      Specified by:
      addFaceNumberListener in interface EffectPlayer
    • removeFaceNumberListener

      public void removeFaceNumberListener​(FaceNumberListener faceNumberListener)
      Description copied from interface: EffectPlayer
      Remove callback to receive faces count in frame. Thread-safe. May be called from any thread
      Specified by:
      removeFaceNumberListener in interface EffectPlayer
    • addFrameDataListener

      public void addFrameDataListener​(FrameDataListener frameDataListener)
      Description copied from interface: EffectPlayer
      Add callback to receive frame data right after processing in recognizer. Thread-safe. May be called from any thread
      Specified by:
      addFrameDataListener in interface EffectPlayer
    • removeFrameDataListener

      public void removeFrameDataListener​(FrameDataListener frameDataListener)
      Description copied from interface: EffectPlayer
      Remove callback to receive frame data right after processing in recognizer. Thread-safe. May be called from any thread
      Specified by:
      removeFrameDataListener in interface EffectPlayer
    • addLowLightListener

      public void addLowLightListener​(LowLightListener lowLightListener)
      Description copied from interface: EffectPlayer
      Add callback to receive low light info Thread-safe. May be called from any thread
      Specified by:
      addLowLightListener in interface EffectPlayer
    • removeLowLightListener

      public void removeLowLightListener​(LowLightListener lowLightListener)
      Description copied from interface: EffectPlayer
      Remove callback to receive low light info Thread-safe. May be called from any thread
      Specified by:
      removeLowLightListener in interface EffectPlayer
    • addCameraPoiListener

      public void addCameraPoiListener​(CameraPoiListener cameraPoiListener)
      Description copied from interface: EffectPlayer
      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
      Specified by:
      addCameraPoiListener in interface EffectPlayer
    • removeCameraPoiListener

      public void removeCameraPoiListener​(CameraPoiListener cameraPoiListener)
      Description copied from interface: EffectPlayer
      Remove callback to receive center of the face in frame relative to top-left Thread-safe. May be called from any thread
      Specified by:
      removeCameraPoiListener in interface EffectPlayer
    • addEffectInfoListener

      public void addEffectInfoListener​(EffectInfoListener effectInfoListener)
      Description copied from interface: EffectPlayer
      Add callback to receive current effect info from Effect Player. Thread-safe. May be called from any thread
      Specified by:
      addEffectInfoListener in interface EffectPlayer
    • removeEffectInfoListener

      public void removeEffectInfoListener​(EffectInfoListener effectInfoListener)
      Description copied from interface: EffectPlayer
      Remove callback to receive current effect info from Effect Player. Thread-safe. May be called from any thread
      Specified by:
      removeEffectInfoListener in interface EffectPlayer
    • addEffectActivationCompletionListener

      public void addEffectActivationCompletionListener​(EffectActivationCompletionListener effectActivationCompletionListener)
      Description copied from interface: EffectPlayer
      Add callback to receive current effect activation notification from Effect Player. Thread-safe. May be called from any thread
      Specified by:
      addEffectActivationCompletionListener in interface EffectPlayer
    • removeEffectActivationCompletionListener

      public void removeEffectActivationCompletionListener​(EffectActivationCompletionListener effectActivationCompletionListener)
      Description copied from interface: EffectPlayer
      Remove callback to receive current effect activation notification from Effect Player. Thread-safe. May be called from any thread
      Specified by:
      removeEffectActivationCompletionListener in interface EffectPlayer
    • setMaxFaces

      public void setMaxFaces​(int maxFaces)
      Description copied from interface: EffectPlayer
      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.
      Specified by:
      setMaxFaces in interface EffectPlayer
    • setExternalCameraTexture

      public void setExternalCameraTexture​(int name, int width, int height)
      Description copied from interface: EffectPlayer
      Set OpenGL name of input external texture. https://developer.android.com/reference/android/graphics/SurfaceTexture . MUST be called from the render thread
      Specified by:
      setExternalCameraTexture in interface EffectPlayer
      Parameters:
      name - Texture name
      width - Textute width
      height - Texture height
      See Also:
      Note: This function is Android only. Note: We use texture size to calculate aspect ratio only.
    • setUseExtCamTex

      public void setUseExtCamTex​(boolean value)
      Description copied from interface: EffectPlayer
      Use external texture as input source. MUST be called from the render thread
      Specified by:
      setUseExtCamTex in interface EffectPlayer
      See Also:
      EffectPlayer.setExternalCameraTexture(int,int,int)
    • surfaceCreated

      public void surfaceCreated​(int width, int height)
      Description copied from interface: EffectPlayer
      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
      Specified by:
      surfaceCreated in interface EffectPlayer
    • surfaceChanged

      public void surfaceChanged​(int width, int height)
      Description copied from interface: EffectPlayer
      Notify about rendering surface being resized. MUST be called from the render thread
      Specified by:
      surfaceChanged in interface EffectPlayer
    • surfaceDestroyed

      public void surfaceDestroyed()
      Description copied from interface: EffectPlayer
      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
      Specified by:
      surfaceDestroyed in interface EffectPlayer
    • draw

      public long draw()
      Description copied from interface: EffectPlayer
      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
      Specified by:
      draw in interface EffectPlayer
    • drawWithExternalFrameData

      public long drawWithExternalFrameData​(FrameData frameData)
      Description copied from interface: EffectPlayer
      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
      Specified by:
      drawWithExternalFrameData in interface EffectPlayer
    • captureBlit

      public void captureBlit​(int captureWidth, int captureHeight)
      Description copied from interface: EffectPlayer
      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
      Specified by:
      captureBlit in interface EffectPlayer
    • readPixels

      public Data readPixels​(int width, int height)
      Description copied from interface: EffectPlayer
      Receive the last rendered frame in binary form.
      Specified by:
      readPixels in interface EffectPlayer
      Parameters:
      width - width of the picture to take, must match the values passed to `setEffectSize` or `create`
      height - height of the picture to take, must match the values passed to `setEffectSize` or `create`
      Returns:
      RGBA data, size is `width * height * 4` MUST be called from the render thread
    • setRenderConsistencyMode

      public void setRenderConsistencyMode​(ConsistencyMode value)
      Description copied from interface: EffectPlayer
      Thread-safe. May be called from any thread
      Specified by:
      setRenderConsistencyMode in interface EffectPlayer
    • setRenderTransform

      public void setRenderTransform​(PixelRect imageRect, PixelRect viewportRect, boolean xFlip, boolean yFlip)
      Description copied from interface: EffectPlayer
      Request display of sub-area of the input image into sub-area of the output surface, with optional x,y flips imageRect is fitted inside viewportRect Resets transform to default if either rect has 0 dimensions
      Specified by:
      setRenderTransform in interface EffectPlayer
      Parameters:
      imageRect - rectangle in input image coordinates(pixels) after applying input rotations and flips
      viewportRect - rectangle in output surface coordinates(pixels) MUST be called from the render thread
    • processImage

      public Data processImage​(FullImageData inputImage, PixelFormat outputPixelFormat, ProcessImageParams params)
      Description copied from interface: EffectPlayer
      Process an image with current effect. Must be called from the render thread.
      Specified by:
      processImage in interface EffectPlayer
      Parameters:
      inputImage - to avoid conversion recommended to use YUV image
      outputPixelFormat - to avoid conversion recommended to use RGBA
      params - extra image processing arguments
    • processImageFrameData

      public Data processImageFrameData​(FrameData inputFrameData, PixelFormat outputPixelFormat, ProcessImageParams params)
      Description copied from interface: EffectPlayer
      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.
      Specified by:
      processImageFrameData in interface EffectPlayer
      Parameters:
      inputFrameData - `FrameData` with an image
      outputPixelFormat - to avoid conversion recommended to use RGBA
      params - extra image processing arguments
    • processImageData

      public byte[] processImageData​(byte[] inputImage, int width, int height, CameraOrientation orientation, boolean isMirrored, PixelFormat inputPixelFormat, PixelFormat outputPixelFormat, ProcessImageParams params)
      Description copied from interface: EffectPlayer
      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
      Specified by:
      processImageData in interface EffectPlayer
      Parameters:
      inputImage - input image with `width * height * 4` size
      outputPixelFormat - to avoid conversion recommended to use RGBA
    • pushFrame

      public void pushFrame​(FullImageData fullImage)
      Description copied from interface: EffectPlayer
      Provides image to process and to play effect. Thread-safe. May be called from any thread
      Specified by:
      pushFrame in interface EffectPlayer
    • pushFrameWithNumber

      public void pushFrameWithNumber​(FullImageData fullImage, long frameNumber)
      Description copied from interface: EffectPlayer
      Provides image to process and to play effect. Thread-safe. May be called from any thread
      Specified by:
      pushFrameWithNumber in interface EffectPlayer
    • pushFrameData

      public void pushFrameData​(FrameData frameData)
      Description copied from interface: EffectPlayer
      Provides FrameData to process and to play effect. Must contain full image. Thread-safe. May be called from any thread
      Specified by:
      pushFrameData in interface EffectPlayer
    • playbackPlay

      public void playbackPlay()
      Description copied from interface: EffectPlayer
      MUST be called from the main(render) thread
      Specified by:
      playbackPlay in interface EffectPlayer
    • playbackPause

      public void playbackPause()
      Specified by:
      playbackPause in interface EffectPlayer
    • playbackStop

      public void playbackStop()
      Specified by:
      playbackStop in interface EffectPlayer
    • getPlaybackState

      public EffectPlayerPlaybackState getPlaybackState()
      Description copied from interface: EffectPlayer
      Thread-safe. May be called from any thread
      Specified by:
      getPlaybackState in interface EffectPlayer
    • getCurrentScene

      public Scene getCurrentScene()
      Description copied from interface: EffectPlayer
      If currently loaded effect is based on new Scene engine and it is loaded completly returns Scene object from the effect. Otherwise returns null. MUST be called from the render thread Returned Scene object MUST be used only from the render thread and only while the effect is in the loaded state.
      Specified by:
      getCurrentScene in interface EffectPlayer
    • setEffectVolume

      public void setEffectVolume​(float volume)
      Description copied from interface: EffectPlayer
      Set effect audio volume. Thread-safe. May be called from any thread
      Specified by:
      setEffectVolume in interface EffectPlayer
      Parameters:
      volume - A value in range `[0, 1]`, where `1` means maximum volume.
    • enableAudio

      public void enableAudio​(boolean enable)
      Description copied from interface: EffectPlayer
      Set audio enabled
      Specified by:
      enableAudio in interface EffectPlayer
    • getInputManager

      public InputManager getInputManager()
      Description copied from interface: EffectPlayer
      Get interface to control user iterations. This events will be passed to effect. Thread-safe. May be called from any thread
      Specified by:
      getInputManager in interface EffectPlayer
    • startVideoProcessing

      public void startVideoProcessing​(long screenWidth, long screenHeight, CameraOrientation orientation, boolean resetEffect, boolean offlineMode)
      Description copied from interface: EffectPlayer
      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
      Specified by:
      startVideoProcessing in interface EffectPlayer
    • stopVideoProcessing

      public void stopVideoProcessing​(boolean resetEffect)
      Description copied from interface: EffectPlayer
      Finish processing and return renderer to normal state. MUST be called from the render thread
      Specified by:
      stopVideoProcessing in interface EffectPlayer
    • processVideoFrameData

      public FrameData processVideoFrameData​(FrameData inputFrameData, ProcessImageParams params, java.lang.Integer recognizerIterations)
      Description copied from interface: EffectPlayer
      Provide frame data to evaluate video processing. MUST be called from the render thread
      Specified by:
      processVideoFrameData in interface EffectPlayer
      Parameters:
      inputFrameData - Frame Data to process.
      params - Processing params.
      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

      public FrameData processVideoFrame​(FullImageData inputImage, ProcessImageParams params, java.lang.Integer recognizerIterations)
      Description copied from interface: EffectPlayer
      Provide frame to evaluate video processing. MUST be called from the render thread
      Specified by:
      processVideoFrame in interface EffectPlayer
      Parameters:
      inputImage - Image to process.
      params - Processing params.
      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

      public Data drawVideoFrame​(FrameData inputFrameData, long timeNs, PixelFormat outputPixelFormat)
      Description copied from interface: EffectPlayer
      Draw processed frame to image buffer. MUST be called from the render thread
      Specified by:
      drawVideoFrame in interface EffectPlayer
      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: EffectPlayer
      The same as *draw_video_frame* but accepts preallocated buffer to avoid recreation for every frame. MUST be called from the render thread
      Specified by:
      drawVideoFrameAllocated in interface EffectPlayer
    • isVoiceChangerConfigured

      public boolean isVoiceChangerConfigured()
      Description copied from interface: EffectPlayer
      Thread-safe. May be called from any thread
      Specified by:
      isVoiceChangerConfigured in interface EffectPlayer
    • processRecordedAudio

      public void processRecordedAudio​(java.lang.String inFilename, java.lang.String outFilename, float mixVolume)
      Description copied from interface: EffectPlayer
      Process recorded voice with voice changer effects mixing with recorded sounds. Copies in->out if no voice changer or effect is active. Not thread-safe but can be called from any thread. Recorded sounds have the same lifetime as the effect(e.g reset after load_effect, etc.).
      Specified by:
      processRecordedAudio in interface EffectPlayer
      Parameters:
      inFilename - Input filename.
      outFilename - Must have ".wav" extension.
      mixVolume - Relative volume for mixing in sounds, [0..1].
    • writeRecordedAudio

      public void writeRecordedAudio​(java.lang.String filename, long lengthMs)
      Description copied from interface: EffectPlayer
      Save recorded audio. Not thread-safe but can be called from any thread.
      Specified by:
      writeRecordedAudio in interface EffectPlayer
      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: EffectPlayer
      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
      Specified by:
      onVideoRecordStart in interface EffectPlayer
    • onVideoRecordEnd

      public void onVideoRecordEnd()
      Description copied from interface: EffectPlayer
      Triggers record stop events in EP and Effect. Thread-safe. May be called from any thread
      Specified by:
      onVideoRecordEnd in interface EffectPlayer
    • isDeviceNnCompatible

      public boolean isDeviceNnCompatible()
      Description copied from interface: EffectPlayer
      Check is device compatible with Neural Networks player Thread-safe. May be called from any thread On some platforms (e.g. Android) may require the first invocation to be on the render thread
      Specified by:
      isDeviceNnCompatible in interface EffectPlayer
    • startFramedataCapture

      public void startFramedataCapture​(java.lang.String folder, java.lang.String filename)
      Description copied from interface: EffectPlayer
      Request to start framedata capture process. Output file is in CBOR format. Thread-safe. May be called from any thread
      Specified by:
      startFramedataCapture in interface EffectPlayer
      Parameters:
      folder - Output folder.
      filename - Output filename. If the value is an empty string, filename is generated based on date and time.
    • stopFramedataCapture

      public void stopFramedataCapture()
      Specified by:
      stopFramedataCapture in interface EffectPlayer
      See Also:
      EffectPlayer.startFramedataCapture(java.lang.String,java.lang.String)
    • startAnalyticsCapture

      public void startAnalyticsCapture​(java.util.HashMap<java.lang.String,​java.lang.String> deviceInfo, AnalyticsConfig config, AnalyticsListener listener)
      Description copied from interface: EffectPlayer
      Request to start analytics capture process. Analytics supports two business cases: 1. Capture high resolution photo with face (bigger than 720p). 2. Capture N frames with face (N is configurable, if N=0 capturer will skip this case). Result is a path to CBOR file with images and face recognition results, compressed with zlib. Thread-safe. May be called from any thread
      Specified by:
      startAnalyticsCapture in interface EffectPlayer
      Parameters:
      deviceInfo - Any user specific information to attach in analytics report.
      config - Setup configurable properties (like frames counter and delay before capture).
      listener - Callback which is fired in one of two above mentioned cases.
    • stopAnalyticsCapture

      public void stopAnalyticsCapture()
      Specified by:
      stopAnalyticsCapture in interface EffectPlayer
    • effectManager

      public EffectManager effectManager()
      Description copied from interface: EffectPlayer
      Get effect manager object Thread-safe. May be called from any thread
      Specified by:
      effectManager in interface EffectPlayer
    • debugInterface

      public DebugInterface debugInterface()
      Description copied from interface: EffectPlayer
      For internal usage only
      Specified by:
      debugInterface in interface EffectPlayer
    • setRecognizerOfflineMode

      public void setRecognizerOfflineMode​(boolean on)
      Description copied from interface: EffectPlayer
      Force recognizer offline mode Thread-safe. May be called from any thread
      Specified by:
      setRecognizerOfflineMode in interface EffectPlayer
    • setFaceSearchMode

      public void setFaceSearchMode​(FaceSearchMode faceSearch)
      Description copied from interface: EffectPlayer
      Change face search mode Thread-safe. May be called from any thread
      Specified by:
      setFaceSearchMode in interface EffectPlayer
    • create

      @Nullable public static EffectPlayer create​(@NonNull EffectPlayerConfiguration configuration)
    • versionMajor

      public static int versionMajor()
      Description copied from interface: EffectPlayer
      Get major version of EffectPlayer. Use this method to filter out breaking changes in implementation of this class.
      See Also:
      EffectPlayer.versionMinor
    • versionMinor

      public static int versionMinor()
      Description copied from interface: EffectPlayer
      Get minor version of EffectPlayer
      See Also:
      EffectPlayer.versionMajor