Offscreen Effect Player Android
#
Offscreen Effect PlayerOffscreen Effect Player (OEP) allows processing an image using Banuba SDK, no matter where it comes from: the camera, file system or somewhere else. OEP is the camera independent solution that returns a processed image in the same form as received. It means that an input image orientation stays unchanged after Banuba SDK processing. Additionally, OEP can draw the processed image on an external texture.
The entry point to Offscreen Effect Player is OffscreenEffectPlayer
class. This class provides the following functionality:
- Manage image processing โ
processImage
,processFullImageData
,processFullImageDataNoSkip
,setImageProcessListener
.
Working with external texture =
setSurfaceTexture
.Apply the effect to an processed image (e.g. camera frame image of image from disk) โ
loadEffect
,unloadEffect
.Calling any effect methods -
callJsMethod
.
The main advantage of OffscreenEffectPlayer
compared to BanubaSdkManager
is that the OEP does not depend on the camera module.
Note, the best performance is achieved if OEP uses the ExternalTexture
(see SurfaceTexture
) as an output. In this case, the output image is returned in ARGB format. It lets you bypass GPU-CPU synchronization.
If the ExternalTexture
is not used, the output image is returned as the byte buffer in YUV I420 reduced range video format (BT.601 420v). See the YUVConverterMod.java
and ImageProcessResult.java
classes from delivery bundle for more details.
The OEP simply expects an input image buffer to process it by Banuba SDK. In this case, the camera image acquiring should be implemented externally if necessary.
The camera image acquiring implementation can be considered as the main disadvantage of OEP solution.
The Banuba SDK delivery bundle contains the OEP sources in the offscreen
directory from the banuba_sdk
module.
The offscreen
directory contains the following main classes:
OffscreenEffectPlayer
- the main class of the Offscreen Effect Player (OEP) module.OffscreenEffectPlayerConfig
- the Offscreen Effect Player configuration class.BufferAllocator
- the interface for buffer allocation. May be used in the application for retaining buffers.ImageDebugUtils
- the utility class that allow saving an image for debuggin.ImageOrientation
- the class that helps to make a proper image orientation based on the camera or image parameters.ImageProcessResult
- the class of a processed image.
You can use Offscreen Effect Player with or without surface texture.
Surface texture is set by the setSurfaceTexture
method of the OffscreenEffectPlayer
class.
Please, refer to OEP Android demo app section for more details about Offscreen Effect Player usage with a Demo application.