-
Notifications
You must be signed in to change notification settings - Fork 2
VideoFilter
Note: Your video filter implementation needs to implement this interface. For example implementations that fit common use cases, take a look at our
RTC extensions library
.
void start(int width, int height, int sourceFps, Context context, VideoFilterManager videoFilterManager)
void stop()
applyFilter(Bitmap frame, int rotation, long timestampNs)
Initialize the video filter with the specified parameters and prepare to process video frames. The provided observer should be notified of any filtered frames, while the listener handles any initialization errors asynchronously.
-
width
:int
- The width of the source camera stream. -
height
:int
- The height of the source camera stream. -
sourceFps
:int
- The framerate of the source camera stream. -
context
:Context
- An instance of theandroid.content.Context
class, which provides access to system services, resources, and application-specific data in an Android application. -
videoFilterManager
:VideoFilterManager
- The video filter manager currently using this video filter.
N/A
Stop the video filter. All associated resources should be deallocated as the video filter may not be started again and
the instance could be discarded. A stopped filter may be started again, using the start
method. This method is
guaranteed to be called exactly once after each invocation of start
, including if the initialization fails.
N/A
-
frame
:Bitmap
- The frame on which the filter logic should be performed on. NOTE: The bitmap is guaranteed to be valid only until this method returns. If your filter logic is asynchronous, you must copy it. -
rotation
:int
- The rotation of the frame. Useful if your filtering logic needs to know whether the video isn't upright (e.g. device is upside down). -
timestampNs
:Long
- Timestamp of the frame in nanoseconds.
Called once per frame. This should execute the filter logic and generate a new frame containing the filtered frame to
use as video output. Once you have a filtered bitmap available, you should call notifyFrameProcessed
on the video
filter manager (supplied through start()
).
N/A